Пример #1
0
        public ActionResult GetEmployeeSalaryMonth(string SalaryMonth)
        {
            try
            {
                if (null == SalaryMonth || "".Equals(SalaryMonth))
                {
                    ModelState.AddModelError(string.Empty, "年月を入力ください");
                    TempData["ViewData"] = ViewData;
                    return(RedirectToAction("Index"));
                }
                TempData["SalaryMonth"] = SalaryMonth;
                EmployeeLoginOutput sessionEmployee = (EmployeeLoginOutput)Session["employee"];
                string        employeeId            = sessionEmployee.Id;
                SalaryService salaryService         = new SalaryService();

                EmployeeSearchSalaryOutput employeeSearchSalaryOutput = salaryService.getSalaryDetailEmployee(employeeId, SalaryMonth);
                if (employeeSearchSalaryOutput == null)
                {
                    ModelState.AddModelError(string.Empty, "当月、給料明細書まだアップロードされません");
                    TempData["ViewData"] = ViewData;
                    return(RedirectToAction("Index"));
                }
                TempData["SalaryDetailFilePath"] = employeeSearchSalaryOutput.SalaryDetailFilePath;
            }
            catch (Exception e)
            {
                ModelState.AddModelError(string.Empty, e.Message);
                TempData["ViewData"] = ViewData;
                return(RedirectToAction("Index"));
            }

            return(RedirectToAction("Index"));
        }
Пример #2
0
        public EmployeeSearchSalaryOutput getSalaryDetailEmployee(string employeeId, string salaryMonth)
        {
            EmployeeSearchSalaryOutput employeeSearchSalaryOutput = new EmployeeSearchSalaryOutput();
            string salaryId = String.Format("{0}{1}", employeeId, salaryMonth.Substring(0, 7).Replace("/", ""));

            using (sys_employeeEntities db = new sys_employeeEntities())
            {
                var query = (from s in db.salary
                             where s.salaryId.Equals(salaryId)
                             select new
                {
                    s.salaryId,
                    s.employeeId,
                    s.paymentDate,
                    s.salaryDetailFilePath,
                    s.totalPaidAmount,
                    s.deductionAmount,
                    s.paidAmount
                }).FirstOrDefault();
                if (query == null)
                {
                    return(null);
                }
                employeeSearchSalaryOutput.SalaryId             = query.salaryId;
                employeeSearchSalaryOutput.EmployeeId           = query.employeeId;
                employeeSearchSalaryOutput.PaymentDate          = query.paymentDate;
                employeeSearchSalaryOutput.SalaryDetailFilePath = query.salaryDetailFilePath;
                employeeSearchSalaryOutput.TotalPaidAmount      = query.totalPaidAmount == null ? "" : query.totalPaidAmount.ToString();
                employeeSearchSalaryOutput.DeductionAmount      = query.deductionAmount == null ? "" : query.deductionAmount.ToString();
                employeeSearchSalaryOutput.PaidAmount           = query.paidAmount == null ? "" : query.paidAmount.ToString();

                return(employeeSearchSalaryOutput);
            }
        }