public void Delete(GoodyConvertCountingUnit entity) { try { this.Delete(new List <Data.GoodyConvertCountingUnit>() { entity }); } catch { throw; } }
private void Button_Click(object sender, RoutedEventArgs e) { try { var goody = Business.GetGoodiesBusiness().GetById(GoodyId); var firstUnitId = goody.CBaseCountingUnit.Value; var firstUnitCount = 1; var goodyConvertCountingUnitBusiness = Business.GetGoodyConvertCountingUnitBusiness(); for (int i = 0; i < this.grdUnitCount.Items.Count; i++) { var item = (test)this.grdUnitCount.Items[i]; var secondUnitId = item.SecondUnitId.ToGUID(); var secondUnitCount = item.Count2; if (secondUnitId == Guid.Empty || !secondUnitCount.HasValue) { return; } var errorMessage = string.Empty; if (!ValidateForm(goody, secondUnitCount.Value, out errorMessage)) { throw new Exception(errorMessage); } var goodyConvertCountingUnit = goodyConvertCountingUnitBusiness.GetByGoodyId(GoodyId, firstUnitId, secondUnitId); if (goodyConvertCountingUnit == null) { goodyConvertCountingUnit = new GoodyConvertCountingUnit(); } goodyConvertCountingUnit.IDCommodity = GoodyId; goodyConvertCountingUnit.CCCUIDBaseInfo1 = firstUnitId; goodyConvertCountingUnit.CCCUCount1 = firstUnitCount; goodyConvertCountingUnit.CCCUIDBaseInfo2 = secondUnitId; goodyConvertCountingUnit.CCCUCount2 = secondUnitCount.Value; goodyConvertCountingUnitBusiness.Save(goodyConvertCountingUnit); } SetDataGrid(); } catch (Exception ex) { AccountingKernel.Forms.Base.BaseWindow.ShowError(ex); } }
public void Insert(GoodyConvertCountingUnit goodyConvertCountingUnit) { try { if (goodyConvertCountingUnit.ID == Guid.Empty) { goodyConvertCountingUnit.ID = Guid.NewGuid(); } this.Table.Add(goodyConvertCountingUnit); this.SubmitChanges(); } catch { throw; } }
public void Save(GoodyConvertCountingUnit goodyConvertCountingUnit) { try { if (goodyConvertCountingUnit.ID == Guid.Empty) { this.Insert(goodyConvertCountingUnit); } else { this.SubmitChanges(); } } catch { throw; } }