public static void SaveList(List <HCMIS.Desktop.DirectoryServices.ItemManufacturer> list)
        {
            BLL.ItemManufacturer bv = new BLL.ItemManufacturer();
            foreach (HCMIS.Desktop.DirectoryServices.ItemManufacturer v in list)
            {
                // try to load by primary key
                bv.LoadByItemIDandManufacturerID(v.ItemID.Value, v.ManufacturerID.Value);

                // if the entry doesn't exist, create it
                if (bv.RowCount == 0)
                {
                    bv.AddNew();
                }
                // populate the contents of v on the to the database list
                if (v.ItemID.HasValue)
                {
                    bv.ItemID = v.ItemID.Value;
                }
                if (v.ManufacturerID.HasValue)
                {
                    bv.ManufacturerID = v.ManufacturerID.Value;
                }
                if (v.PackageLevel.HasValue)
                {
                    bv.PackageLevel = v.PackageLevel.Value;
                }
                if (v.QuantityPerLevel.HasValue)
                {
                    bv.QuantityPerLevel = v.QuantityPerLevel.Value;
                }
                if (v.IsssuingDefault.HasValue)
                {
                    bv.IsssuingDefault = v.IsssuingDefault.Value;
                }
                if (v.RecevingDefault.HasValue)
                {
                    bv.RecevingDefault = v.RecevingDefault.Value;
                }
                if (v.BrandName != "" && v.BrandName != null)
                {
                    bv.BrandName = v.BrandName;
                }
                if (v.StackHeight.HasValue)
                {
                    bv.StackHeight = v.StackHeight.Value;
                }

                bv.BoxHeight = 1;
                bv.BoxLength = 1;
                bv.BoxWidth  = 1;
                bv.Save();
            }
        }
 public static void DeleteList(List <int> list)
 {
     BLL.ItemManufacturer bv = new BLL.ItemManufacturer();
     foreach (int v in list)
     {
         // try to load by primary key
         bv.LoadByPrimaryKey(v);
         // if the entry doesn't exist, create it
         if (bv.RowCount > 0)
         {
             bv.MarkAsDeleted();
             bv.Save();
         }
         // populate the contents of v on the to the database list
     }
 }
        /// <summary>
        /// Moves the specified pick list ID.
        /// </summary>
        /// <param name="PickListID">The pick list ID.</param>
        public static void Move(int PickListID)
        {
            DataView dv = GetTransferReportForStore();
            PalletLocation pl = new PalletLocation();
            foreach (DataRowView dr in dv)
            {

                int amount = Convert.ToInt32(dr["packs"]);
                int palletLocationID = Convert.ToInt32(dr["PalletLocationID"]);

                ReceivePallet rp = new ReceivePallet();
                ReceiveDoc rdoc = new ReceiveDoc();

                rp.LoadByPrimaryKey(Convert.ToInt32(dr["ReceivePalletID"]));
                rdoc.LoadByPrimaryKey(rp.ReceiveID);
                amount *= rdoc.QtyPerPack;

                int qPalletLocationID = PalletLocation.GetTransferPalletLocation(Convert.ToInt32(dr["PhysicalStoreID"]));
                pl.LoadByPrimaryKey(qPalletLocationID);
                if (pl.IsColumnNull("PalletID"))
                {
                    Pallet p = new Pallet();
                    p.AddNew();
                    p.StorageTypeID = Convert.ToInt32(StorageType.Quaranteen);
                    p.Save();
                    pl.PalletID = p.ID;
                    pl.Save();
                }

                ReceivePallet rp2 = new ReceivePallet();
                ReceiveDoc rd = new ReceiveDoc();

                rd.LoadByPrimaryKey(rp.ReceiveID);
                rp2.AddNew();

                rp2.PalletID = pl.PalletID;
                rp2.ReceiveID = rp.ReceiveID;

                // calculate the new balance
                BLL.ItemManufacturer im = new BLL.ItemManufacturer();
                //im.LoadDefaultReceiving(rd.ItemID, Convert.ToInt32(dr["ManufacturerID"]));
                if (dr["BoxLevel"] == DBNull.Value)
                {
                    dr["BoxLevel"] = 0;
                }
                im.LoadIMbyLevel(rd.ItemID, Convert.ToInt32(dr["ManufacturerID"]), Convert.ToInt32(dr["BoxLevel"]));
                int packqty = (amount / im.QuantityInBasicUnit);
                rp2.ReservedStock = 0;
                rp.ReservedStock -= amount;
                BLL.ReceivePallet.MoveBalance(rp, rp2, amount);
                //rp2.Balance = amount;
                //rp.Balance -= rp2.Balance;

                //rp.Save();
                //rp2.Save();

                pl.Confirmed = false;
                pl.Save();
                if (rp.Balance == 0)
                {
                    PalletLocation.GarbageCollection();
                }

            }
        }
        public static void SaveList(List<HCMIS.Desktop.DirectoryServices.ItemManufacturer> list)
        {
            BLL.ItemManufacturer bv = new BLL.ItemManufacturer();
            foreach (HCMIS.Desktop.DirectoryServices.ItemManufacturer v in list)
            {
                // try to load by primary key
                bv.LoadByItemIDandManufacturerID(v.ItemID.Value, v.ManufacturerID.Value);

                // if the entry doesn't exist, create it
                if (bv.RowCount == 0)
                {
                    bv.AddNew();
                }
                // populate the contents of v on the to the database list
                if (v.ItemID.HasValue)
                    bv.ItemID = v.ItemID.Value;
                if (v.ManufacturerID.HasValue)
                    bv.ManufacturerID = v.ManufacturerID.Value;
                if (v.PackageLevel.HasValue)
                    bv.PackageLevel = v.PackageLevel.Value;
                if (v.QuantityPerLevel.HasValue)
                    bv.QuantityPerLevel = v.QuantityPerLevel.Value;
                if (v.IsssuingDefault.HasValue)
                    bv.IsssuingDefault = v.IsssuingDefault.Value;
                if (v.RecevingDefault.HasValue)
                    bv.RecevingDefault = v.RecevingDefault.Value;
                if (v.BrandName != "" && v.BrandName != null)
                    bv.BrandName = v.BrandName;
                if (v.StackHeight.HasValue)
                    bv.StackHeight = v.StackHeight.Value;

                bv.BoxHeight = 1;
                bv.BoxLength = 1;
                bv.BoxWidth = 1;
                bv.Save();
            }
        }
 public static List<ItemManufacturer> GetAll()
 {
     BLL.ItemManufacturer v = new BLL.ItemManufacturer();
     v.LoadAll();
     return ToList(v);
 }
        public static void DeleteList(List<int> list)
        {
            BLL.ItemManufacturer bv = new BLL.ItemManufacturer();
            foreach (int v in list)
            {
                // try to load by primary key
                bv.LoadByPrimaryKey(v);
                // if the entry doesn't exist, create it
                if (bv.RowCount > 0)
                {
                    bv.MarkAsDeleted();
                    bv.Save();
                }
                // populate the contents of v on the to the database list

            }
        }
        /// <summary>
        /// Moves the specified pick list ID.
        /// </summary>
        /// <param name="PickListID">The pick list ID.</param>
        public static void Move(int PickListID)
        {
            DataView       dv = GetTransferReportForStore();
            PalletLocation pl = new PalletLocation();

            foreach (DataRowView dr in dv)
            {
                int amount           = Convert.ToInt32(dr["packs"]);
                int palletLocationID = Convert.ToInt32(dr["PalletLocationID"]);

                ReceivePallet rp   = new ReceivePallet();
                ReceiveDoc    rdoc = new ReceiveDoc();

                rp.LoadByPrimaryKey(Convert.ToInt32(dr["ReceivePalletID"]));
                rdoc.LoadByPrimaryKey(rp.ReceiveID);
                amount *= rdoc.QtyPerPack;

                int qPalletLocationID = PalletLocation.GetTransferPalletLocation(Convert.ToInt32(dr["PhysicalStoreID"]));
                pl.LoadByPrimaryKey(qPalletLocationID);
                if (pl.IsColumnNull("PalletID"))
                {
                    Pallet p = new Pallet();
                    p.AddNew();
                    p.StorageTypeID = Convert.ToInt32(StorageType.Quaranteen);
                    p.Save();
                    pl.PalletID = p.ID;
                    pl.Save();
                }


                ReceivePallet rp2 = new ReceivePallet();
                ReceiveDoc    rd  = new ReceiveDoc();


                rd.LoadByPrimaryKey(rp.ReceiveID);
                rp2.AddNew();

                rp2.PalletID  = pl.PalletID;
                rp2.ReceiveID = rp.ReceiveID;


                // calculate the new balance
                BLL.ItemManufacturer im = new BLL.ItemManufacturer();
                //im.LoadDefaultReceiving(rd.ItemID, Convert.ToInt32(dr["ManufacturerID"]));
                if (dr["BoxLevel"] == DBNull.Value)
                {
                    dr["BoxLevel"] = 0;
                }
                im.LoadIMbyLevel(rd.ItemID, Convert.ToInt32(dr["ManufacturerID"]), Convert.ToInt32(dr["BoxLevel"]));
                int packqty = (amount / im.QuantityInBasicUnit);
                rp2.ReservedStock = 0;
                rp.ReservedStock -= amount;
                BLL.ReceivePallet.MoveBalance(rp, rp2, amount);
                //rp2.Balance = amount;
                //rp.Balance -= rp2.Balance;

                //rp.Save();
                //rp2.Save();

                pl.Confirmed = false;
                pl.Save();
                if (rp.Balance == 0)
                {
                    PalletLocation.GarbageCollection();
                }
            }
        }
        public static List <ItemManufacturer> ToList(BLL.ItemManufacturer v)
        {
            List <ItemManufacturer> list = new List <ItemManufacturer>();

            while (!v.EOF)
            {
                ItemManufacturer t = new ItemManufacturer();
                if (!v.IsColumnNull("ID"))
                {
                    t.ID = v.ID;
                }
                if (!v.IsColumnNull("ItemID"))
                {
                    t.ItemID = v.ItemID;
                }
                if (!v.IsColumnNull("ManufacturerID"))
                {
                    t.ManufacturerID = v.ManufacturerID;
                }
                if (!v.IsColumnNull("PackageLevel"))
                {
                    t.PackageLevel = v.PackageLevel;
                }
                if (!v.IsColumnNull("QuantityPerLevel"))
                {
                    t.QuantityPerLevel = v.QuantityPerLevel;
                }
                if (!v.IsColumnNull("IsssuingDefault"))
                {
                    t.IsssuingDefault = v.IsssuingDefault;
                }
                if (!v.IsColumnNull("RecevingDefault"))
                {
                    t.RecevingDefault = v.RecevingDefault;
                }
                if (!v.IsColumnNull("BoxWidth"))
                {
                    t.BoxWidth = v.BoxWidth;
                }
                if (!v.IsColumnNull("BoxHeight"))
                {
                    t.BoxHeight = v.BoxHeight;
                }
                if (!v.IsColumnNull("BoxLength"))
                {
                    t.BoxLength = v.BoxLength;
                }
                if (!v.IsColumnNull("BrandName"))
                {
                    t.BrandName = v.BrandName;
                }
                if (!v.IsColumnNull("StackHeight"))
                {
                    t.StackHeight = v.StackHeight;
                }

                list.Add(t);
                v.MoveNext();
            }
            return(list);
        }
 public static List <ItemManufacturer> GetAll()
 {
     BLL.ItemManufacturer v = new BLL.ItemManufacturer();
     v.LoadAll();
     return(ToList(v));
 }
        /// <summary>
        /// Palletizes the transfer.
        /// </summary>
        /// <param name="rec">The rec.</param>
        public static void PalletizeTransfer(ReceiveDoc rec)
        {
            BLL.ReceivePallet rp = new ReceivePallet();
            Pallet pallet = new Pallet();
            PalletLocation pl = new PalletLocation();
            rec.Rewind();
            BLL.ItemManufacturer im = new BLL.ItemManufacturer();
            rp.AddNew();
            rp.ReceivedQuantity = rec.Quantity;
            rp.Balance = rec.Quantity;
            rp.ReservedStock = 0;
            rp.ReceiveID = rec.ID;
            //Just To Get the First Free pallet
            DataTable dtpl = PalletLocation.GetAllFreeForItem(rec.ItemID, StorageType.Free);
            DataRow drpl = dtpl.Rows[0];
            //After we assign the Location for it
            pl.LoadByPrimaryKey(Convert.ToInt32(drpl["ID"]));

            rp.PalletID = pl.PalletID;
            rp.PalletLocationID = pl.ID;
            rp.IsOriginalReceive = true;
            rp.Save();
        }