Exemplo n.º 1
0
        public JsonResult UpdateCommissionStatus(int commissionId, bool status)
        {
            object result = null;

            try
            {
                var i = BL_AdditionalCommission.UpdateCommissionStatus(commissionId, status);
                if (i == 1)
                {
                    if (status)
                    {
                        result = new { status = 1, msg = "Commission enabled successfully." };
                    }
                    else
                    {
                        result = new { status = 1, msg = "Commission disabled successfully." };
                    }
                }
                else
                {
                    result = new { status = -1, msg = "Some unknown error has occurred ! Please try after some time." };
                }
            }
            catch (Exception)
            {
                result = new { status = -1, msg = "Some unknown error has occurred ! Please try after some time." };
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public ActionResult AddEditCommission(etblAdditionalCommission model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    string sStartDate = model.dtCommisionStartDate;
                    string sEndDate   = model.dtCommisionEndDate;

                    model.iPropId              = Convert.ToInt32(Session["PropId"].ToString());
                    model.iActionBy            = ((OneFineRateBLL.BL_Login.UserDetails)(Session["UserDetails"])).iUserId;
                    model.dtCommisionStartDate = clsUtils.ConvertddmmyyyytommDDyyyy(model.dtCommisionStartDate);
                    model.dtCommisionEndDate   = clsUtils.ConvertddmmyyyytommDDyyyy(model.dtCommisionEndDate);

                    var startDate = DateTime.ParseExact(model.dtCommisionStartDate, "mm/dd/yyyy", null);
                    var endDate   = DateTime.ParseExact(model.dtCommisionEndDate, "mm/dd/yyyy", null);

                    if (startDate > endDate)
                    {
                        return(Json(new { status = -1, msg = "Start Date must be less than End Date ! " }, JsonRequestBehavior.AllowGet));
                    }

                    string statusMessage = string.Empty;

                    int status = BL_AdditionalCommission.AddUpdateRecord(model);

                    if (status == 0)
                    {
                        statusMessage = "Commission already exist between " + sStartDate + " and " + sEndDate;
                    }
                    else if (model.iAdditionalCommisionId != 0 && status == 1)
                    {
                        statusMessage = "Commission updated successfully";
                    }
                    else
                    {
                        statusMessage = "Commission added successfully";
                    }

                    return(Json(new { status = status, msg = statusMessage }, JsonRequestBehavior.AllowGet));
                }
                catch (Exception)
                {
                    return(Json(new { status = -1, msg = "Some unknown error has occurred ! Please try after some time." }, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(new { status = -1, msg = "Valiation error..." }, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 3
0
        public ActionResult AddEditCommission(int?commissionId)
        {
            var     PropId = Convert.ToInt32(Session["PropId"].ToString());
            decimal value  = BL_AdditionalCommission.GetPropertyCommission(PropId);

            if (commissionId.HasValue && commissionId != 0)
            {
                etblAdditionalCommission obj = BL_AdditionalCommission.GetSingleRecordById(commissionId.Value);
                obj.baseDCommission = value;
                ViewBag.HeaderText  = "Edit Commission";
                return(PartialView("_AddCommission", obj));
            }
            else
            {
                ViewBag.HeaderText = "Add Commission";
                return(PartialView("_AddCommission", new etblAdditionalCommission()
                {
                    baseDCommission = value
                }));
            }
        }