Example #1
0
        public InventoryOutsDeatilRepositoryTests()
        {
            var contaxt     = new DataLayer.InventoryDBContext();
            var relateduser = contaxt.Users.FirstOrDefault(u => u.Username.Equals("admin"));
            var identity    = new GenericIdentity(relateduser.Username);
            var roles       = relateduser.Roles.Select(p => p.Title).ToArray();
            var principal   = new GenericPrincipal(identity, roles);

            System.Threading.Thread.CurrentPrincipal = principal;
            _InventoryOutsDeatil = new Repositories.InventoryOutsDeatilRepository();
            EInventoryOutsDeatil = new Entities.InventoryOutsDeatil()
            {
                InventoryOutsHeaderId = 1,
                ProductId             = 1,
                Amount = 1,
            };
        }
Example #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 NewProductExist = ProductExist - amount;
                 if (NewProductExist >= 0)
                 {
                     var InentoryDeatiles = new Entities.InventoryOutsDeatil()
                     {
                         Amount    = amount,
                         ProductId = _product.ProductId,
                     };
                     grid.AddItem(InentoryDeatiles);
                     grid.ResetBindings();
                     txtamount.Text  = string.Empty;
                     txtProduct.Text = string.Empty;
                 }
                 else
                 {
                     MessageBox.Show("انبار ظرفیت ندارد", "پیام سیستم");
                 }
             }
             else
             {
                 MessageBox.Show("مشکل در بررسی ظرفیت", "پیام سیستم");
             }
         }
         else
         {
             MessageBox.Show("مقادیر وارد شده نامتعبراست", "پیام سیستم");
         }
     }
 }