void IBaseBOL.DeleteRecord(params string[] DelParam) { Tools tools = new Tools(); tools.AccessList = tools.GetAccessList(BaseID); if (tools.HasAccess("Edit", "NewsKeywords")) { EntityKeywords ObjTable = dataContext.EntityKeywords.Single(p => p.Code.Equals(DelParam[0])); ObjTable.Deleted = true; //dataContext.EntityKeywords.DeleteOnSubmit(ObjTable); dataContext.SubmitChanges(); } }
public int SaveChanges(bool IsNewRecord) { HttpSessionState Session = HttpContext.Current.Session; EntityKeywords ObjTable; if (IsNewRecord) { ObjTable = new EntityKeywords(); dataContext.EntityKeywords.InsertOnSubmit(ObjTable); } else { ObjTable = dataContext.EntityKeywords.Single(p => p.Code.Equals(this.Code)); } try { #region Save Detail Controls PropertyInfo piMasterCode = ObjTable.GetType().GetProperty("NewsCode"); piMasterCode.SetValue(ObjTable, MasterCode, new object[] { }); string BaseID = this.ToString().Substring(3, this.ToString().Length - 3); Tools tools = new Tools(); tools.AccessList = tools.GetAccessList(BaseID); foreach (WebControl wc in ObjectList) { string Property = wc.ID.Substring(3, wc.ID.Length - 3); PropertyInfo pi = ObjTable.GetType().GetProperty(Property); string FullPropName = BaseID + "." + Property; if (tools.HasAccess("Edit", BaseID + "." + Property)) { pi.SetValue(ObjTable, Tools.GetControlValue(wc), new object[] { }); } } #endregion dataContext.SubmitChanges(); } catch (Exception exp) { throw exp; } return(ObjTable.Code); }