Пример #1
0
        public ActionResult AddLabourChargeTypeIndex()
        {
            LabourChargeTypeModel model = new LabourChargeTypeModel();
            string mode           = Request.QueryString["mode"] != null ? Request.QueryString["mode"].ToString() : string.Empty;
            var    LabourChargeId = Request.QueryString["labourchargeid"] != null ? Request.QueryString["labourchargeid"] : null;

            try
            {
                LCTClient = new LabourChargeTypeServiceClient();
                if (mode == "edit")
                {
                    FormMode = mode;
                    LabourChargeTypeDto labourchargedto = LCTClient.GetById(LabourChargeId != null ? Convert.ToInt32(LabourChargeId) : 0);
                    Id = labourchargedto.LabourChargeId;
                    model.LabourCharge = labourchargedto.LabourCharge;
                }
            }
            catch (Exception ex)
            {
                return(View("ErrorPage"));
            }
            finally
            {
                if (LCTClient != null)
                {
                    LCTClient.Close();
                }
            }
            return(View("AddLabourChargeType", model));
        }
Пример #2
0
        public ActionResult GetLabourChargeTypeView()
        {
            LabourChargeTypeModel model = new LabourChargeTypeModel();
            var LabourChargeId          = Request.QueryString["labourchargeid"];

            try
            {
                LCTClient = new LabourChargeTypeServiceClient();
                LabourChargeTypeDto LCTdto = LCTClient.GetById(LabourChargeId != null ? Convert.ToInt32(LabourChargeId) : 0);
                model.LabourChargeId = LCTdto.LabourChargeId;
                model.LabourCharge   = LCTdto.LabourCharge;
            }
            catch (Exception ex)
            {
                return(View("ErrorPage"));
            }
            finally
            {
                if (LCTClient != null)
                {
                    LCTClient.Close();
                }
            }
            return(View("LabourChargeTypeView", model));
        }
Пример #3
0
        public ActionResult LabourChargeTypesListIndex()
        {
            LabourChargeTypeModel model = new LabourChargeTypeModel();

            FormMode = string.Empty;
            try
            {
                model.LabourChargeTypeList = GetLabourChargesType();
            }
            catch (Exception ex)
            {
                return(View("ErrorPage"));
            }

            return(View("LabourChargeTypeList", model));
        }
Пример #4
0
        public ActionResult AddLabourChargeType(LabourChargeTypeModel model)
        {
            ViewData["Error"]   = null;
            TempData["Success"] = null;
            try
            {
                LCTClient = new LabourChargeTypeServiceClient();
                if (ModelState.IsValid)
                {
                    LabourChargeTypeDto labourchargedto = new LabourChargeTypeDto();
                    UserDto             currentUserDto  = (UserDto)Session[Constants.SKCURRENTUSER];

                    labourchargedto.LabourCharge = model.LabourCharge;
                    labourchargedto.CAId         = Convert.ToInt32(Helper.GetCAIdOfUser(currentUserDto));
                    labourchargedto.CreatedBy    = currentUserDto.UserId;
                    labourchargedto.ModifiedBy   = currentUserDto.UserId;



                    if (FormMode == "edit")
                    {
                        labourchargedto.LabourChargeId = Id;
                        labourchargedto = LCTClient.Update(labourchargedto, currentUserDto.UserName);
                    }
                    else
                    {
                        labourchargedto.CreatedBy = currentUserDto.UserId;
                        labourchargedto           = LCTClient.Create(labourchargedto, currentUserDto.UserName);
                    }

                    if (labourchargedto.Response.HasWarning)
                    {
                        int i = 0;
                        foreach (BusinessWarning bw in labourchargedto.Response.BusinessWarnings)
                        {
                            if (bw.Message == Constants.BRLABOURCHARGEVALIDATION)
                            {
                                ModelState.AddModelError("err" + (++i).ToString(), ErrorAndValidationMessages.BRLabourChargeValidation);
                            }
                        }
                    }
                    else
                    {
                        if (FormMode == "edit")
                        {
                            TempData["LabourChargeSaved"] = ClientResources.AddLCTUpdated;
                        }
                        else
                        {
                            TempData["LabourChargeSaved"] = ClientResources.AddLCTSaved;
                        }
                        FormMode = string.Empty;
                        return(RedirectToAction("LabourChargeTypesListIndex", "ClientMasters"));
                    }
                }
            }
            catch (Exception ex)
            {
                return(View("ErrorPage"));
            }
            finally
            {
                if (LCTClient != null)
                {
                    LCTClient.Close();
                }
            }
            //model.ChargesPayableToList = GetChargesPayableTo();
            return(View(model));
        }
Пример #5
0
 public ActionResult LabourChargeTypeListGridView(LabourChargeTypeModel model)
 {
     model.LabourChargeTypeList = GetLabourChargesType();
     return(PartialView("LabourChargeTypeGridView", model));
 }