public ActionResult Index(DailyAttendanceFilterViewModel att) { att.searchdate = Convert.ToDateTime(NepEngDate.NepToEng(att.searchdateNP)); try { ViewBag.date = att.searchdateNP; ViewBag.empdoce = att.EmpCode; ViewBag.Desgid = att.DsgId; ViewBag.officeid = att.officeid; ViewBag.ddlDesignationList = _designationServices.GetDesignationList(); int empcode = Convert.ToInt32(Session["EmpCode"]); //IEnumerable<OfficeDTOs> officelist = _officeServices.GetClildOfficeListByEmpCode(empcode); int AdminEmpCode = ViewBag.EmpCode; ViewBag.ddlOfficeTypeList = _officeServices.GetClildOfficeListByEmpCode(empcode); IEnumerable <DailyAttendanceFilterViewModel> list = _attendanceDailyServices.GetAttendanceDailyStatus(AdminEmpCode, att.searchdate, att.EmpCode, att.DsgId, att.officeid); return(View(list)); } catch (Exception Ex) { ViewBag.Error = Ex.Message; return(View()); } }
public ActionResult Index(DailyAttendanceFilterViewModel atd, int id) { atd.startdate = Convert.ToDateTime(NepEngDate.NepToEng(atd.startdateNP)); atd.Enddate = Convert.ToDateTime(NepEngDate.NepToEng(atd.EnddateNP)); ViewBag.sdate = atd.startdateNP; ViewBag.edate = atd.EnddateNP; try { IEnumerable <DailyAttendanceFilterViewModel> item = _attendanceDailyServices.GetAttendanceByRangeAndID(id, atd.startdate, atd.Enddate); var list = _employeeServices.GetEmployeeDetails(id); ViewBag.Department = list.Department; ViewBag.Name = list.Name; ViewBag.office = list.OfficeName; ViewBag.Desg = list.Designation; ViewBag.EmployeeType = list.Group; ViewBag.Shift = list.Shift; ViewBag.level = list.Level; ViewBag.image = list.PhotoName; ViewBag.Empcode = list.Code; ViewBag.SideBar = _moduleService.AdminEmployeeDetailsMenu(ViewBag.Empcode); return(View("../Employee/AttendanceDetails/Index", item)); } catch (Exception Ex) { ViewBag.Error = "No Data found or No employee found with this employeeCode"; return(View("../Employee/AttendanceDetails/Index")); } }
public ActionResult Add(LeaveApplicationDTO Record) { // int curentemp = Convert.ToInt32(Session["Empcode"]); //int roleid = Convert.ToInt32(Session["RoleId"]); int empCode = Convert.ToInt32(Session["EmpCode"]); Record.LeaveStartDate = Convert.ToDateTime(NepEngDate.NepToEng(Record.LeaveStartDateNP)); Record.LeaveEndDate = Convert.ToDateTime(NepEngDate.NepToEng(Record.LeaveEndDateNP)); Record.RecommededEmpCode = Record.RecommededEmpCode; Record.EmployeeCodeSelectlist = _LeaveEarnedService.GetBrancheEmployeeSelectList(empCode); Record.YearSelectList = _SpecialleavetypeService.GetYearSelectList(); Record.LeaveTypeSelectList = _SpecialleavetypeService.GetSpecialLeaveTypeSelectList(); if (Record.LeaveEmpCode == 0 || Record.RecommededEmpCode == 0 || Record.LeaveApproverEmpCode == 0) { ViewBag.Error = "* Fields are required"; return(View("../Leave/LeaveTypeSpecial/Add", Record)); } try { if (ModelState.IsValid) { _SpecialleavetypeService.AddSpecialLeaveType(Record); Session["Success"] = "Successfully Added Special Leave "; return(RedirectToAction("Index", "LeaveTypeSpecial")); } } catch (Exception Exception) { ViewBag.Error = Exception.Message; Session["Error"] = ViewBag.Error = Exception.Message; return(View("../Leave/LeaveTypeSpecial/Add")); } return(View("../Leave/LeaveTypeSpecial/Add")); }
public ActionResult ApproverList(AttendanceRequestsListViewModel att) { try { att.startdate = Convert.ToDateTime(NepEngDate.NepToEng(att.startdateNP)); att.enddate = Convert.ToDateTime(NepEngDate.NepToEng(att.enddateNP)); int id = ViewBag.Empcode; int role = ViewBag.EmpRoleId; ViewBag.emplist = _employeeServices.GetEmployeeList(id); ViewBag.OfficeList = _officeServices.GetOfficeListByEmpRole(role); ViewBag.startdate = att.startdateNP; ViewBag.officeid = att.OfficeId; ViewBag.code = att.EmpCodes; ViewBag.enddate = att.enddateNP; ViewBag.approvestatus = att.ApproverStatus; ViewBag.Id = id; IEnumerable <AttendanceRequestsListViewModel> lst = _attendanceDailyServices.GetrequestAttendanceListByParms(att.OfficeId, att.EmpCodes, att.startdate, att.enddate, null, id, 2, att.ApproverStatus).ToList(); return(View(lst)); } catch (Exception Ex) { ViewBag.Error = Ex.Message; return(View()); } }
public ActionResult Add(EmployeeFamilyDTO Record) { Record.FDob = !string.IsNullOrEmpty(Record.FDobNP) ? Convert.ToDateTime(NepEngDate.NepToEng(Record.FDobNP)) : Record.FDob; int curentemp = Convert.ToInt32(Session["Empcode"]); Record.EmpCode = Record.EmpId; Record.EmployeeCodeSelectlist = _LeaveEarnedService.GetBrancheEmployeeSelectList(curentemp); try { if (ModelState.IsValid) { _EmployeeFamilyService.AddEmplyeeFamily(Record); Session["Success"] = "Successfully Added Employee Family"; return(RedirectToAction("Index", "Family", new { id = Record.EmpId })); } else { ViewBag.Error = "Form Error"; } } catch (Exception Exception) { ViewBag.Error = Exception.Message; } return(View("../Employee/Family/Add", Record)); }
public ActionResult Index(UpdateAttendanceSearchModel adt, int id) { adt.SearchStartdate = NepEngDate.NepToEng(adt.SearchStartdateNP); adt.SeacrchEnddate = NepEngDate.NepToEng(adt.SeacrchEnddateNP); ViewBag.sdate = adt.SearchStartdateNP; ViewBag.edate = adt.SeacrchEnddateNP; try { var list = _employeeServices.GetEmployeeDetails(id); ViewBag.SideBar = _moduleService.AdminEmployeeDetailsMenu(id); UpdateAttendanceSearchModel uds = new UpdateAttendanceSearchModel(); DateTime sadte, enddate; sadte = Convert.ToDateTime(adt.SearchStartdate); enddate = Convert.ToDateTime(adt.SeacrchEnddate); uds.AttendanceList = _attendanceDailyServices.GetAttendanceByRangeAndID(id, sadte, enddate); uds.Name = list.Name; uds.Empcode = list.Code; uds.Branch = list.OfficeName; uds.Department = list.Department; uds.Designation = list.Designation; uds.Shift = list.Shift; uds.Group = list.Group; uds.Level = list.Level; uds.SearchStartdate = adt.SearchStartdate; uds.SeacrchEnddate = adt.SeacrchEnddate; return(View(uds)); } catch (Exception Ex) { return(View(Ex.Message)); } }
public ActionResult Update(int id, PayrollInsurancePremiumDTO Record) { int EmpCode = Convert.ToInt32(Session["Empcode"]); Record.IsuranceClaimId = id; Record.StartDate = Convert.ToDateTime(NepEngDate.NepToEng(Record.StartDateNP)); Record.EndDate = Convert.ToDateTime(NepEngDate.NepToEng(Record.EndDateNP)); Record.InsuranceCompanySelectlist = _PayrollInsurancePremiumService.GetInsuranceCompanySelectList(); Record.AmountTypeSelectList = StaticSelectList.AmountTypeSelectList(); ViewBag.ddlEmployeeList = _dynamicSelectList.GetEmployeeByEmpCode(EmpCode).ToList(); ViewBag.EmpCode = Record.EmpCode; try { if (ModelState.IsValid) { _PayrollInsurancePremiumService.UpdatePayrollInsurancePremium(Record); Session["Success"] = "Successfully Updated Insurance Information"; return(RedirectToAction("Index", "PayrollInsurancePremium", new { id = Record.EmpCode })); } else { ViewBag.Error = "Form Error"; } } catch (Exception Exception) { ViewBag.Error = Exception.Message; } return(View("../PayrollInsurancePremium/Update", Record)); }
public ActionResult Index(DailyAttendanceFilterViewModel att) { ViewBag.ddlDesignationList = _designationServices.GetDesignationList().ToList(); ViewBag.ddlBusinessGroupList = _groupServices.GetGroupList().ToList(); ViewBag.ddlDepartmentList = _departmentServices.GetDepartmentlist().ToList(); ViewBag.ddlOfficeTypeList = _officeServices.GetOfficeData().ToList(); try { //convert nepalidate to eng string englishDate = NepEngDate.NepToEng(att.startdateNP.ToString()); ViewBag.nepaliDate = att.startdateNP; att.startdate = Convert.ToDateTime(englishDate); ViewBag.date = att.startdate; ViewBag.edate = att.Enddate; ViewBag.attempcode = att.EmpCode; ViewBag.Desgid = att.DsgId; ViewBag.deprtId = att.dprtid; ViewBag.officeid = att.officeid; ViewBag.emptype = att.emptypeid; ViewBag.attendancelist = _attendanceDailyServices.GetAttendanceDaily(att.officeid, att.DsgId, att.emptypeid, att.dprtid, att.EmpCode, att.startdate).ToList(); return(View()); } catch (Exception Ex) { ViewBag.Error = Ex.Message; return(View()); } }
public ActionResult Create(PayrollInsurancePremiumDTO data) { data.StartDate = Convert.ToDateTime(NepEngDate.NepToEng(data.StartDateNP)); data.EndDate = Convert.ToDateTime(NepEngDate.NepToEng(data.EndDateNP)); int EmpCode = Convert.ToInt32(Session["Empcode"]); data.InsuranceCompanySelectlist = _PayrollInsurancePremiumService.GetInsuranceCompanySelectList(); data.AmountTypeSelectList = StaticSelectList.AmountTypeSelectList(); ViewBag.ddlEmployeeList = _dynamicSelectList.GetEmployeeByEmpCode(EmpCode).ToList(); ModelState.Clear(); try { if (ModelState.IsValid) { _PayrollInsurancePremiumService.InsertPayrollInsurancePremium(data); Session["Success"] = "Successfully Added Employee Insurance Information"; return(RedirectToAction("Index/")); } else { ViewBag.Error = "Form Error"; } } catch (Exception Exception) { ViewBag.Error = Exception.Message; } return(View("../PayrollInsurancePremium/Create", data)); }
public ActionResult Add(PayrollLeaveDeductionDTO Record) { Record.EmployeeCodeSelectlist = _LeaveEarnedService.GetBrancheEmployeeSelectList(Convert.ToInt32(ViewBag.Empcode)); Record.YearSelectList = _SpecialleavetypeService.GetYearSelectList(); Record.LeaveTypeSelectList = _payrollLeaveDeductionService.GetPayrollLeaveDeductionLeaveTypeSelectList(); Record.LeaveDate = Convert.ToDateTime(NepEngDate.NepToEng(Record.LeaveDateNepali)); try { if (ModelState.IsValid) { _payrollLeaveDeductionService.AddPayrollLeaveDeduction(Record); Session["Success"] = "Successfully Added Payroll Leave Deduction"; return(RedirectToAction("Index", "PayrollLeaveDeduction")); } else { ViewBag.Error = "Form Error"; } } catch (Exception Exception) { ViewBag.Error = Exception.Message; } return(View("../Leave/PayrollLeaveDeduction/Add", Record)); }
public ActionResult Update(LeaveEarnedDTO Record) { int curentemp = Convert.ToInt32(Session["Empcode"]); Record.WorkedStartDate = Convert.ToDateTime(NepEngDate.NepToEng(Record.WorkedStartDateNP)); Record.WorkedEndDate = Convert.ToDateTime(NepEngDate.NepToEng(Record.WorkedEndDateNP)); Record.YearSelectList = _SpecialleavetypeService.GetYearSelectList(); Record.LeaveTypeSelectList = _LeaveEarnedService.GetEarnedLeaveTypeList(); int roleid = Convert.ToInt32(Session["RoleId"]); Record.ApproveEmployeeCodeSelectlist = _DynamicSelectList.GetLeaveApproverSelectList(Record.EmpCode, "Earning"); Record.EmpId = Record.EmpCode; Record.GetRecommederSelectList = _DynamicSelectList.GetLeaveRecommenderSelectList(Record.EmpCode, "Earning"); try { if (ModelState.IsValid) { _LeaveEarnedService.UpdateLeaveEarned(Record); Session["Success"] = "Successfully Updated Leave Earn"; return(RedirectToAction("Index", "LeaveEarned")); } else { ViewBag.Error = "Form Error"; } } catch (Exception Exception) { ViewBag.Error = Exception.Message; } return(View("../Leave/LeaveEarned/Update", Record)); }
public ActionResult EditEducation(EmpEducationDTO data) { data.PassedDate = Convert.ToDateTime(NepEngDate.NepToEng(data.PassedDateNP)); data.EmpCode = Convert.ToInt32(Session["EmpCode"]); data.EducationStatus = 0; EmpEducationDTO jtd = new EmpEducationDTO(); List <SelectListItem> educationLevel = new List <SelectListItem>(); foreach (var row in _educationLevel.GetEducationLevel()) { educationLevel.Add(new SelectListItem { Text = row.LevelName, Value = row.LevelId.ToString() }); } IEnumerable <SelectListItem> CountryList = _countryService.GetCountryList(); ViewBag.Countries = CountryList; ViewBag.EducationLevel = educationLevel; //if (!ModelState.IsValid) //{ // return View(jtd); //} if (data.EducationStatus == 0) { if (data.File != null) { string extension = Path.GetExtension(data.File.FileName).ToLower(); if (extension == ".jpeg" || extension == ".jpg" || extension == ".png") { data.ScanDocument = (data.EduId + data.File.FileName).ToLower(); //housePermitModel = _housePermitService.insertHousePermits(housePermit); if (data != null) { string path = Server.MapPath("~\\img\\"); data.File.SaveAs(path + data.ScanDocument); } } else { ModelState.AddModelError("InvalidImage", "The file you are trying to upload is not image."); return(View()); } } int res = _empEducationService.UpdateEducation(data); ViewBag.Success = "Education of " + data.EmpCode + " has been updated"; ModelState.Clear(); return(View(jtd)); } else { ViewBag.Success = "Education already approved "; return(View(jtd)); } }
public ActionResult IndividualAttendanceList(AttendanceRequestsListViewModel att) { att.startdate = Convert.ToDateTime(NepEngDate.NepToEng(att.startdateNP)); att.enddate = Convert.ToDateTime(NepEngDate.NepToEng(att.enddateNP)); int id = ViewBag.Empcode; ViewBag.startdate = att.startdateNP; ViewBag.enddate = att.enddateNP; ViewBag.approvestatus = att.ApproverStatus; ViewBag.recommendstatus = att.RecommendSatus; IEnumerable <AttendanceRequestsListViewModel> lst = _attendanceDailyServices.GetrequestAttendanceListByParms(att.OfficeId, id, att.startdate, att.enddate, null, null, att.RecommendSatus, att.ApproverStatus).ToList(); return(View(lst)); }
public ActionResult Add(LeaveEarnedDTO Record) { Record.WorkedStartDate = Convert.ToDateTime(NepEngDate.NepToEng(Record.WorkedStartDateNP)); Record.WorkedEndDate = Convert.ToDateTime(NepEngDate.NepToEng(Record.WorkedEndDateNP)); int curentemp = Convert.ToInt32(Session["Empcode"]); Record.YearSelectList = _SpecialleavetypeService.GetYearSelectList(); Record.LeaveTypeSelectList = _LeaveEarnedService.GetEarnedLeaveTypeList(); int roleid = Convert.ToInt32(Session["RoleId"]); Record.EmployeeCodeSelectlist = _LeaveEarnedService.GetBrancheEmployeeSelectList(curentemp); Decimal totalDays = _LeaveEarnedService.YearlyEarnedLeave(Record.EmpCode, Record.LeaveYearId, Convert.ToInt32(Record.LeaveTypeId)); int takingLeave = Convert.ToDateTime(Record.WorkedEndDate).Date.Subtract((Convert.ToDateTime(Record.WorkedStartDate)).Date).Duration().Days + 1; if (Record.WorkedEndDate.Date.CompareTo(Record.WorkedStartDate) < 0) { ViewBag.Error = "Work Start Date should be smaller than Work End Date"; } else if ((takingLeave + totalDays) > 10) { ViewBag.Error = "One Employee can earn max 10 days in one year. This Employee has already earned " + totalDays + " Days."; } else { try { if (ModelState.IsValid) { _LeaveEarnedService.AddLeaveEarned(Record); Session["Success"] = "Successfully Added Leave Earn"; return(RedirectToAction("Index", "LeaveEarned")); } else { ViewBag.Error = "Form Error"; } } catch (Exception Exception) { ViewBag.Error = Exception.Message; } } return(View("../Leave/LeaveEarned/Add", Record)); }
public ActionResult EditFamily(EmployeeFamilyViewModel data) { data.FDob = Convert.ToDateTime(NepEngDate.NepToEng(data.FDobNP)); data.EmpCode = Convert.ToInt32(Session["EmpCode"]); EmployeeFamilyViewModel jtd = new EmployeeFamilyViewModel(); //if (!ModelState.IsValid) //{ // return View(jtd); //} int res = _empFamilyService.UpdateEmpFamily(data); ViewBag.Success = "Education of " + data.EmpCode + " has been updated"; ModelState.Clear(); return(View(jtd)); }
public ActionResult Create(LeaveApplicationDTOs Record, int levid) { string recommendType = "General"; int empcode = Convert.ToInt32(Session["EmpCode"]); Record.ApproverList = _DynamicSelectList.GetLeaveApproverSelectList(empcode, recommendType).ToList(); Record.RecommenderList = _DynamicSelectList.GetLeaveRecommenderSelectList(empcode, recommendType).ToList(); try { Record.LeaveStartDate = Convert.ToDateTime(NepEngDate.NepToEng(Record.LeaveStartDateNP)); Record.LeaveEndDate = Convert.ToDateTime(NepEngDate.NepToEng(Record.LeaveEndDateNP)); if (Record.IsHalfDay) { Record.LeaveEndDate = Record.LeaveStartDate; } if (ModelState.IsValid) { Record = _ValidateLeave.ValidateLeave(Record); if (Record.ErrorList != null && Record.ErrorList.Count > 0) { return(View(Record)); } else { _LeaveAddAdmin.LeaveApplicationCreate(Record); Session["success"] = "Leave Created Sucessfully "; return(RedirectToAction("Index")); } } else { Record.ApproverList = _LeaveAddAdmin.CreateLeaveApplicationInformation(empcode, Record.LeaveTypeId, recommendType).ApproverList; return(View(Record)); } } catch (Exception Ex) { Session["error"] = Ex.Message; Record.ApproverList = _LeaveAddAdmin.CreateLeaveApplicationInformation(empcode, Record.LeaveTypeId, recommendType).ApproverList; return(View(Record)); } }
public ActionResult AddEducation(EmpEducationDTO data) { data.PassedDate = Convert.ToDateTime(NepEngDate.NepToEng(data.PassedDateNP)); data.EmpCode = Convert.ToInt32(Session["EmpCode"]); List <SelectListItem> educationLevel = new List <SelectListItem>(); foreach (var row in _educationLevel.GetEducationLevel()) { educationLevel.Add(new SelectListItem { Text = row.LevelName, Value = row.LevelId.ToString() }); } IEnumerable <SelectListItem> CountryList = _countryService.GetCountryList(); ViewBag.Countries = CountryList; ViewBag.EducationLevel = educationLevel; //ViewBag.EmployeeDetail = _empDetails.GetEmployeeDetails(id); //ViewBag.SideBar = _moduleService.AdminEmployeeDetailsMenu(id); try { if (!ModelState.IsValid) { ModelState.AddModelError("Error", "Please Fill up all required field"); return(View()); } EmpEducationDTO res = new EmpEducationDTO(); //data.EmpCode = id; res = _empEducationService.InsertEmpEducation(data); ViewBag.Success = "Education added"; return(View()); } catch (Exception ex) { //ViewBag.EmployeeDetail = _empDetails.GetEmployeeDetails(id); //ViewBag.SideBar = _moduleService.AdminEmployeeDetailsMenu(id); ViewBag.Error = ex.Message; ModelState.AddModelError("Error", ex.Message); return(View(data)); } }
public ActionResult AddFamily(EmployeeFamilyViewModel data) { data.FDob = Convert.ToDateTime(NepEngDate.NepToEng(data.FDobNP)); data.EmpCode = Convert.ToInt32(Session["EmpCode"]); EmployeeFamilyViewModel employeeEducation = new EmployeeFamilyViewModel(); //employeeEducation.CountryList = _empEducationService.GetCountryList(); //employeeEducation.EducationLevelList = _empEducationService.GetEducationLevelList(); //if (!ModelState.IsValid) //{ // return View(employeeEducation); //} EmployeeFamilyViewModel res = new EmployeeFamilyViewModel(); res = _empFamilyService.InsertEmpFamily(data); ViewBag.Success = "family of " + res.EmpCode + " has been created"; ModelState.Clear(); return(View(employeeEducation)); }
public ActionResult Create(PayrollOvertimeDTO payrollOvertime) { int EmpCode = Convert.ToInt32(Session["Empcode"]); payrollOvertime.OvertimeDate = Convert.ToDateTime(NepEngDate.NepToEng(payrollOvertime.OvertimeDateNP)); payrollOvertime.ApproveStatusDate = Convert.ToDateTime(NepEngDate.NepToEng(payrollOvertime.ApproveStatusDateNP)); payrollOvertime.OvertimeAppliedDate = Convert.ToDateTime(NepEngDate.NepToEng(payrollOvertime.OvertimeAppliedDateNP)); PayrollOvertimeDTO jtd = new PayrollOvertimeDTO(); ViewBag.ddlEmployeeList = _dynamicSelectList.GetEmployeeByEmpCode(EmpCode).ToList(); if (!ModelState.IsValid) { return(View(jtd)); } PayrollOvertimeDTO res = new PayrollOvertimeDTO(); res = _payrollOvertimeService.InsertPayrollOvertime(payrollOvertime); ViewBag.Success = "Overtime of " + res.OvertimeAppliedDate + " has been created"; ModelState.Clear(); return(View(jtd)); }
public ActionResult Index(AttendanceLogViewModel attlog, int?logEmpCode) { attlog.logDate = Convert.ToDateTime(NepEngDate.NepToEng(attlog.logDateNP)); try { int EmpCode = Convert.ToInt32(Session["Empcode"]); ViewBag.ddlEmployeeList = _dynamicSelectList.GetEmployeeByEmpCode(EmpCode).ToList(); attlog.logEmpCode = Convert.ToInt32(logEmpCode); ViewBag.logEmpCode = attlog.logEmpCode; ViewBag.logDateNP = attlog.logDateNP; ViewBag.attendanceloglist = _attendanceLogServices.GetAttendanceLog(attlog.logEmpCode, attlog.logDate).ToList(); return(View()); } catch (Exception Ex) { ViewBag.Error = Ex.Message; return(View()); } }
public ActionResult RecommenderList(AttendanceRequestsListViewModel att) { att.startdate = Convert.ToDateTime(NepEngDate.NepToEng(att.startdateNP)); att.enddate = Convert.ToDateTime(NepEngDate.NepToEng(att.enddateNP)); ViewBag.startdate = att.startdateNP; ViewBag.enddate = att.enddateNP; int id = ViewBag.Empcode; ViewBag.emplist = _employeeServices.GetEmployeeList(id); ViewBag.OfficeList = _officeServices.GetOfficeAllData(); ViewBag.officeid = att.OfficeId; ViewBag.code = att.EmpCodes; ViewBag.approvestatus = att.ApproverStatus; ViewBag.recommendstatus = att.RecommendSatus; ViewBag.id = id; IEnumerable <AttendanceRequestsListViewModel> lst = _attendanceDailyServices.GetrequestAttendanceListByParms(att.OfficeId, att.EmpCodes, att.startdate, att.enddate, id, null, att.RecommendSatus, att.ApproverStatus).ToList(); return(View(lst)); }
public ActionResult Update(EmployeeFamilyDTO Record) { Record.FDob = !string.IsNullOrEmpty(Record.FDobNP) ? Convert.ToDateTime(NepEngDate.NepToEng(Record.FDobNP)) : Record.FDob; try { if (ModelState.IsValid) { _EmployeeFamilyService.UpdateEmployeeFamily(Record); Session["Success"] = "Successfully Updated Employee Family"; return(RedirectToAction("Index", "Family", new { id = Record.EmpId })); } else { ViewBag.Error = "Form Error"; } } catch (Exception Exception) { ViewBag.Error = Exception.Message; } return(View("../Employee/Family/Update", Record)); }
public ActionResult EditHolidy(HolidayDTOs htd, int[] offices) { htd.HolidayDate = !string.IsNullOrEmpty(htd.HolidayDateNP) ? Convert.ToDateTime(NepEngDate.NepToEng(htd.HolidayDateNP)) : htd.HolidayDate; try { HolidayDTOs holidaydata = _holidayServices.HolidayListbyId(htd.HolidayId); IEnumerable <OfficeDTOs> officelist = _officeServices.GetClildOfficeListByEmpCode(Convert.ToInt32(ViewBag.EmpCode)); IEnumerable <EthnicityDTO> ethnicity = _ethnicityServices.GetEthnicityList(); IEnumerable <ReligionDTO> religion = _religionServices.GetReligionList(); IEnumerable <HolidayOfficesViewModel> selectedoffice = _holidayServices.HolidayOfficeById(htd.HolidayId); List <SelectListItem> office = new List <SelectListItem>(); List <SelectListItem> eth = new List <SelectListItem>(); List <SelectListItem> rel = new List <SelectListItem>(); List <SelectListItem> gender = new List <SelectListItem>(); List <SelectListItem> seldoffice = new List <SelectListItem>(); gender.Add(new SelectListItem { Text = "All", Value = "All" }); gender.Add(new SelectListItem { Text = "Male", Value = "Male" }); gender.Add(new SelectListItem { Text = "Female", Value = "Female" }); rel.Add(new SelectListItem { Text = "All", Value = "0" }); eth.Add(new SelectListItem { Text = "All", Value = "0" }); foreach (EthnicityDTO row in ethnicity) { eth.Add(new SelectListItem { Text = row.EthnicityName, Value = row.EthnicityId.ToString() }); } foreach (HolidayOfficesViewModel row in selectedoffice) { seldoffice.Add(new SelectListItem { Text = row.OfficeName.ToString(), Value = row.OfficeId.ToString() }); } foreach (OfficeDTOs row in officelist) { office.Add(new SelectListItem { Text = row.OfficeName.ToString(), Value = row.OfficeId.ToString() }); } foreach (ReligionDTO row in religion) { rel.Add(new SelectListItem { Text = row.ReligionName, Value = row.ReligionId.ToString(), }); } holidaydata.BranchSelectList = office; holidaydata.EthnicitySelectList = eth; holidaydata.GenderList = gender; holidaydata.ReligionSelectList = rel; holidaydata.SelectedOffices = seldoffice; if (ModelState.IsValid) { if (htd.HolidayOfficeId == 0) { _holidayServices.DeleteHolidayOffice(htd.HolidayId); _holidayServices.UpdateHoliday(htd); } else if (htd.HolidayOfficeId == 1) { if (offices == null) { ModelState.AddModelError("SelectList", "Please select some offices form the list !!"); return(View(holidaydata)); } else { _holidayServices.DeleteHolidayOffice(htd.HolidayId); for (int i = 0; i < offices.Length; i++) { int officeId = offices[i]; _holidayServices.InsertholidayOffices(htd.HolidayId, officeId); } _holidayServices.UpdateHoliday(htd); } } Session["UpdateHoliday"] = "Holiday Updated Sucessfully !!"; return(RedirectToAction("Index", "Holiday")); } else { return(View(holidaydata)); } } catch (Exception Ex) { Session["updateerroe"] = "Error While Updating " + Ex.Message; return(RedirectToAction("Index", "Holiday")); } }
public ActionResult CreateHoliday(HolidayDTOs atd, int[] offices) { atd.HolidayDate = !string.IsNullOrEmpty(atd.HolidayDateNP) ? Convert.ToDateTime(NepEngDate.NepToEng(atd.HolidayDateNP)) : atd.HolidayDate; HolidayDTOs offieList = new HolidayDTOs(); IEnumerable <OfficeDTOs> officelist = _officeServices.GetClildOfficeListByEmpCode(Convert.ToInt32(ViewBag.EmpCode)); IEnumerable <EthnicityDTO> ethnicity = _ethnicityServices.GetEthnicityList(); IEnumerable <ReligionDTO> religion = _religionServices.GetReligionList(); List <SelectListItem> sl = new List <SelectListItem>(); List <SelectListItem> eth = new List <SelectListItem>(); List <SelectListItem> rel = new List <SelectListItem>(); List <SelectListItem> gender = new List <SelectListItem>(); rel.Add(new SelectListItem { Text = "All", Value = "0" }); eth.Add(new SelectListItem { Text = "All", Value = "0" }); sl.Add(new SelectListItem { Text = "All", Value = "0" }); gender.Add(new SelectListItem { Text = "All", Value = "All" }); gender.Add(new SelectListItem { Text = "Male", Value = "Male" }); gender.Add(new SelectListItem { Text = "Female", Value = "Female" }); foreach (OfficeDTOs str in officelist) { sl.Add(new SelectListItem { Text = str.OfficeName, Value = str.OfficeId.ToString() }); } foreach (EthnicityDTO row in ethnicity) { eth.Add(new SelectListItem { Text = row.EthnicityName, Value = row.EthnicityId.ToString() }); } foreach (ReligionDTO row in religion) { rel.Add(new SelectListItem { Text = row.ReligionName, Value = row.ReligionId.ToString() }); } offieList.BranchSelectList = sl; offieList.EthnicitySelectList = eth; offieList.ReligionSelectList = rel; offieList.GenderList = gender; if (ModelState.IsValid) { try { atd.HolidayStatus = true; if (atd.HolidayOfficeId == 1) { if (offices == null) { ModelState.AddModelError("SelectList", "Please select some offices form the list !!"); return(View(offieList)); } else { int id = _holidayServices.CreateHolidays(atd); for (int i = 0; i < offices.Length; i++) { int officeId = offices[i]; _holidayServices.InsertholidayOffices(id, officeId); } } } else { int id = _holidayServices.CreateHolidays(atd); } Session["UpdateHoliday"] = "Holiday Created Sucessfully !!"; return(RedirectToAction("Index", "Holiday")); } catch (Exception Ex) { return(View(Ex.Message)); } } else { return(View(offieList)); } }
public ActionResult EmployeeNiyukti(int id, 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.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(id); try { if (!ModelState.IsValid) { return(View("../JobHistory/History/Niyukti", data)); } EmployeeJobHistoryDTO dataToInsert = new EmployeeJobHistoryDTO(); dataToInsert.EmpCode = id; 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.RemoteId = data.RemoteId; dataToInsert.SadarDate = data.SadarDate; dataToInsert.SadarGarneEmployeeCode = data.SadarGarneEmployeeCode; dataToInsert.SectionId = data.SectionId; dataToInsert.ServiceHolidingDate = data.ServiceCountingFromDate; dataToInsert.ServiceEvent = data.ServiceEvent; dataToInsert.Instruction = data.Instruction; dataToInsert.ServiceEventGroupId = 1; dataToInsert.ServiceEventSubGroupId = data.ServiceEventSubGroupId; 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; int res = _jobHistoryService.InsertJobHistoryForNiyukti(dataToInsert); return(Redirect("/Admin/UserDetail/" + id)); } catch (Exception ex) { ViewBag.Error = ex.Message; return(View("../Employee/Transfer/Index", data)); } }
public ActionResult Edit(int Id, EmpTrainingDTO Record) { ListOfDatas(Record.EmpCode); Record.LetterDate = !string.IsNullOrEmpty(Record.LetterDateNP) ? Convert.ToDateTime(NepEngDate.NepToEng(Record.LetterDateNP)) : Record.LetterDate; Record.TrainingStartDate = !string.IsNullOrEmpty(Record.TrainingStartDateNP) ? Convert.ToDateTime(NepEngDate.NepToEng(Record.TrainingStartDateNP)) : Record.TrainingStartDate; Record.TrainingEndDate = !string.IsNullOrEmpty(Record.TrainingEndDateNP) ? Convert.ToDateTime(NepEngDate.NepToEng(Record.TrainingEndDateNP)) : Record.TrainingEndDate; Record.TrainingVisitStartDate = !string.IsNullOrEmpty(Record.TrainingVisitStartDateNP) ? Convert.ToDateTime(NepEngDate.NepToEng(Record.TrainingVisitStartDateNP)) : Record.TrainingVisitStartDate; Record.TrainingVisitEndDate = !string.IsNullOrEmpty(Record.TrainingVisitEndDateNP) ? Convert.ToDateTime(NepEngDate.NepToEng(Record.TrainingVisitEndDateNP)) : Record.TrainingVisitEndDate; Record.OfficeList = OfficeList; Record.DesignationList = DesignationList; Record.RankList = RankList; ViewBag.EmployeeDetail = _employeeService.GetEmployeeDetails(Record.EmpCode); ViewBag.SideBar = _moduleService.AdminEmployeeDetailsMenu(Record.EmpCode); Record.AssignedByList = _employeeService.GetEmployeeSelectList(); Record.SponsorshipList = _employeeService.GetSponsorshipList(); Record.CountryList = _countryService.GetCountryList(); Record.AssignedByList = _employeeService.GetEmployeeSelectList(); Record.NationalInternationalList = _employeeService.GetNationInternationalList(); try { if (ModelState.IsValid) { _employeeTrainingService.UpdateEmployeeTraining(Record); _employeeTrainingService.UpdateAttendaceonTraining(Record.Id, "U"); TempData["Success"] = "Training updated successfully."; return(RedirectToAction("Index", new { Id = Record.EmpCode })); } else { TempData["Danger"] = "Please fill in the required field"; } } catch (Exception Exception) { TempData["Danger"] = Exception.Message; } return(View(Record)); }
public ActionResult RequestAttendance(AttendanceRequestDTO att) { if (att.CheckInDateNP != null) { att.CheckInDate = Convert.ToDateTime(NepEngDate.NepToEng(att.CheckInDateNP)); } if (att.CheckOutDateNP != null) { att.CheckOutDate = Convert.ToDateTime(NepEngDate.NepToEng(att.CheckOutDateNP)); } int id = ViewBag.Empcode; int roleid = ViewBag.EmpRoleId; att.RequestEmpCode = id; IPHostEntry host; string localIP = "?"; host = Dns.GetHostEntry(Dns.GetHostName()); foreach (IPAddress ip in host.AddressList) { if (ip.AddressFamily.ToString() == "InterNetwork") { localIP = ip.ToString(); } } att.IpAddress = localIP; EmployeeDetailsViewModel emp = _employeeServices.GetEmployeeDetails(id); ViewBag.Approver = _employeeServices.GetAttendanceApprover(id); ViewBag.Recommande = _employeeServices.GetAttendanceRecommander(id); if (att.CheckInTime != null) { att.CheckInDate = att.CheckInDate + att.CheckInTime; } if (att.CheckOutTime != null) { att.CheckOutDate = att.CheckOutDate + att.CheckOutTime; } if (att.RequestType == "CheckIn") { att.RequestedDate = att.CheckInDate; att.CheckOutDate = null; } if (att.RequestType == "CheckOut") { att.RequestedDate = att.CheckOutDate; att.CheckInDate = null; } else { att.RequestedDate = att.CheckInDate; } att.RequestCreatedDate = DateTime.Now; att.RecommendStatus = 1; att.ApproveStatus = 1; if (ModelState.IsValid) { try { AttendanceRequestDTO Atdo = new AttendanceRequestDTO(); Atdo = _attendanceDailyServices.InsertAttendanceRequest(att); NotificationRequestAttendance(att); Session["attendance_request"] = "New attendance requested sucessfully !!!"; return(RedirectToAction("IndividualAttendanceList", "User")); } catch (Exception ex) { ViewBag.Error = "Error While Requesting Attendance Online!" + ex.Message; return(View()); } } else { ViewBag.Error = "Please Select required field below "; return(View()); } }
public ActionResult FiscalEdit(FiscalDTO data) { data.FyStartDate = !string.IsNullOrEmpty(data.FyStartDateNp) ? Convert.ToDateTime(NepEngDate.NepToEng(data.FyStartDateNp)) : data.FyStartDate; data.FyEndDate = !string.IsNullOrEmpty(data.FyEndDateNp) ? Convert.ToDateTime(NepEngDate.NepToEng(data.FyEndDateNp)) : data.FyEndDate; int res = _fiscalService.UpdateFiscal(data); return(RedirectToAction("FiscalYear")); }
public ActionResult FiscalCreateClose(FiscalDTO data) { data.FyStartDate = !string.IsNullOrEmpty(data.FyStartDateNp) ? Convert.ToDateTime(NepEngDate.NepToEng(data.FyStartDateNp)) : data.FyStartDate; data.FyEndDate = !string.IsNullOrEmpty(data.FyEndDateNp) ? Convert.ToDateTime(NepEngDate.NepToEng(data.FyEndDateNp)) : data.FyEndDate; try { FiscalDTO res = new FiscalDTO(); FiscalDTO fd = new FiscalDTO(); if (!ModelState.IsValid) { return(View(fd)); } res = _fiscalService.InsertFiscal(data); ViewBag.Success = "Fiscal year " + data.FyName + " has been created"; return(RedirectToAction("FiscalYear")); } catch (Exception ex) { ViewBag.Error = ex.Message; return(View()); } }
public ActionResult KajMaKhateuneEdit(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/Edit", data)); } EmployeeJobHistoryDTO dataToInsert = new EmployeeJobHistoryDTO(); EmpAllCodesVIewmodels emp = _employeeService.EmployeesIds(empCode); //mandatory field dataToInsert.HistoryId = data.Id; 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; //before updating get start and end date from database EmployeeJobHistoryDTO RecordUpdate = _jobHistoryService.GetJobHistoryById(data.Id); string updaeSdate = RecordUpdate.KajStartDate.ToString(); string updaEdate = RecordUpdate.KajEndDate.ToString(); string type = "onlyupdate"; int att = _attendance.InsertKaajAttendance(empCode, updaeSdate, updaEdate, type); int res = _jobHistoryService.UpdateJobHistoryForKaj(dataToInsert); string sdate = data.KajStartDate.ToString(); string edate = data.KajEndDate.ToString(); type = "Insert"; att = _attendance.InsertKaajAttendance(empCode, sdate, edate, type); Session["sucessMgsKaaz"] = "Kaaj Record of employee " + empCode + " Updated Sucessfully."; return(Redirect("/kajmakhataune/" + data.EmpCode)); } catch (Exception ex) { Session["ErrorMgsKaaz"] = ex.Message; return(View("../Employee/Kajmakhataune/Edit", data)); } }