Example #1
0
 public int AddProductWarrentPolicy(WarrantyPolicy model)
 {
     try
     {
         CommandObj.CommandText = "UDSP_AddProductWarrentPolicy";
         CommandObj.CommandType = CommandType.StoredProcedure;
         CommandObj.Parameters.AddWithValue("@ProductId", model.ProductId);
         CommandObj.Parameters.AddWithValue("@WarrantyFrom", model.WarrantyFrom);
         CommandObj.Parameters.AddWithValue("@WarrantyPeriodInDays", model.WarrantyPeriodInDays);
         CommandObj.Parameters.AddWithValue("@AgeLimitInDealerStock", model.AgeLimitInDealerStock);
         CommandObj.Parameters.AddWithValue("@UserId", model.UserId);
         CommandObj.Parameters.AddWithValue("@FromBatch", model.FromBatch ?? (object)DBNull.Value);
         CommandObj.Parameters.AddWithValue("@ToBatch", model.ToBatch ?? (object)DBNull.Value);
         CommandObj.Parameters.AddWithValue("@ClientId", model.ClientId ?? (object)DBNull.Value);
         CommandObj.Parameters.Add("@RowAffected", SqlDbType.Int);
         CommandObj.Parameters["@RowAffected"].Direction = ParameterDirection.Output;
         ConnectionObj.Open();
         CommandObj.ExecuteNonQuery();
         var rowAffected = Convert.ToInt32(CommandObj.Parameters["@RowAffected"].Value);
         return(rowAffected);
     }
     catch (Exception exception)
     {
         Log.WriteErrorLog(exception);
         throw new Exception("Coluld not add product warrenty policy");
     }
     finally
     {
         CommandObj.Dispose();
         ConnectionObj.Close();
         CommandObj.Parameters.Clear();
     }
 }
Example #2
0
 public int Update(WarrantyPolicy model)
 {
     try
     {
         CommandObj.CommandText = "UDSP_UpdateWarrantyPolicy";
         CommandObj.CommandType = CommandType.StoredProcedure;
         CommandObj.Parameters.Clear();
         CommandObj.Parameters.AddWithValue("@Id", model.Id);
         CommandObj.Parameters.AddWithValue("@WarrantyPeriod", model.WarrantyPeriodInDays);
         CommandObj.Parameters.AddWithValue("@AgeLimitInDealerStock", model.AgeLimitInDealerStock);
         CommandObj.Parameters.AddWithValue("@HasWarrantyCard", model.HasWarrantyCard);
         CommandObj.Parameters.AddWithValue("@ProductId", model.ProductId);
         CommandObj.Parameters.Add("@RowAffected", SqlDbType.Int);
         CommandObj.Parameters["@RowAffected"].Direction = ParameterDirection.Output;
         ConnectionObj.Open();
         CommandObj.ExecuteNonQuery();
         var rowAffected = Convert.ToInt32(CommandObj.Parameters["@RowAffected"].Value);
         return(rowAffected);
     }
     catch (Exception exception)
     {
         Log.WriteErrorLog(exception);
         throw new Exception("Coluld not update product warrenty policy");
     }
     finally
     {
         CommandObj.Dispose();
         ConnectionObj.Close();
         CommandObj.Parameters.Clear();
     }
 }
        public ActionResult ProductWarrantyPolicy(WarrantyPolicy model)
        {
            var user = (ViewUser)Session["user"];

            model.UserId = user.UserId;
            bool result = _iPolicyManager.AddProductWarrentPolicy(model);

            if (result)
            {
                TempData["PolicyMessge"] = "Product Warranty Policy Saved Successfully!";
            }
            else
            {
                TempData["PolicyMessge"] = "Falied to save Product Warranty Policy";
            }
            return(View());
        }
 public ActionResult EditPolicy(long id, WarrantyPolicy modelPolicy)
 {
     try
     {
         bool result = _iPolicyManager.Update(modelPolicy);
         if (result)
         {
             return(RedirectToAction("ViewAllWarrantyPolicy"));
         }
         var policiy = _iPolicyManager.GetAllWarrantyPolicy().ToList().Find(n => n.Id == id);
         return(View(policiy));
     }
     catch (Exception exception)
     {
         Log.WriteErrorLog(exception);
         return(PartialView("_ErrorPartial", exception));
     }
 }
Example #5
0
 public int Delete(WarrantyPolicy model)
 {
     throw new NotImplementedException();
 }
Example #6
0
 public bool Update(WarrantyPolicy model)
 {
     return(_iPolicyGateway.Update(model) > 0);
 }
Example #7
0
 public bool Add(WarrantyPolicy model)
 {
     throw new NotImplementedException();
 }
Example #8
0
        public bool AddProductWarrentPolicy(WarrantyPolicy model)
        {
            var rowAffected = _iPolicyGateway.AddProductWarrentPolicy(model);

            return(rowAffected > 0);
        }