public IActionResult addEmp(string ps_id, string type, string start, string position, string company, string txtsection, string txtdepartment) { CultureInfo en = new CultureInfo("EN"); CultureInfo th = new CultureInfo("TH"); DateTime dt = new DateTime(3000, 01, 01); empModel em = new empModel(); em.ep_ref_personal_id = ps_id; em.ep_ref_type_id = type; em.ep_start = Convert.ToDateTime(start).ToString("yyyy-MM-dd", th); em.insertEmp(); /// emp_positionModel pos = new emp_positionModel(); pos.pos_emp_id = em.ep_id; pos.pos_position_id = position; pos.pos_type = type; pos.pos_comp_id = company; pos.pos_sect_id = txtsection; pos.pos_dept_id = txtdepartment; pos.pos_start_date = Convert.ToDateTime(start).ToString("yyyy-MM-dd", en); pos.pos_resign_date = Convert.ToDateTime(dt).ToString("yyyy-MM-dd", en); pos.insert_position(); // string txt = pos.pos_emp_id + "^" + pos.pos_position_id + "^" + pos.pos_type + "^" + pos.pos_comp_id + "^" + pos.pos_sect_id + "^" + pos.pos_dept_id +"^" + pos.pos_start_date + "^" + pos.pos_resign_date; view_employeeModel v_emp = new view_employeeModel(); v_emp.selectData(em.ep_id); DateTime date = new DateTime(3000, 01, 01); emp_actionModel emp_action = new emp_actionModel(); emp_action.emp_code = v_emp.ep_code; emp_action.emp_prefix_th = v_emp.prefix_name_th; emp_action.emp_name_th = v_emp.ps_name_th; emp_action.emp_lastname_th = v_emp.ps_lastname_th; emp_action.emp_national_id = v_emp.ps_national_id; emp_action.emp_full_name = v_emp.ps_name_full; emp_action.emp_type_name = v_emp.type_name; emp_action.emp_start_date = Convert.ToDateTime(v_emp.ep_start).ToString("yyyy-MM-dd", en); emp_action.emp_end_date = date.ToString(); emp_action.emp_salary = ""; emp_action.emp_stipend = ""; emp_action.emp_action_start = DateTime.Now.ToString("yyyy-MM-dd", en); emp_action.emp_action_end = date.ToString(); // emp_action.insert_emp_action(); return(RedirectToAction("emp", new { code = em.ep_id, startaction = emp_action.emp_action_start, empcode = emp_action.emp_code, prefix = emp_action.emp_prefix_th, name = emp_action.emp_name_th, last = emp_action.emp_lastname_th, national = emp_action.emp_national_id, full = emp_action.emp_full_name, type = emp_action.emp_type_name, start = emp_action.emp_start_date, end = emp_action.emp_end_date, action = emp_action.emp_action_start, endaction = emp_action.emp_action_end })); }
public IActionResult InsertPay(string emp_id, IEnumerable <string> test, IEnumerable <string> pay, IEnumerable <string> income_id, string money_start, string money_end) { emp_payModel income = new emp_payModel(); info_incomeModel check = new info_incomeModel(); emp_actionModel act = new emp_actionModel(); empModel emp = new empModel(); string str = ""; var idAndpay = income_id.Zip(pay, (n, w) => new { id_income = n, pay_money = w }); foreach (var nw in idAndpay) { income.pay_ref_income_id = nw.id_income; income.pay_amount = nw.pay_money; income.pay_ref_emp_id = emp_id; income.pay_start_date = money_start; income.pay_end_date = money_end; income.insert_pay(); if (check.check_income(nw.id_income) == "เงินเดือน") { act.emp_salary = nw.pay_money; act.emp_code = emp.empCode(emp_id); act.update_salary(); } else if (check.check_income(nw.id_income) == "ค่าครองชีพ") { act.emp_stipend = nw.pay_money; act.emp_code = emp.empCode(emp_id); act.update_stipend(); } else { } // str += income.pay_ref_income_id +income.pay_amount; } return(RedirectToAction("emp", "Employee", new { code = emp_id })); }