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