Beispiel #1
0
        public ActionResult Abakash(int empCode, EmployeeJobHistoryViewModel data)
        {
            data.DecisionDate            = !string.IsNullOrEmpty(data.DecisionDateNP) ? Convert.ToDateTime(NepEngDate.NepToEng(data.DecisionDateNP)) : data.DecisionDate;
            data.LetterIssueDate         = !string.IsNullOrEmpty(data.LetterIssueDateNP) ? Convert.ToDateTime(NepEngDate.NepToEng(data.LetterIssueDateNP)) : data.LetterIssueDate;
            data.EffectiveDate           = !string.IsNullOrEmpty(data.EffectiveDateNP) ? Convert.ToDateTime(NepEngDate.NepToEng(data.EffectiveDateNP)) : data.EffectiveDate;
            data.ServiceCountingFromDate = !string.IsNullOrEmpty(data.ServiceCountingFromDateNP) ? Convert.ToDateTime(NepEngDate.NepToEng(data.ServiceCountingFromDateNP)) : data.ServiceCountingFromDate;
            data.OfficeJoinDate          = !string.IsNullOrEmpty(data.OfficeJoinDateNP) ? Convert.ToDateTime(NepEngDate.NepToEng(data.OfficeJoinDateNP)) : data.OfficeJoinDate;
            data.EffectiveTillDate       = !string.IsNullOrEmpty(data.EffectiveTillDateNP) ? Convert.ToDateTime(NepEngDate.NepToEng(data.EffectiveTillDateNP)) : data.EffectiveTillDate;
            data.SadarDate = !string.IsNullOrEmpty(data.SadarDateNP) ? Convert.ToDateTime(NepEngDate.NepToEng(data.SadarDateNP)) : data.SadarDate;

            if (!ViewBag.AllowView)
            {
                ViewBag.Error = "You are not Authorize to use this Page";
                return(PartialView("_partialviewNotFound"));
            }

            ListOfDatas(empCode);
            List <SelectListItem> SubGroupList = new List <SelectListItem>();

            foreach (var row in _serviceEventSubGroupService.GetSubGroupById(6))
            {
                SubGroupList.Add(new SelectListItem
                {
                    Text  = row.ServiceEventSubGroupName,
                    Value = row.ServiceEventSubGroupId.ToString()
                });
            }
            ViewBag.SubGroupList = SubGroupList;
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View("../Employee/Abakas/Index", data));
                }
                EmployeeJobHistoryDTO dataToInsert = new EmployeeJobHistoryDTO();
                dataToInsert.EmpCode                  = data.EmpCode;
                dataToInsert.Instruction              = data.Instruction;
                dataToInsert.JobTypeId                = data.JobTypeId;
                dataToInsert.LetterRefNo              = data.LetterChalaniNumber;
                dataToInsert.LetterIssueDate          = data.LetterIssueDate;
                dataToInsert.LevelId                  = data.LevelId;
                dataToInsert.OfficeId                 = data.OfficeId;
                dataToInsert.OfficeJoinDate           = data.OfficeJoinDate;
                dataToInsert.RankId                   = data.RankId;
                dataToInsert.RemoteCode               = data.RemoteCode;
                dataToInsert.SadarDate                = data.SadarDate;
                dataToInsert.SadarGarneEmployeeCode   = data.SadarGarneEmployeeCode;
                dataToInsert.SectionId                = data.SectionId;
                dataToInsert.ServiceHolidingDate      = data.ServiceCountingFromDate;
                dataToInsert.ServiceEvent             = data.ServiceEvent;
                dataToInsert.ServiceEventGroupId      = 6;
                dataToInsert.ShiftId                  = data.ShiftId;
                dataToInsert.DeptId                   = data.DeptId;
                dataToInsert.DesgId                   = data.DesgId;
                dataToInsert.DesgKayamMukayamMuKaRaRa = data.DesgKayamMukayamMuKaRaRa;
                dataToInsert.EffectiveDate            = data.EffectiveDate;
                dataToInsert.EffectiveTillDate        = data.EffectiveTillDate;
                dataToInsert.BusinessGroupId          = data.BusinessGroupId;
                dataToInsert.DecisionDate             = data.DecisionDate;
                dataToInsert.ServiceEventSubGroupId   = data.ServiceEventSubGroupId;
                int res = _jobHistoryService.InsertJobHistoryForAbakash(dataToInsert);
                //EmployeeJobHistoryDTO value = _jobHistoryService.GetJobHistoryById(res);  Need to find solution for this
                return(Redirect("/History/" + data.EmpCode));
            }
            catch (Exception ex)
            {
                ViewBag.Error = ex.Message;
                return(View("../Employee/Abakas/Index", data));
            }
        }