Esempio n. 1
0
        public string report(int categoryId)
        {
            List <Entities.Product> Pdata = new List <Entities.Product>();

            Pdata = pro.GetAll(categoryId).ToList();
            decimal TotalUse = 0;

            foreach (var item in Pdata)
            {
                TotalUse += pro.GetAmount(item.ProductId);
            }
            decimal Capacity = ProCat.Find(categoryId).Capacity;

            string info = string.Empty;

            info += "ظرفیت کل : " + Capacity + Environment.NewLine + Environment.NewLine;
            info += "ظرفیت استفاده شده : " + TotalUse + Environment.NewLine + Environment.NewLine;
            info += "ظرفیت آزاد : " + (Capacity - TotalUse) + Environment.NewLine + Environment.NewLine + Environment.NewLine;;

            info += "کالا ها :" + Environment.NewLine + Environment.NewLine;
            foreach (var item in Pdata)
            {
                info += "  \t\t\t\t\t" + item.Title + "\t\t\t" + "  مقدار (" + pro.GetAmount(item.ProductId) + ")" + item.Unit.Title + Environment.NewLine;
            }
            return(info);
        }
Esempio n. 2
0
 private void btnAddToList_Click(object sender, EventArgs e)
 {
     if (txtamount.Text == string.Empty && txttitle.Text == string.Empty)
     {
         MessageBox.Show("مقادیر را وارذ کنید", "پیام سیستم");
     }
     else
     {
         decimal amount;
         if (decimal.TryParse(txtamount.Text, out amount))
         {
             object obj = pro.GetAmount(_product.ProductId);
             if (obj is decimal)
             {
                 var ProductExist      = (decimal)obj;
                 var InventoryCapacity = pro.Capacity(_product.ProductCategoryId);
                 var NewProductExist   = ProductExist + amount;
                 if (NewProductExist <= InventoryCapacity)
                 {
                     var InentoryDeatiles = new Entities.InventoryInsDeatil()
                     {
                         Amount    = amount,
                         ProductId = _product.ProductId,
                     };
                     grid.AddItem(InentoryDeatiles);
                     grid.ResetBindings();
                     txtamount.Text = string.Empty;
                 }
                 else
                 {
                     MessageBox.Show("انبار ظرفیت ندارد", "پیام سیستم");
                 }
             }
             else
             {
                 MessageBox.Show("مشکل در بررسی ظرفیت", "پیام سیستم");
             }
         }
         else
         {
             MessageBox.Show("مقادیر وارد شده نامتعبراست", "پیام سیستم");
         }
     }
 }