public mSection GetWarehouseSectionByID(long SectionID, string[] conn) { BISPL_CRMDBEntities ce = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn)); mSection sec = new mSection(); sec = (from p in ce.mSections where p.ID == SectionID select p).FirstOrDefault(); return(sec); }
public static string WMSaveRequestHead(object objCon, string State) { string result = ""; CustomProfile profile = CustomProfile.GetProfile(); iWarehouseClient Warehouseclient = new iWarehouseClient(); mSection sec = new mSection(); try { Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary = (Dictionary <string, object>)objCon; sec.Name = dictionary["Name"].ToString(); sec.SortCode = long.Parse(dictionary["SortCode"].ToString()); sec.Description = dictionary["description"].ToString(); sec.CompanyID = long.Parse(dictionary["CompanyId"].ToString()); sec.CustomerID = long.Parse(dictionary["CustomerID"].ToString()); sec.PathID = long.Parse(dictionary["hdnpassageID"].ToString()); if (State == "Edit") { sec.ID = Convert.ToInt64(HttpContext.Current.Session["PassageID"].ToString()); sec.CreatedBy = profile.Personal.UserID; sec.CreationDate = DateTime.Now; long Section = Warehouseclient.SaveWarehouseSection(sec, profile.DBConnection._constr); } else { sec.CreatedBy = profile.Personal.UserID; sec.CreationDate = DateTime.Now; long SectionID = Warehouseclient.SaveWarehouseSection(sec, profile.DBConnection._constr); } result = "Section saved successfully"; } catch { result = "Some error occurred"; } finally { Warehouseclient.Close(); } return(result); }
public long SaveWarehouseSection(mSection wsection, string[] conn) { try { BISPL_CRMDBEntities db = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn)); if (wsection.ID == 0) { db.mSections.AddObject(wsection); db.SaveChanges(); } else { db.mSections.Attach(wsection); db.ObjectStateManager.ChangeObjectState(wsection, EntityState.Modified); db.SaveChanges(); } return(wsection.ID); } catch { return(0); } }
protected void GetSectionByID() { CustomProfile profile = CustomProfile.GetProfile(); iWarehouseClient Warehouseclient = new iWarehouseClient(); try { mSection sec = new mSection(); sec = Warehouseclient.GetWarehouseSectionByID(long.Parse(hdnsectionID.Value), profile.DBConnection._constr); if (sec.Name != null) { txtsection.Text = sec.Name.ToString(); } if (sec.SortCode != null) { txtsortcode.Text = sec.SortCode.ToString(); } if (sec.Description != null) { txtdescription.Text = sec.Description.ToString(); } if (sec.CustomerID != null) { hdncustomerID.Value = sec.CustomerID.ToString(); } hdnCompanyID.Value = sec.CompanyID.ToString(); } catch (System.Exception ex) { Login.Profile.ErrorHandling(ex, this, "WarehousePassage", "GetPassageID"); } finally { Warehouseclient.Close(); } }