コード例 #1
0
        public static bool Insert_MonthlyCommisionMaster(MonthlyCommisionVM model, ref string msg)
        {
            try
            {
                if (string.IsNullOrEmpty(model.TransCode))
                {
                    if (sysfun.IsExist("CommMonth", model.CommMonth, "MonthlyCommision", model.DealerCode, " And Service = '" + model.Service + "'"))
                    {
                        msg = "Monthly Commision for the Month " + model.CommMonth + " for the selected Service is already exists ";

                        //return false;
                        strAutoCode = sysfun.GetNewMaxID("MonthlyCommision", "TransCode", 8, model.DealerCode);
                    }
                    else
                    {
                        strAutoCode = sysfun.GetNewMaxID("MonthlyCommision", "TransCode", 8, model.DealerCode);
                    }
                }
                else
                {
                    strAutoCode = model.TransCode;
                }


                SqlParameter[] param =
                {
                    new SqlParameter("@DealerCode", model.DealerCode),                //0
                    new SqlParameter("@TransCode", strAutoCode),                      //1
                    new SqlParameter("@TransDate", sysfun.SaveDate(model.TransDate)), //1
                    new SqlParameter("@CommMonth", model.CommMonth),                  //2
                    new SqlParameter("@UpdUser", AuthBase.UserId),                    //6
                    new SqlParameter("@UpdDate", DateTime.Now),                       //8
                    new SqlParameter("@UpdTerm", General.CurrentIP),                  //7
                    new SqlParameter("@Remarks", model.Remarks),                      //11
                    new SqlParameter("@Service", model.Service)                       //12
                };


                if (ObjTrans.BeginTransaction(ref Trans) == true)
                {
                    if (sysfun.ExecuteSP_NonQuery("SP_Insert_MonthlyCommision", param, Trans))
                    {
                        IsSaved = true;
                    }
                    else
                    {
                        return(IsSaved);
                    }
                }
            }
            catch (Exception ex)
            {
                msg = ex.Message;
            }

            return(IsSaved);
        }
コード例 #2
0
        public JsonResult Insert_MonthlyCommisionMaster(MonthlyCommisionVM objects)
        {
            bool result = false;

            string msg = "Failed to save record..";

            result = MonthlyCommisionMethods.Insert_MonthlyCommisionMaster(objects, ref msg);

            if (result)
            {
                msg = "Successfully Added";
            }

            return(Json(new { Success = result, Message = msg }, JsonRequestBehavior.AllowGet));
        }