public int InsertmStatutory(mStatutory statutory, string[] conn) { BISPL_CRMDBEntities ce = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn)); ce.mStatutories.AddObject(statutory); ce.SaveChanges(); return(1); }
public int updatemStatutory(mStatutory updateStatutory, string[] conn) { BISPL_CRMDBEntities ce = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn)); ce.mStatutories.Attach(updateStatutory); ce.ObjectStateManager.ChangeObjectState(updateStatutory, EntityState.Modified); ce.SaveChanges(); return(1); }
/// <summary> /// GetDesignationListByID is providing List of DesignationList By ID /// </summary> /// <returns></returns> /// public mStatutory GetGetStatutoryListByID(int statutoryId, string[] conn) { BISPL_CRMDBEntities ce = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn)); mStatutory StatutoryID = new mStatutory(); StatutoryID = (from p in ce.mStatutories where p.ID == statutoryId select p).FirstOrDefault(); ce.Detach(StatutoryID); return(StatutoryID); }
protected void pageSave(Object sender, ToolbarService.iUCToolbarClient e) { try { CustomProfile profile = CustomProfile.GetProfile(); //if (checkDuplicate() == "") //{ mStatutory ObjStatutory = new mStatutory(); if (hdnStatutoryID.Value == string.Empty) { if (chkBLstGroupname.SelectedIndex >= 0) { for (int i = 0; i <= chkBLstGroupname.Items.Count - 1; i++) { if (chkBLstGroupname.Items[i].Selected == true) { ObjStatutory.Name = txtName.Text.Trim(); ObjStatutory.ObjectName = chkBLstGroupname.Items[i].Value; ObjStatutory.Sequence = 0; if (rbtnYes.Checked == true) { ObjStatutory.Active = "Y"; } else { ObjStatutory.Active = "N"; } ObjStatutory.CreatedBy = profile.Personal.UserID.ToString(); ObjStatutory.CreationDate = DateTime.Now; ObjStatutory.Remark = txtRemark.Text; ObjStatutory.CompanyID = profile.Personal.CompanyID; result = StatutoryClient.InsertmStatutory(ObjStatutory, profile.DBConnection._constr); } } if (result == 1) { WebMsgBox.MsgBox.Show("Record saved successfully"); BindGrid(); clear(); } } else { WebMsgBox.MsgBox.Show("Please select Group"); } } else { if (chkBLstGroupname.SelectedIndex >= 0) { for (int i = 0; i <= chkBLstGroupname.Items.Count - 1; i++) { if (chkBLstGroupname.Items[i].Selected == true) { if (checkDuplicate(chkBLstGroupname.Items[i].Value) == "") { ObjStatutory = StatutoryClient.GetGetStatutoryListByID(Convert.ToInt32(hdnStatutoryID.Value), profile.DBConnection._constr); ObjStatutory.Name = txtName.Text.Trim(); ObjStatutory.ObjectName = chkBLstGroupname.SelectedValue; ObjStatutory.Sequence = 0; if (rbtnYes.Checked == true) { ObjStatutory.Active = "Y"; } else { ObjStatutory.Active = "N"; } ObjStatutory.LastModifiedBy = profile.Personal.UserID.ToString(); ObjStatutory.LastModifiedDate = DateTime.Now; ObjStatutory.Remark = txtRemark.Text; result = StatutoryClient.updatemStatutory(ObjStatutory, profile.DBConnection._constr); } } } if (result == 1) { WebMsgBox.MsgBox.Show("Record updated successfully"); BindGrid(); clear(); } } else { WebMsgBox.MsgBox.Show("Please select Group"); } } // } } catch (System.Exception ex) { Login.Profile.ErrorHandling(ex, this, "Statutory Master", "pageSave"); } finally { } }