コード例 #1
0
        public ActionResult Create4(VMLeaveQuota vmLeaveQuota, int?[] SelectedEmpIds)
        {
            List <VMLeaveQuotaChild> vmLeaveQuotaChildEntries = new List <VMLeaveQuotaChild>();

            foreach (var empID in SelectedEmpIds)
            {
                VMLeaveQuotaChild vmLeaveQuotaChild = new VMLeaveQuotaChild();
                string            AL    = Request.Form["AL-" + empID.Value.ToString()].ToString();
                string            CL    = Request.Form["CL-" + empID.Value.ToString()].ToString();
                string            SL    = Request.Form["SL-" + empID.Value.ToString()].ToString();
                string            STDL  = Request.Form["STDL-" + empID.Value.ToString()].ToString();
                string            ALCop = Request.Form["ALCop-" + empID.Value.ToString()].ToString();
                string            ALCF  = Request.Form["ALCF-" + empID.Value.ToString()].ToString();
                vmLeaveQuotaChild.EmpID         = (int)empID;
                vmLeaveQuotaChild.AL            = (float)Convert.ToDouble(AL);
                vmLeaveQuotaChild.CL            = (float)Convert.ToDouble(CL);
                vmLeaveQuotaChild.SL            = (float)Convert.ToDouble(SL);
                vmLeaveQuotaChild.STDL          = (float)Convert.ToDouble(STDL);
                vmLeaveQuotaChild.CollapseLeave = (float)Convert.ToDouble(ALCop);
                vmLeaveQuotaChild.CarryForward  = (float)Convert.ToDouble(ALCF);

                vmLeaveQuotaChildEntries.Add(vmLeaveQuotaChild);
            }
            vmLeaveQuota.LeaveQuotaChild = vmLeaveQuotaChildEntries.ToList();
            VMLeaveQuota vm = LeaveQuotaService.GetCreate4(vmLeaveQuota);

            if (vm.ErrorMessages.Count == 0)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View("Create3", vm));
            }
        }