Ejemplo n.º 1
0
 public Notify Update(POS_PRODUCT ProductModel)
 {
     try
     {
         objNotify.RowEffected = _objDALProduct.UpdateProduct(ProductModel);
         if (objNotify.RowEffected > 0)
         {
             objNotify.NotifyMessage = "Record Updated Successfully";
         }
         else
         {
             objNotify.NotifyMessage = "Product Not Updated";
         }
         return(objNotify);
     }
     catch (Exception ex)
     {
         if (ex is DALException)
         {
             throw ex;
         }
         else
         {
             ExceptionLogger.WriteExceptionInDB(ex, ExceptionLevel.DAL, ExceptionType.Error);
         }
         throw new BALException(ex.Message.ToString());
     }
 }
Ejemplo n.º 2
0
        public static int UpdateProduct(int productId, string productName, ref List <string> errors)
        {
            if (productId <= 0 || productId > DALProduct.ReadProductList(ref errors).Count)
            {
                errors.Add("Invalid product id");
            }

            if (errors.Count > 0)
            {
                return(-1);
            }

            return(DALProduct.UpdateProduct(productId, productName, ref errors));
        }
Ejemplo n.º 3
0
        public void UpdateProductTest()
        {
            int           myId   = 1;
            Random        rand   = new Random();
            ProductInfo   pi     = new ProductInfo(myId, "turtle neck " + rand.Next(10000));
            List <string> errors = new List <string>();
            int           result = DALProduct.UpdateProduct(pi.product_id, pi.product_name, ref errors);

            Assert.AreEqual(0, errors.Count);
            Assert.AreNotEqual(-1, result);

            ProductInfo verify = DALProduct.ReadProductDetail(myId, ref errors);

            Assert.AreEqual(0, errors.Count);

            Assert.AreEqual(pi.product_id, verify.product_id);
            Assert.AreEqual(pi.product_name, verify.product_name);
        }
Ejemplo n.º 4
0
 public bool UpdateProduct(Product product)
 {
     return(productDAL.UpdateProduct(product));
 }