//Add To CompanyInfo Table public bool AddCompanyInfo(companyInfo ci) { try { db.companyInfos.InsertOnSubmit(ci); db.SubmitChanges(); return true; } catch (Exception error) { return false; } }
//Edit CompanyInfo Table public int EditCompanyInfo(companyInfo ci) { try { var v = from i in db.companyInfos where i.companyCode == ci.companyCode select i; companyInfo newcompany = v.FirstOrDefault(); if(newcompany != null) { newcompany = ci; db.SubmitChanges(); return 1; } return 0;//not found } catch (Exception error) { return -1; } }
partial void UpdatecompanyInfo(companyInfo instance);
partial void DeletecompanyInfo(companyInfo instance);
partial void InsertcompanyInfo(companyInfo instance);