本文整理汇总了C#中bycar.DataAccess.SpareGroupCreate方法的典型用法代码示例。如果您正苦于以下问题:C# DataAccess.SpareGroupCreate方法的具体用法?C# DataAccess.SpareGroupCreate怎么用?C# DataAccess.SpareGroupCreate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bycar.DataAccess
的用法示例。
在下文中一共展示了DataAccess.SpareGroupCreate方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateItem
private spare_group CreateItem()
{
DataAccess da = new DataAccess();
spare_group i = new spare_group();
i.name = edtName.Text;
i.description = edtDescr.Text;
i.ParentGroup = da.GetSpareGroups().FirstOrDefault(g => g.name == _parentName);
return da.SpareGroupCreate(i);
}
示例2: SpareEdit
// ЗАПЧАСТЬ - РЕДАКТИРОВАТЬ - СОХРАНИТЬ
public spare SpareEdit(int SpareID, string Name, string Code, string CodeShatem, int QDemand, int GroupID, int BrandID, int UnitID, string Description)
{
DataAccess da = new DataAccess();
spare sp = da.GetSpare(SpareID);
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;
if (sp.brand == null)
sp.brandReference.Load();
if (sp.spare_group == null)
sp.spare_groupReference.Load();
string OldBrandName = sp.BrandName;
int OldBrandID = sp.brand.id;
int OldGroupID = sp.spare_group.id;
spare s = da.SpareEdit(sp, BrandID, GroupID, UnitID);
SpareContainer.Instance.Update(s.id);
if (OldBrandID != BrandID || OldGroupID != GroupID)
{
if (SpareContainer.Instance.Spares.Where(i => i.BrandID == OldBrandID && i.GroupID == OldGroupID).Count() == 0)
{
da.SpareGroupDelete(OldBrandID, OldGroupID);
mainWindowObj.LoadGroups(false);
}
if (SpareContainer.Instance.Spares.Where(i => i.BrandID == BrandID && i.GroupID == GroupID).Count() == 1)
{
da.SpareGroupCreate(GroupID, BrandID);
mainWindowObj.LoadGroups(false);
}
}
return s;
}
示例3: SpareCreateSilent
public SpareView SpareCreateSilent(string Name, string CodeShatem, string GroupName, string ParentGroupName, string BrandName, string UnitName, string Description)
{
DataAccess da = new DataAccess();
spare s = da.SpareCreateSilent(Name, CodeShatem, GroupName, ParentGroupName, BrandName, UnitName, Description);
SpareView SpareViewItem = da.GetSpareView(s.id);
SpareContainer.Instance.Update(s.id);
int BrandID = SpareViewItem.BrandID;
int GroupID = SpareViewItem.GroupID;
if (SpareContainer.Instance.Spares.Where(i => i.BrandID == BrandID && i.GroupID == GroupID).Count() == 1)
{
if (s.brand == null)
s.brandReference.Load();
da.SpareGroupCreate(GroupID, s.brand.name);
}
return SpareViewItem;
}
示例4: 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;
}
示例5: getGroups
public static List<spare_group> getGroups(string FilePath)
{
List<spare_group> items = new List<spare_group>();
// Объявляем и забиваем файл в документ
XmlDocument xd = new XmlDocument();
FileStream fs = new FileStream(FilePath, FileMode.Open);
xd.Load(fs);
XmlNodeList list = xd.GetElementsByTagName("Row"); // Создаем и заполняем лист по тегу "row"
for (int i = 0; i < list.Count; i++)
{
spare_group b = new spare_group();
b.code1C = list[i].FirstChild.InnerText;
b.name = list[i].LastChild.InnerText;
items.Add(b);
}
MessageBox.Show("Сформирован список из " + items.Count.ToString() + " элементов.");
DataAccess da = new DataAccess();
int xc = 0;
foreach (spare_group i in items)
{
da.SpareGroupCreate(i);
xc++;
}
MessageBox.Show("Добавлено " + xc.ToString() + " элементов.");
FixGroupsParents(list);
// Закрываем поток
fs.Close();
return items;
}
示例6: BackgroundEdit_DoWork
private void BackgroundEdit_DoWork(object sender, DoWorkEventArgs e)
{
int SpareID = _spare.id;
DataAccess da = new DataAccess();
spare sp = da.GetSpare(SpareID);
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;
if (sp.brand == null)
sp.brandReference.Load();
if (sp.spare_group == null)
sp.spare_groupReference.Load();
string OldBrandName = sp.BrandName;
int OldBrandID = sp.brand.id;
int OldGroupID = sp.spare_group.id;
spare s = da.SpareEdit(sp, SpareUpdateBrandID, SpareUpdateGroupID, SpareUpdateUnitID);
SpareContainer.Instance.Update(s.id);
if (OldBrandID != SpareUpdateBrandID || OldGroupID != SpareUpdateGroupID)
{
if (SpareContainer.Instance.Spares.Where(i => i.BrandID == OldBrandID && i.GroupID == OldGroupID).Count() == 0)
{
da.SpareGroupDelete(OldBrandID, OldGroupID);
ReloadGroups = true;
}
if (SpareContainer.Instance.Spares.Where(i => i.BrandID == SpareUpdateBrandID && i.GroupID == SpareUpdateGroupID).Count() == 1)
{
da.SpareGroupCreate(SpareUpdateGroupID, SpareUpdateBrandID);
ReloadGroups = true;
}
}
}
示例7: 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;
}
}