public int AccountCreate(account _obj) { _obj.created_on = DateTime.Now; objDataContext.AddToaccounts(_obj); objDataContext.SaveChanges(); return _obj.id; }
public int AccountCreate(account _obj, string bankName, string typeName) { _obj.created_on = DateTime.Now; //_obj.bank = objDataContext.banks.FirstOrDefault(c => c.name == bankName); //_obj.account_type = objDataContext.account_type.FirstOrDefault(c => c.name == typeName); objDataContext.AddToaccounts(_obj); objDataContext.SaveChanges(); return _obj.id; }
private account getItemFromFields() { account item = new account(); item.id = this._id; item.name = edtName.Text; item.description = edtDescr.Text; item.unn = edtUNN.Text; item.shipping_base = edtShippingBase.Text; item.shipping_point = edtShippingDest.Text; item.okpo = edtOKPO.Text; item.discount = 0; item.address = edtAddress.Text; //item.bank_score = edtScore.Text; return item; }
/// <summary> /// Deprecated Method for adding a new object to the accounts EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToaccounts(account account) { base.AddObject("accounts", account); }
/// <summary> /// Create a new account object. /// </summary> /// <param name="id">Initial value of the id property.</param> /// <param name="name">Initial value of the name property.</param> public static account Createaccount(global::System.Int32 id, global::System.String name) { account account = new account(); account.id = id; account.name = name; return account; }
public void AccountEdit(account item) { account original = objDataContext.accounts.FirstOrDefault(b => b.id == item.id); original.name = item.name; original.address = item.address; //original.account_type = obj //original.admin_unit = item.mfo; //item.bank //original.bankReference.EntityKey = objDataContext.banks.FirstOrDefault(b => b.id == item.bank.id).EntityKey; //original.bank_score = item.bank_score; original.description = item.description; original.discount = item.discount; original.okpo = item.okpo; original.shipping_base = item.shipping_base; original.shipping_point = item.shipping_point; original.unn = item.unn; //if (original.created_on == null) // original.created_on = DateTime.Now; objDataContext.SaveChanges(); }
/*= * counter++; GlobalCnt++; string[] RawRecord = csvData.RawRecord.Split(';'); // delete chars after _ CodeShatem = CodeShatem.Split('_')[0]; if (da.SpareEdit(CodeShatem, Code)) Console.WriteLine(GlobalCnt.ToString() + ": " + CodeShatem + " ok!"); else Console.WriteLine(GlobalCnt.ToString() + ": " + CodeShatem + " not found."); if (counter > 1000) { counter = 0; da = new DataAccess(); Console.WriteLine("Data access object refresh"); }*/ public void AccountEdit(account item, string bankName, string typeName) { account original = objDataContext.accounts.FirstOrDefault(b => b.id == item.id); //original.bank = objDataContext.banks.FirstOrDefault(c => c.name == bankName); //original.account_type = objDataContext.account_type.FirstOrDefault(c => c.name == typeName); original.name = item.name; original.address = item.address; //original.bank_score = item.bank_score; original.description = item.description; original.discount = item.discount; original.okpo = item.okpo; original.shipping_base = item.shipping_base; original.shipping_point = item.shipping_point; original.unn = item.unn; //if (original.created_on == null) // original.created_on = DateTime.Now; objDataContext.SaveChanges(); }