public int InsertmProductCategory(mProductCategory prdCategory, string[] conn) { BISPL_CRMDBEntities ce = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn)); ce.mProductCategories.AddObject(prdCategory); ce.SaveChanges(); return(1); }
public int updatemProductCategory(mProductCategory updatePrdCategory, string[] conn) { BISPL_CRMDBEntities ce = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn)); ce.mProductCategories.Attach(updatePrdCategory); ce.ObjectStateManager.ChangeObjectState(updatePrdCategory, EntityState.Modified); ce.SaveChanges(); return(1); }
/// <summary> /// GetProductCategoryListByID is providing List of ProductCategory ByID for Update record /// </summary> /// <returns></returns> /// public mProductCategory GetProductCategoryListByID(int prdCategoryId, string[] conn) { BISPL_CRMDBEntities ce = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn)); mProductCategory ProductCategoryID = new mProductCategory(); ProductCategoryID = (from p in ce.mProductCategories where p.ID == prdCategoryId select p).FirstOrDefault(); ce.Detach(ProductCategoryID); return(ProductCategoryID); }
protected void pageSave(Object sender, BrilliantWMS.ToolbarService.iUCToolbarClient e) { try { CustomProfile profile = CustomProfile.GetProfile(); if (checkDuplicate() == "") { mProductCategory ObjPrdCategory = new mProductCategory(); if (hdnPrdCategoryID.Value == string.Empty) { ObjPrdCategory.Name = txtPrdCategory.Text.Trim(); if (txtSequence.Text != string.Empty) { ObjPrdCategory.Sequence = Convert.ToInt64(txtSequence.Text); } else { ObjPrdCategory.Sequence = 0; } if (rbtnYes.Checked == true) { ObjPrdCategory.Active = "Y"; } else { ObjPrdCategory.Active = "N"; } ObjPrdCategory.CreatedBy = profile.Personal.UserID.ToString(); ObjPrdCategory.CreationDate = DateTime.Now; //ObjPrdCategory.CompanyID = profile.Personal.CompanyID; ObjPrdCategory.CompanyID = long.Parse(ddlcompanymain.SelectedItem.Value); ObjPrdCategory.CustomerID = long.Parse(hdncustomerid.Value); int result = ProductCategoryClient.InsertmProductCategory(ObjPrdCategory, profile.DBConnection._constr); if (result == 1) { WebMsgBox.MsgBox.Show("Record saved successfully"); } BindGrid(); clear(); } else { ObjPrdCategory = ProductCategoryClient.GetProductCategoryListByID(Convert.ToInt32(hdnPrdCategoryID.Value), profile.DBConnection._constr); long customerID = long.Parse(ObjPrdCategory.CustomerID.ToString()); ObjPrdCategory.Name = txtPrdCategory.Text.Trim(); if (txtSequence.Text != string.Empty) { ObjPrdCategory.Sequence = Convert.ToInt64(txtSequence.Text); } else { ObjPrdCategory.Sequence = 0; } if (rbtnYes.Checked == true) { ObjPrdCategory.Active = "Y"; } else { ObjPrdCategory.Active = "N"; } ObjPrdCategory.LastModifiedBy = profile.Personal.UserID.ToString(); ObjPrdCategory.LastModifiedDate = DateTime.Now; ObjPrdCategory.CompanyID = long.Parse(ddlcompanymain.SelectedItem.Value); if (hdncustomerid.Value == "") { ObjPrdCategory.CustomerID = customerID; } else { ObjPrdCategory.CustomerID = long.Parse(hdncustomerid.Value); } int result = ProductCategoryClient.updatemProductCategory(ObjPrdCategory, profile.DBConnection._constr); if (result == 1) { WebMsgBox.MsgBox.Show("Record updated successfully"); } BindGrid(); clear(); } } } catch (System.Exception ex) { Login.Profile.ErrorHandling(ex, this, "Product Category Master", "pageSave"); } finally { } }