public mFloar GetWarehouseFloarbyID(long FloarID, string[] conn)
        {
            BISPL_CRMDBEntities ce = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn));
            mFloar floar           = new mFloar();

            floar = (from p in ce.mFloars
                     where p.ID == FloarID
                     select p).FirstOrDefault();
            return(floar);
        }
        protected void GetFloarByID()
        {
            CustomProfile    profile         = CustomProfile.GetProfile();
            iWarehouseClient Warehouseclient = new iWarehouseClient();

            try
            {
                mFloar Floar = new mFloar();
                Floar = Warehouseclient.GetWarehouseFloarbyID(long.Parse(hdnfloarID.Value), profile.DBConnection._constr);

                if (Floar.Name != null)
                {
                    txtfloarname.Text = Floar.Name.ToString();
                }
                if (Floar.SortCode != null)
                {
                    txtsortcode.Text = Floar.SortCode.ToString();
                }
                if (Floar.Capacity != null)
                {
                    txtcapacity.Text = Floar.Capacity.ToString();
                }
                if (Floar.Description != null)
                {
                    txtdescription.Text = Floar.Description.ToString();
                }
                if (Floar.CustomerID != null)
                {
                    hdncustomerID.Value = Floar.CustomerID.ToString();
                }
                hdnCompanyID.Value = Floar.CompanyID.ToString();
            }
            catch (System.Exception ex)
            {
                Login.Profile.ErrorHandling(ex, this, "WarehouseFloar", "GetFloarByID");
            }
            finally
            {
                Warehouseclient.Close();
            }
        }
        public static string WMSaveRequestHead(object objCon, string State)
        {
            string           result          = "";
            CustomProfile    profile         = CustomProfile.GetProfile();
            iWarehouseClient Warehouseclient = new iWarehouseClient();
            mFloar           floar           = new mFloar();

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

                floar.Name        = dictionary["Name"].ToString();
                floar.SortCode    = long.Parse(dictionary["SortCode"].ToString());
                floar.Capacity    = decimal.Parse(dictionary["Capacity"].ToString());
                floar.Description = dictionary["description"].ToString();
                floar.CompanyID   = long.Parse(dictionary["CompanyId"].ToString());
                floar.CustomerID  = long.Parse(dictionary["CustomerID"].ToString());
                floar.BuildingID  = long.Parse(dictionary["BuildingID"].ToString());

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

            return(result);
        }
 public long SaveWarehouseFloar(mFloar wfloar, string[] conn)
 {
     try
     {
         BISPL_CRMDBEntities db = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn));
         if (wfloar.ID == 0)
         {
             db.mFloars.AddObject(wfloar);
             db.SaveChanges();
         }
         else
         {
             db.mFloars.Attach(wfloar);
             db.ObjectStateManager.ChangeObjectState(wfloar, EntityState.Modified);
             db.SaveChanges();
         }
         return(wfloar.ID);
     }
     catch
     {
         return(0);
     }
 }