本文整理汇总了C#中bycar.DataAccess.SpareCreate方法的典型用法代码示例。如果您正苦于以下问题:C# DataAccess.SpareCreate方法的具体用法?C# DataAccess.SpareCreate怎么用?C# DataAccess.SpareCreate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bycar.DataAccess
的用法示例。
在下文中一共展示了DataAccess.SpareCreate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SpareCreate
// ЗАПЧАСТЬ - ДОБАВИТЬ - СОХРАНИТЬ
public spare SpareCreate(string Name, string Code, string CodeShatem, int QDemand, int GroupID, int BrandID, string UnitName, string Description)
{
DataAccess da = new DataAccess();
spare sp = new spare();
sp.name = Name;
sp.code = Code;
sp.codeShatem = CodeShatem;
sp.q_demand = QDemand;
sp.q_demand_clear = QDemand;
sp.q_rest = 0;
sp.description = Description;
spare s = da.SpareCreate(sp, BrandID, GroupID, UnitName);
SpareContainer.Instance.Update(s.id);
if (SpareContainer.Instance.Spares.Where(
i => i.BrandID == BrandID && i.GroupID == GroupID).Count() == 1)
{
da.SpareGroupCreate(GroupID, BrandID);
}
return s;
}
示例2: getSpares
//private delegate void UpdateProgressBarDelegate(System.Windows.DependencyProperty dp, Object value);
public static int getSpares(string FilePath)
{
List<spare> items = new List<spare>();
// Объявляем и забиваем файл в документ
XmlDocument xd = new XmlDocument();
FileStream fs = new FileStream(FilePath, FileMode.Open);
xd.Load(fs);
DataAccess da = new DataAccess();
XmlNodeList list = xd.GetElementsByTagName("Row"); // Создаем и заполняем лист по тегу "user"
LoadingWindowView v = new LoadingWindowView();
v._ProgressBar.Minimum = 0;
v._ProgressBar.Maximum = list.Count;
v._ProgressBar.Value = list.Count / 2;
//object value = 0;
//Сохраняем значение ProgressBar
//Создаем новый экземпляр делегата для ProgressBar
// который показывает на метод ProgressBar.SetValue
//UpdateProgressBarDelegate updatePbDelegate = new UpdateProgressBarDelegate(v._ProgressBar.SetValue);
v.Show();
string Errors = "";
for (int i = 1; i < list.Count; i++)
{
try
{
spare b = new spare();
b.code1C = list[i].ChildNodes[0].InnerText;
if (!da.ExistCode1C(b.code1C))
{
b.codeShatem = list[i].ChildNodes[1].InnerText;
b.name = list[i].ChildNodes[2].InnerText;
string BrandCode1C = list[i].ChildNodes[3].InnerText;
string GroupCode1C = list[i].ChildNodes[4].InnerText;
da.SpareCreate(b, BrandCode1C, GroupCode1C);
}
}
catch (Exception qwe)
{
Errors += qwe.Message;
}
}
// Закрываем поток
fs.Close();
v.Close();
return items.Count;
}
示例3: ImportSparesFromCSV
private void ImportSparesFromCSV()
{
ConsoleManager.Show();
Console.WriteLine(DateTime.Now.ToShortTimeString() + " - started...");
string FilePath = "";
OpenFileDialog dlg = new OpenFileDialog();
dlg.DefaultExt = ".csv"; // Default file extension
// dlg.Filter = "*.csv"; // Filter files by extension
Nullable<bool> result = dlg.ShowDialog();
if (result == true)
{
DataAccess da = new DataAccess();
// Open document
FilePath = dlg.FileName;
int counter = 0;
int GlobalCnt = 0;
using (CsvReader csvData = new CsvReader(FilePath))
{
csvData.Settings.Delimiter = ';';
while (csvData.ReadRecord())
{
try
{
counter++;
GlobalCnt++;
string[] RawRecord = csvData.RawRecord.Split(';');
string GrandParentGroupName = RawRecord[0];
string ParentGroupName = RawRecord[1];
string BrandName = RawRecord[2];
string SpareCode = RawRecord[3];
string SpareName = RawRecord[4];
string CarModels = RawRecord[5];
if (!da.SpareExist(SpareCode, SpareName))
{
Console.WriteLine(GlobalCnt.ToString() + ": " + SpareName + " - " + SpareCode + " - creating");
da.SpareCreate(GrandParentGroupName, ParentGroupName, BrandName, SpareCode, SpareName, CarModels);
}
else
{
Console.WriteLine(GlobalCnt.ToString() + ": " + SpareName + " - " + SpareCode + " already exist");
}
if (counter > 1000)
{
counter = 0;
da = new DataAccess();
Console.WriteLine("Data access object refresh");
}
}
catch (Exception e1)
{
Console.WriteLine(GlobalCnt.ToString() + ": Exception failed: " + e1.Message);
}
}
} // dispose of parser
}
Console.WriteLine(DateTime.Now.ToShortTimeString() + " - finished...");
MessageBox.Show("Import finished!");
Console.ReadLine();
ConsoleManager.Hide();
Application.Current.Shutdown();
}
示例4: BackgroundCreate_DoWork
private void BackgroundCreate_DoWork(object sender, DoWorkEventArgs e)
{
DataAccess da = new DataAccess();
spare sp = new spare();
sp.name = SpareUpdateName;
sp.code = SpareUpdateCode;
sp.codeShatem = SpareUpdateCodeShatem;
sp.q_demand = SpareUpdateQDemand;
sp.q_demand_clear = SpareUpdateQDemand;
sp.q_rest = 0;
sp.description = SpareUpdateDescription;
spare s = da.SpareCreate(sp, SpareUpdateBrandID, SpareUpdateGroupID, SpareUpdateUnitID);
SpareContainer.Instance.Update(s.id);
if (SpareContainer.Instance.Spares.Where(i => i.BrandID == SpareUpdateBrandID && i.GroupID == SpareUpdateGroupID).Count() == 1)
{
if (s.brand == null)
s.brandReference.Load();
da.SpareGroupCreate(SpareUpdateGroupID, s.brand.name);
ReloadGroups = true;
}
}