public mShelf GetWarehouseShelfByID(long ShelfID, string[] conn)
        {
            BISPL_CRMDBEntities ce = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn));
            mShelf shelf           = new mShelf();

            shelf = (from p in ce.mShelves
                     where p.ID == ShelfID
                     select p).FirstOrDefault();
            return(shelf);
        }
Exemple #2
0
        public static string WMSaveRequestHead(object objCon, string State)
        {
            string           result          = "";
            CustomProfile    profile         = CustomProfile.GetProfile();
            iWarehouseClient Warehouseclient = new iWarehouseClient();

            mShelf shelf = new mShelf();

            try
            {
                Dictionary <string, object> dictionary = new Dictionary <string, object>();
                dictionary = (Dictionary <string, object>)objCon;

                shelf.Name        = dictionary["Name"].ToString();
                shelf.SortCode    = long.Parse(dictionary["SortCode"].ToString());
                shelf.Description = dictionary["description"].ToString();
                shelf.CompanyID   = long.Parse(dictionary["CompanyId"].ToString());
                shelf.CustomerID  = long.Parse(dictionary["CustomerID"].ToString());
                shelf.SectionID   = long.Parse(dictionary["hdnsectionID"].ToString());

                if (State == "Edit")
                {
                    shelf.ID           = Convert.ToInt64(HttpContext.Current.Session["Shelf"].ToString());
                    shelf.CreatedBy    = profile.Personal.UserID;
                    shelf.CreationDate = DateTime.Now;
                    long FloarID = Warehouseclient.SaveWarehouseShelf(shelf, profile.DBConnection._constr);
                }
                else
                {
                    shelf.CreatedBy    = profile.Personal.UserID;
                    shelf.CreationDate = DateTime.Now;
                    long FloarID = Warehouseclient.SaveWarehouseShelf(shelf, profile.DBConnection._constr);
                }
                result = "Shelf saved successfully";
            }
            catch { result = "Some error occurred"; }
            finally { Warehouseclient.Close(); }

            return(result);
        }
 public long SaveWarehouseShelf(mShelf wshelf, string[] conn)
 {
     try
     {
         BISPL_CRMDBEntities db = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn));
         if (wshelf.ID == 0)
         {
             db.mShelves.AddObject(wshelf);
             db.SaveChanges();
         }
         else
         {
             db.mShelves.Attach(wshelf);
             db.ObjectStateManager.ChangeObjectState(wshelf, EntityState.Modified);
             db.SaveChanges();
         }
         return(wshelf.ID);
     }
     catch
     {
         return(0);
     }
 }
Exemple #4
0
        protected void GetWarehouseShelfByID()
        {
            CustomProfile    profile         = CustomProfile.GetProfile();
            iWarehouseClient Warehouseclient = new iWarehouseClient();

            try
            {
                mShelf shelf = new mShelf();
                shelf = Warehouseclient.GetWarehouseShelfByID(long.Parse(hdnshelfID.Value), profile.DBConnection._constr);

                if (shelf.Name != null)
                {
                    txtshelf.Text = shelf.Name.ToString();
                }
                if (shelf.SortCode != null)
                {
                    txtsortcode.Text = shelf.SortCode.ToString();
                }
                if (shelf.Description != null)
                {
                    txtdescription.Text = shelf.Description.ToString();
                }
                if (shelf.CustomerID != null)
                {
                    hdncustomerID.Value = shelf.CustomerID.ToString();
                }
                hdnCompanyID.Value = shelf.CompanyID.ToString();
            }
            catch (System.Exception ex)
            {
                Login.Profile.ErrorHandling(ex, this, "WarehousePassage", "GetWarehouseShelfByID");
            }
            finally
            {
                Warehouseclient.Close();
            }
        }