public JsonResult Insert_Commision(CommisionVM objects) { bool result = false; string msg = "Failed to save record.."; result = MasterMethods.Insert_Commision(objects, ref msg); if (result) { msg = "Successfully Added"; } return(Json(new { Success = result, Message = msg }, JsonRequestBehavior.AllowGet)); }
public static bool Insert_Commision(CommisionVM model, ref string msg) { try { if (string.IsNullOrEmpty(model.CommisionCode)) { strAutoCode = sysfun.GetNewMaxID("CommisionMaster", "CommisionCode", 5, model.DealerCode); } else { strAutoCode = model.CommisionCode; } SqlParameter[] param = { new SqlParameter("@DealerCode", model.DealerCode), //0 new SqlParameter("@CommisionCode", strAutoCode), //1 new SqlParameter("@CommisionDate", sysfun.SaveDate(model.CommisionDate)), //1 new SqlParameter("@EmpCode", model.EmpCode), //2 new SqlParameter("@ProdCode", model.ProdCode == null ? (object)DBNull.Value : model.ProdCode.ToUpper()), //3 new SqlParameter("@CommPerc", model.CommPerc == null ? "0" : model.CommPerc), //4 new SqlParameter("@CommAmount", model.CommAmount == null ? "0" : model.CommAmount), //5 new SqlParameter("@UpdUser", AuthBase.UserId), //6 new SqlParameter("@UpdDate", DateTime.Now), //8 new SqlParameter("@UpdTerm", General.CurrentIP), //7 new SqlParameter("@DelFlag", "N"), //9 new SqlParameter("@BrandCode", model.BrandCode), //10 new SqlParameter("@VersionCode", model.VersionCode), //11 new SqlParameter("@ColorCode", model.ColorCode), //12 new SqlParameter("@Service", model.Service) //12 }; if (sysfun.ExecuteSP_NonQuery("SP_Insert_CommisionMaster", param)) { IsSaved = true; } } catch (Exception ex) { msg = ex.Message; } return(IsSaved); }