Beispiel #1
0
        public ActionResult KajMaKhataune(EmployeeKaazViwModel data)
        {
            int empCode = data.EmpCode;

            data.LetterIssueDate = Convert.ToDateTime(NepEngDate.NepToEng(data.LetterIssueDateNP));
            data.KajStartDate    = Convert.ToDateTime(NepEngDate.NepToEng(data.KajStartDateNP));
            data.KajEndDate      = Convert.ToDateTime(NepEngDate.NepToEng(data.KajEndDateNP));
            if (!ViewBag.AllowView)
            {
                ViewBag.Error = "You are not Authorize to use this Page";
                return(PartialView("_partialviewNotFound"));
            }
            ListOfDatas(empCode);
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View("../Employee/Kajmakhataune/Create", data));
                }
                EmployeeJobHistoryDTO dataToInsert = new EmployeeJobHistoryDTO();
                EmpAllCodesVIewmodels emp          = _employeeService.EmployeesIds(empCode);
                //mandatory field
                dataToInsert.EmpCode         = empCode;
                dataToInsert.OfficeId        = emp.EmpOfficeId;
                dataToInsert.DeptId          = emp.EmpDeptId;
                dataToInsert.SectionId       = emp.EmpSectionId;
                dataToInsert.DesgId          = emp.EmpDesgId;
                dataToInsert.RankId          = emp.EmpRankId;
                dataToInsert.LevelId         = emp.EmpLevelId;
                dataToInsert.BusinessGroupId = emp.EmpBgId;
                dataToInsert.ShiftId         = emp.EmpShiftId;
                dataToInsert.JobTypeId       = emp.EmpJobTypeId;
                // Kazz releated field
                dataToInsert.LetterIssueDate     = data.LetterIssueDate;
                dataToInsert.LetterRefNo         = data.LetterRefNo;
                dataToInsert.ChalaniNumber       = data.LetterChalaniNumber;
                dataToInsert.KajStartDate        = data.KajStartDate;
                dataToInsert.KajEndDate          = data.KajEndDate;
                dataToInsert.ServiceEventGroupId = 3;
                int ServiceEventSubGroupId = 0;
                if (data.KaajType == "U")
                {
                    ServiceEventSubGroupId = 10;
                }
                else
                {
                    ServiceEventSubGroupId = 11;
                }
                dataToInsert.ServiceEventSubGroupId = ServiceEventSubGroupId;
                dataToInsert.SadarGarneEmployeeCode = data.SadarGarneEmployeeCode;
                dataToInsert.Remarks     = data.Remarks;
                dataToInsert.Instruction = data.Instruction;
                dataToInsert.SadarDate   = data.LetterIssueDate;
                dataToInsert.KaajType    = data.KaajType;
                int    res   = _jobHistoryService.InsertJobHistoryForKaj(dataToInsert);
                string sdate = data.KajStartDate.ToString();
                string edate = data.KajEndDate.ToString();
                string type  = "insert";
                int    att   = _attendance.InsertKaajAttendance(empCode, sdate, edate, type);
                Session["sucessMgsKaaz"] = "Kaaj Record of employee " + empCode + " inserted Sucessfully.";

                return(Redirect("/kajmakhataune/" + data.EmpCode));
            }
            catch (Exception ex)
            {
                Session["ErrorMgsKaaz"] = ex.Message;
                return(View("../Employee/Kajmakhataune/Create", data));
            }
        }