public IActionResult addResign() { empModel emp = new empModel(); ViewData["emp"] = emp.drop_emp_resign(); return(View()); }
public IActionResult insert_resign(string emp, string emp_resign_date, string type, string detail) { empModel em = new empModel(); em.select_emp(emp); em.insertEmpLOG(); // emp_resignModel rs = new emp_resignModel(); rs.re_ref_emp_id = emp; rs.re_emp_code = em.empCode(emp); rs.re_resign_date = emp_resign_date; rs.re_type = type; rs.re_detail = detail; rs.insert_resign(); // em.ep_end = emp_resign_date; em.ep_status = "N"; em.event_status = "U"; em.update_emp(); return(RedirectToAction("resign", "Employee")); }
public void del_resign(string id) { DateTime dt = new DateTime(3000, 01, 01); // select & insert LOG resign emp_resignModel rs = new emp_resignModel(); rs.re_id = id; rs.select_resign(); rs.insert_resignLOG(); /// //select and insert LOG emp empModel em = new empModel(); em.select_emp(rs.re_ref_emp_id); em.insertEmpLOG(); ///update event status to DELETE rs.event_status = "D"; rs.update_resign(); // update event status emp to Y em.ep_end = Convert.ToDateTime(dt).ToString("yyyy-MM-dd"); em.ep_status = "Y"; em.event_status = "U"; em.update_emp(); }
public IActionResult addResignFund() { empModel emp = new empModel(); ViewData["emp"] = emp.drop_emp_Fund(); info_fundModel fn = new info_fundModel(); ViewData["fund"] = fn.dropdownFund(); return(View()); }
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 async Task <IActionResult> Upload(IList <IFormFile> selectFile, string emp_id, string emp_code) { string status = "aa"; view_employeeModel vm = new view_employeeModel(); empModel em = new empModel(); var uploads = Path.Combine(_hostingEnvironment.WebRootPath, "profile"); foreach (var file in selectFile) { if (file.Length > 0) { if (string.IsNullOrEmpty(vm.check_img(emp_id)) == true) { em.img_ref_emp_id = emp_id; em.img_ref_person_id = em.empPerson(emp_id); em.img_name = file.FileName; em.insert_img(); em.check_img(emp_id); em.insert_imgLOG(); } else { em.check_img(emp_id); em.insert_imgLOG(); em.img_ref_emp_id = emp_id; em.img_ref_person_id = em.empPerson(emp_id); em.img_name = file.FileName; em.update_img(); } var filePath = Path.Combine(uploads, file.FileName); using (var fileStream = new FileStream(filePath, FileMode.Create)) { await file.CopyToAsync(fileStream); } } } return(RedirectToAction("emp", "Employee", new { code = emp_id, n = "check" })); }
public IActionResult editEmp(string emp_id, string emp_person_edit, string emp_start_edit, string type_) { empModel emp = new empModel(); emp.select_emp(emp_id); emp.insertEmpLOG(); emp.ep_ref_personal_id = emp_person_edit; emp.ep_start = emp_start_edit; emp.ep_ref_type_id = type_; emp.update_emp(); return(RedirectToAction("emp", "Employee", new { code = emp_id })); }
public IActionResult editResign(string id) { ViewData["re_id"] = id; emp_resignModel er = new emp_resignModel(); er.re_id = id; er.select_resign(); ViewData["re_id"] = er.re_id; ViewData["emp_id"] = er.re_ref_emp_id; ViewData["re_resign_date"] = er.re_resign_date; ViewData["re_type"] = er.re_type; ViewData["re_detail"] = er.re_detail; empModel emp = new empModel(); ViewData["emp"] = emp.drop_emp_resign(er.re_ref_emp_id); return(View()); }
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 })); }
public IActionResult Index() { if (string.IsNullOrEmpty(HttpContext.Session.GetString("session_emp_id")) == true) { return(RedirectToAction("Index", "Home")); } else { empModel mp = new empModel(); mp.ep_id = HttpContext.Session.GetString("session_emp_id"); mp.select_emp(); ViewData["emp_username"] = mp.ps_name_full; ViewData["emp_name"] = mp.prefix_name_th + mp.ps_name_full; ViewData["emp_code"] = mp.ep_code; ViewData["emp_post"] = mp.post_name; ViewData["emp_dept"] = mp.dept_name; ViewData["emp_sect"] = mp.Section_name; ViewData["emp_comp"] = mp.T_Company; ViewData["emp_img"] = "http://10.10.20.42/profile/" + mp.img_name; IncomeModel nc = new IncomeModel(); nc.ep_id = mp.ep_id; ViewData["income"] = nc.income_list(); ViewData["summary"] = nc.summary.ToString("0,0.00"); periodModel pd = new periodModel(); pd.ep_id = mp.ep_id; ViewData["period"] = pd.period_list(); pd.get_max_period_date(); gdataSlip(pd.period_date); return(View()); } }
public IActionResult emp(string code, string txt) { code_test = code; personalModel ps = new personalModel(); ViewData["person_edit"] = ps.personal_for_edit(); info_positionModel posi = new info_positionModel(); companyModel comp = new companyModel(); sectionModel sect = new sectionModel(); departmentModel dep = new departmentModel(); emp_typeModel type = new emp_typeModel(); ViewData["position_dropdown"] = posi.dropDownPosition(); ViewData["company"] = comp.drop_company(); ViewData["section"] = sect.drop_section(); ViewData["department"] = dep.drop_dep(); ViewData["type"] = type.dropdown_type(); info_prefixModels prefix = new info_prefixModels(); info_statusModel status = new info_statusModel(); personal_studyModel study = new personal_studyModel(); ViewData["prefix_th"] = prefix.select_prefixTH(); ViewData["prefix_en"] = prefix.select_prefixEN(); ViewData["type_emp"] = type.dropdown_type(); ViewData["status"] = status.dropdown_status(); //view employee// view_employeeModel emp = new view_employeeModel(); emp.selectData(code); ViewData["emp_id"] = code; ViewData["emp_code"] = emp.ep_code; ViewData["emp_name_th"] = emp.prefix_name_en + " " + emp.ps_name_th + " " + emp.ps_lastname_th; ViewData["emp_name_en"] = emp.prefix_name_en + " " + emp.ps_name_en + " " + emp.ps_lastname_en; ViewData["emp_type"] = emp.type_name; ViewData["emp_status"] = emp.ep_status; ViewData["emp_start_date"] = emp.ep_start; ViewData["emp_end_date"] = emp.ep_end; ViewData["emp_email"] = emp.contact_email; ViewData["emp_table"] = emp.contact_table; ViewData["emp_phone"] = emp.contact_phone; ViewData["emp_mobile1"] = emp.contact_mobile1; ViewData["emp_mobile2"] = emp.contact_mobile2; ViewData["position_name"] = emp.post_name; ViewData["position_type"] = emp.type_name; ViewData["position_dept"] = emp.dept_name; ViewData["position_sect"] = emp.Section_name; ViewData["position_comp"] = emp.T_Company; ViewData["gender"] = emp.ps_gender; ViewData["age"] = Convert.ToInt32((DateTime.Now.Year)) - Convert.ToInt32((Convert.ToDateTime(emp.ps_birthday).Year)); ViewData["nationality"] = emp.ps_nationality; ViewData["race"] = emp.ps_race; ViewData["religion"] = emp.ps_religion; ViewData["blood"] = emp.ps_blood; ViewData["birthday"] = Convert.ToDateTime(emp.ps_birthday).ToString("dd MMMM yyyy"); ViewData["birthday_format"] = Convert.ToDateTime(emp.ps_birthday).ToString("dd/MM/yyyy"); ViewData["identification"] = emp.ps_national_id; ViewData["date_issue"] = emp.ps_national_date_start; ViewData["expired_date"] = emp.ps_national_date_end; ViewData["marital"] = emp.ps_status_marital; ViewData["emp_person_id"] = emp.ep_ref_personal_id; ViewData["type_"] = type.dropdown_type_id(emp.ep_ref_type_id); emp_positionModel posit = new emp_positionModel(); ViewData["position"] = posit.emp_position_list(code); // /// address dataAddress(code); /// // study ViewData["data_study"] = study.tb_study(code); // // work personal_workModel work = new personal_workModel(); ViewData["data_work"] = work.tb_work(code); // // train personal_trainModel train = new personal_trainModel(); ViewData["data_train"] = train.tb_train(code); // // family personal_familyModel fam = new personal_familyModel(); fam.get_family(code); ViewData["dad_name"] = fam.fam_name_dad + " " + fam.fam_lastname_dad; ViewData["dad_age"] = fam.fam_age_dad; ViewData["dad_tel"] = fam.fam_tel_dad; ViewData["dad_mobile"] = fam.fam_mobile_dad; ViewData["dad_address"] = fam.fam_num_dad + " หมู่ " + fam.fam_moo_dad + " " + fam.fam_district_dad + ", " + fam.fam_amphur_dad + ", " + fam.fam_province_dad + " " + fam.fam_postcode_dad; ViewData["mom_name"] = fam.fam_name_mom + " " + fam.fam_lastname_mom; ViewData["mom_age"] = fam.fam_age_mom; ViewData["mom_tel"] = fam.fam_tel_mom; ViewData["mom_mobile"] = fam.fam_mobile_mom; ViewData["mom_address"] = fam.fam_num_mom + " หมู่ " + fam.fam_moo_mom + " " + fam.fam_district_mom + ", " + fam.fam_amphur_mom + ", " + fam.fam_province_mom + " " + fam.fam_postcode_mom; ViewData["marry_name"] = fam.fam_name_marry + " " + fam.fam_lastname_marry; ViewData["marry_age"] = fam.fam_age_marry; ViewData["marry_tel"] = fam.fam_tel_marry; ViewData["marry_mobile"] = fam.fam_mobile_marry; ViewData["marry_address"] = fam.fam_num_marry + " หมู่ " + fam.fam_moo_marry + " " + fam.fam_district_marry + ", " + fam.fam_amphur_marry + ", " + fam.fam_province_marry + " " + fam.fam_postcode_marry; // // child personal_kidModel child = new personal_kidModel(); ViewData["data_child"] = child.tb_kid(code); // /// income checkPay(code); select_income(); /// /// minus minus(); minusSalary(code); /// /// fund fund(code); empFundResign fn = new empFundResign(); empFundChange fc = new empFundChange(); ViewData["fundResign"] = fn.list_fundResignEmp(code); ViewData["fundChange"] = fc.list_fundChange_emp(code); /// /// commend commend(code); /// /// admonish admonish(code); /// //// provinceModel province = new provinceModel(); ViewData["province"] = province.selectProvince(); amphurModel amphur = new amphurModel(); ViewData["amphur"] = amphur.select_amphur(); districtModel district = new districtModel(); ViewData["district"] = district.select_district(); //profile img empModel em = new empModel(); em.check_img(code); if (string.IsNullOrEmpty(em.img_name) == true) { ViewData["profile_img"] = "../../profile/face-2.jpg"; } else { ViewData["profile_img"] = "../../profile/" + em.img_name; } empPositionChangeModel pc = new empPositionChangeModel(); pc.pc_emp_id = code; ViewData["data_change_position"] = pc.list_posiotnChane_emp_id(); EmpPositionResignModel rs = new EmpPositionResignModel(); ViewData["data_resign_position"] = rs.list_position_resign_emp(code); return(View()); }
public IActionResult update_resign(string emp, string emp_resign_date, string type, string detail, string re_id, string emp_id) { DateTime dt = new DateTime(3000, 01, 01); empModel em = new empModel(); em.select_emp(emp); em.insertEmpLOG(); emp_resignModel rs = new emp_resignModel(); // if (emp != emp_id) { //select and insertLog for resignold rs.re_id = re_id; rs.select_resign(); rs.insert_resignLOG(); //update event status to delete rs.event_status = "D"; rs.update_resign(); //insert resign new rs.re_ref_emp_id = emp; rs.re_emp_code = em.empCode(emp); rs.re_resign_date = emp_resign_date; rs.re_type = type; rs.re_detail = detail; rs.insert_resign(); // update status emp new em.ep_end = emp_resign_date; em.ep_status = "N"; em.event_status = "U"; em.update_emp(); //select emp old and insert log em.select_emp(emp_id); em.insertEmpLOG(); //update emp old to status Y em.ep_end = Convert.ToDateTime(dt).ToString("yyyy-MM-dd"); em.ep_status = "Y"; em.event_status = "U"; em.update_emp(); } else { rs.re_id = re_id; rs.select_resign(); rs.insert_resignLOG(); rs.re_type = type; rs.re_resign_date = emp_resign_date; rs.re_detail = detail; rs.event_status = "U"; rs.update_resign(); // update event status em.ep_end = emp_resign_date; em.event_status = "U"; em.update_emp(); } return(RedirectToAction("resign", "Employee")); }