/// <summary> /// حذف رکورد از جدول معین /// </summary> /// <param name="accountigMoien"></param> private void remove_AccountingMoien(Guid accountingMoienId) { AccountingMoein am = ak1.AccountingMoeins.First(i => i.Id == accountingMoienId); ak1.AccountingMoeins.Remove(am); ak1.SaveChanges(); }
public void Delete(AccountingMoein moi) { try { Table.Remove(moi); this.SubmitChanges(); } catch { throw; } }
public void Save(AccountingMoein entity) { try { this.Save(new List <Data.AccountingMoein>() { entity }); } catch { throw; } }
private void SaveAccountingMoein() { try { var accountingMoeinBusiness = Business.GetAccountingMoeinBusiness(); var entities = new List <AccountingMoein>(); var am = accountingMoeinBusiness.GetById(AccountingMoeinId.ToGUID()); if (am == null) { am = new AccountingMoein(); } am.MIdMoein = txt_grouhCode.Text + txt_kol_code.Text + txt_moien_code.Text; am.MName = txt_moien.Text; am.MIdGroup = txt_group.Text; am.MIdAll = txt_all.Text; am.MGrouhF = txt_name_latin_grouh.Text; am.MFALLName = txt_name_latin_kol.Text; am.MFName = txt_name_latin_moien.Text; am.MMoein = txt_mahiteMoien.Text; am.MMoienType = cmb_noeMoien.SelectedValue.ToGUID(); accountingMoeinBusiness.Save(am); // update groups in accountingmoein by group var groups = accountingMoeinBusiness.GetByStartWithMIdMoein(txt_grouhCode.Text).ToList(); groups.ForEach(r => { r.MName = txt_group.Text; r.MFName = txt_name_latin_grouh.Text; r.MIdMoein = txt_grouhCode.Text + r.MIdMoein.Remove(0, txt_grouhCode.Text.Length); }); entities.AddRange(groups); // update kol in accountingmoein by kol var kolCode = txt_grouhCode.Text + txt_kol_code.Text; var kols = accountingMoeinBusiness.GetByStartWithMIdMoein(kolCode).ToList(); kols.ForEach(r => { r.MName = txt_all.Text; r.MFName = txt_name_latin_kol.Text; r.MIdMoein = kolCode + r.MIdMoein.Remove(0, kolCode.Length); }); entities.AddRange(kols); // update moeins in accountingmoein by moein var moeinCode = txt_grouhCode.Text + txt_kol_code.Text + txt_moien_code.Text; var moeins = accountingMoeinBusiness.GetByStartWithMIdMoein(moeinCode).ToList(); moeins.ForEach(r => { r.MName = txt_moien.Text; r.MFName = txt_name_latin_moien.Text; r.MIdMoein = moeinCode + r.MIdMoein.Remove(0, moeinCode.Length); }); entities.AddRange(moeins); accountingMoeinBusiness.Save(entities); AccountingMoeinId = am.Id; } catch { throw; } }