本文整理汇总了C#中bycar.DataAccess.GetSpareView方法的典型用法代码示例。如果您正苦于以下问题:C# DataAccess.GetSpareView方法的具体用法?C# DataAccess.GetSpareView怎么用?C# DataAccess.GetSpareView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bycar.DataAccess
的用法示例。
在下文中一共展示了DataAccess.GetSpareView方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReportViewSpareSalesByPeriod
public ReportViewSpareSalesByPeriod(DateTime df, DateTime dt, int SpareID, int WID)
{
InitializeComponent();
dateTo = dt;
dateFrom = df;
WarehouseID = WID;
DataAccess db = new DataAccess();
Spare = db.GetSpareView(SpareID);
if (Spare == null)
return;
}
示例2: 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;
}
示例3: SpareCreate
// ЗАПЧАСТЬ - ДОБАВИТЬ
public SpareView SpareCreate()
{
if (!ready())
return null;// null;
SpareView result = null;
SpareEditView v = new SpareEditView();
v._id = -1;
v.ParentWorkspace = mainWindowObj;
v.ShowDialog();
if (v._spare != null)
{
DataAccess db = new DataAccess();
result = db.GetSpareView(v._spare.id);
mainWindowObj.LoadSpares();
mainWindowObj.LoadGroups(false);
}
return result;
}
示例4: OfferingAdd
private void OfferingAdd(int SpareID, decimal Q, decimal Pusd, string GroupName, string ParentGroupName)
{
SpareInSpareIncomeView sisi = new SpareInSpareIncomeView();
if (Income.currency == null)
Income.currencyReference.Load();
sisi.num = offerings.Count + 1;
sisi.CurrencyID = Income.currency.id;
sisi.description = "";
sisi.Markup = 0;
sisi.PIn = Pusd;
sisi.PInBasic = Pusd;
sisi.POut = Pusd;
sisi.POutBasic = Pusd;
sisi.QIn = Q;
sisi.QRest = Q;
sisi.S = Q * Pusd;
sisi.SBasic = sisi.S;
sisi.GroupName = GroupName;
sisi.ParentGroupName = ParentGroupName;
DataAccess db = new DataAccess();
sisi.SpareID = SpareID;
SpareView sv = db.GetSpareView(SpareID);
sisi.SpareName = sv.name;
sisi.SpareCode = sv.code;
sisi.SpareCodeShatem = sv.codeShatem;
sisi.BrandName = sv.BrandName;
sisi.SpareIncomeID = Income.id;
sisi.VatRateName = "0%";
offerings.Add(sisi);
}
示例5: Window_Closing
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if (IsNew && TemporarySaved)
{
DataAccess db = new DataAccess();
SpareViewItem = db.GetSpareView(this._id);
Marvin.Instance.SpareDelete(SpareViewItem);
}
}
示例6: Update
/*
* OLD
public void Update(SpareView spare)
{
if (Spares.Where(x => x!= null).Where(x => x.id != null).Where(x => x.id == spare.id).Count() > 0)
{
SpareView sv = spares.Where(x => x != null).Where(x => x.id != null).FirstOrDefault(x => x.id == spare.id);
if(sv != null)
Spares.Remove(sv);
}
Spares.Add(spare);
}*/
/* dec2012
public void Update(SpareView NewSpareInstance, bool UpdateFromDB = true) // обновление без удаления
{
if (UpdateFromDB)
{
DataAccess da = new DataAccess();
SpareView OldSpareInstance = Spares.Where(x => x != null).FirstOrDefault(x => x.id == NewSpareInstance.id);
// если в кэше такая есть, запоминает индекс и перезаписываем
if (OldSpareInstance != null)
{
int i = Spares.IndexOf(OldSpareInstance);
spares[i] = NewSpareInstance;
}
else
{
spares.Add(NewSpareInstance);
}
}
else
{
List<SpareView> items = this.Spares;
SpareView ind = items.Where(x => x != null).FirstOrDefault(x => x.id == NewSpareInstance.id);
if (ind != null)
{
int i = spares.IndexOf(ind);
spares[i] = NewSpareInstance;
}
else
{
spares.Add(NewSpareInstance);
}
}
}
*/
public void Update(int SpareID, bool UpdateFromDB = true, bool SkipQRestsCalculation = false)
{
if (UpdateFromDB)
{
DataAccess da = new DataAccess();
SpareView OldSpareInstance = Spares.Where(x => x != null).FirstOrDefault(x => x.id == SpareID);
SpareView NewSpareInstance = da.GetSpareView(SpareID);
// если в кэше такая есть, запоминает индекс и перезаписываем
if (OldSpareInstance != null)
{
int i = Spares.IndexOf(OldSpareInstance);
spares[i] = NewSpareInstance;
}
else
{
spares.Add(NewSpareInstance);
}
}
else
{
List<SpareView> items = this.Spares.ToList();
SpareView ind = items.Where(x => x != null).FirstOrDefault(x => x.id == SpareID);
if (ind != null)
{
int i = spares.IndexOf(ind);
spares[i] = ind;
}
else
{
DataAccess db = new DataAccess();
SpareView sv = db.GetSpareView(SpareID);
spares.Add(sv);
}
}
if (!SkipQRestsCalculation)
{
Helper.CalculateQRests(SpareID);
Update(SpareID, true, true);
}
}