Exemplo n.º 1
0
 public int SaveTestPolicy(TestPolicyModel model)
 {
     try
     {
         CommandObj.CommandText = "UDSP_SaveTestPolicy";
         CommandObj.CommandType = CommandType.StoredProcedure;
         CommandObj.Parameters.AddWithValue("@TestCategoryId", model.TestCategoryId);
         CommandObj.Parameters.AddWithValue("@ProductId", model.ProductId);
         CommandObj.Parameters.AddWithValue("@Parameter", model.Parameter);
         CommandObj.Parameters.AddWithValue("@AcceptableValue", model.AcceptableValue);
         CommandObj.Parameters.AddWithValue("@Remarks", model.Remarks);
         CommandObj.Parameters.AddWithValue("@UserId", model.UserId);
         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 test policy");
     }
     finally
     {
         CommandObj.Dispose();
         ConnectionObj.Close();
         CommandObj.Parameters.Clear();
     }
 }
 public ActionResult TestPolicy(TestPolicyModel modelPolicy)
 {
     try
     {
         var user = (ViewUser)Session["user"];
         modelPolicy.UserId = user.UserId;
         bool result = _iPolicyManager.SaveTestPolicy(modelPolicy);
         if (result)
         {
             return(RedirectToAction("ViewTestPolicy"));
         }
         return(View());
     }
     catch (Exception exception)
     {
         Log.WriteErrorLog(exception);
         return(PartialView("_ErrorPartial", exception));
     }
 }
Exemplo n.º 3
0
        public bool SaveTestPolicy(TestPolicyModel modelPolicy)
        {
            var rowAffected = _iPolicyGateway.SaveTestPolicy(modelPolicy);

            return(rowAffected > 0);
        }