Example #1
0
        /// <summary>
        ///  not use
        /// </summary>
        /// <param name="fkProduct"></param>
        static void InitialPosStock(int fkProduct)
        {
            SSLsEntities db = new SSLsEntities();
            //using (SSLsEntities db = new SSLsEntities())
            //{
            var products = db.PosStock.Where(w => w.Enable == true && w.FKProduct == fkProduct).ToList();

            if (products.Count() == 0)
            {
                List <PosStock> posStocks = new List <PosStock>();
                PosStock        pos;
                int             i = 1;
                foreach (var item in products)
                {
                    pos             = new PosStock();
                    pos.CreateBy    = "admin";
                    pos.CreateDate  = DateTime.Now;
                    pos.CurrentQty  = 0;
                    pos.Description = "Initial Stock ";
                    pos.Enable      = true;
                    pos.FKProduct   = item.Id;
                    pos.Name        = "-";
                    pos.OldQty      = 0;
                    pos.UpdateBy    = "admin";
                    pos.UpdateDate  = DateTime.Now;
                    pos.FKShelf     = 21;
                    posStocks.Add(pos);
                }
                db.BulkInsert(posStocks);
                db.SaveChanges();
            }
        }