コード例 #1
0
        // GET: /<controller>/
        public IActionResult Index()
        {
            info_prefixModels  prefix = new info_prefixModels();
            info_statusModel   status = new info_statusModel();
            emp_typeModel      type   = new emp_typeModel();
            personalModel      ps     = new personalModel();
            info_positionModel posi   = new info_positionModel();
            companyModel       comp   = new companyModel();
            sectionModel       sect   = new sectionModel();
            departmentModel    dep    = new departmentModel();
            view_employeeModel emp    = new view_employeeModel();


            ViewData["prefix_th"]         = prefix.select_prefixTH();
            ViewData["prefix_en"]         = prefix.select_prefixEN();
            ViewData["type"]              = type.dropdown_type();
            ViewData["status"]            = status.dropdown_status();
            ViewData["national_id"]       = ps.national();
            ViewData["personal_name"]     = ps.personal();
            ViewData["position"]          = posi.dropDownPosition();
            ViewData["company"]           = comp.drop_company();
            ViewData["section"]           = sect.drop_section();
            ViewData["department"]        = dep.drop_dep();
            ViewData["emp_data"]          = emp.emp_data();
            ViewData["option_position"]   = posi.positionList();
            ViewData["option_department"] = dep.deptList();
            ViewData["option_section"]    = sect.sectList();
            ViewData["option_company"]    = comp.compList();
            ViewData["option_status"]     = status.statusList();
            ViewData["option_type"]       = type.typeList();

            HttpContext.Session.SetString("empTab", "");

            return(View());
        }
コード例 #2
0
        public IActionResult updatePerson(string person_id, string prefix_th, string name_th, string lastname_th, string prefix_en, string name_en, string lastname_en, string gender, string blood, string national_id, string national_start, string national_end, string birthday, string age, string nationality, string race, string religion, string marital)
        {
            personalModel ps = new personalModel();

            ps.select_personal(person_id);
            ps.insertPersonalLOG();

            ps.personal_id    = person_id;
            ps.prefix_th      = prefix_th;
            ps.name_th        = name_th;
            ps.lastname_th    = lastname_th;
            ps.prefix_en      = prefix_en;
            ps.name_en        = name_en;
            ps.lastname_en    = lastname_en;
            ps.gender         = gender;
            ps.blood          = blood;
            ps.national_id    = national_id;
            ps.national_start = national_start;
            ps.national_end   = national_end;
            ps.birthday       = birthday;
            ps.nationality    = nationality;
            ps.race           = race;
            ps.religion       = religion;
            ps.marital        = marital;
            ps.event_status   = "U";

            ps.updatePerson();

            return(RedirectToAction("editPersonal", "Personal", new { person = person_id }));
        }
コード例 #3
0
        public string checkName(string name, string lastname)
        {
            personalModel ps = new personalModel();


            return(ps.checkName(name, lastname));
        }
コード例 #4
0
        // GET: /<controller>/
        public IActionResult Index()
        {
            personalModel ps = new personalModel();

            ViewData["data"] = ps.infoPersonal();
            HttpContext.Session.SetString("tabClick", "");


            return(View());
        }
コード例 #5
0
        public IActionResult editPersonal(string person)
        {
            personalModel     ps = new personalModel();
            info_prefixModels px = new info_prefixModels();

            ps.select_personal(person);

            ViewData["ps_id"]          = ps.personal_id;
            ViewData["prefix_th"]      = px.select_prefixTH_for_edit(ps.prefix_th);
            ViewData["prefix_en"]      = px.select_prefixEN_for_edit(ps.prefix_en);
            ViewData["name_th"]        = ps.name_th;
            ViewData["name_en"]        = ps.name_en;
            ViewData["lastname_th"]    = ps.lastname_th;
            ViewData["lastname_en"]    = ps.lastname_en;
            ViewData["gender"]         = ps.gender;
            ViewData["blood"]          = ps.blood;
            ViewData["national_id"]    = ps.national_id;
            ViewData["national_start"] = ps.national_start;
            ViewData["national_end"]   = ps.national_end;
            ViewData["birthday"]       = ps.birthday;
            ViewData["age"]            = ps.age;
            ViewData["nationality"]    = ps.nationality;
            ViewData["race"]           = ps.race;
            ViewData["marital"]        = ps.marital;
            ViewData["religion"]       = ps.religion;

            selectAddressPerson(person);
            selectContact(person);
            selectFamily(person);
            select_kid(person);
            select_study(person);
            select_work(person);
            select_train(person);

            try
            {
                ViewData["test_step"] = HttpContext.Session.GetString("step").ToString();
            }
            catch {
                ViewData["test_step"] = "false";
            }

            personalChangeModel pc = new personalChangeModel();

            pc.ch_ref_person_id       = person;
            ViewData["person_change"] = pc.list_chane_name();


            return(View());
        }
コード例 #6
0
        //[HttpPost]
        public string insertPersonal(string prefix_th, string name_th, string lastname_th, string prefix_en, string name_en, string lastname_en, string gender, string blood, string national_id, string national_start, string national_end, string birthday, string age, string nationality, string race, string marital, string gion)
        {
            personalModel ps = new personalModel();

            ps.prefix_th      = prefix_th;
            ps.prefix_en      = prefix_en;
            ps.name_th        = name_th;
            ps.name_en        = name_en;
            ps.lastname_th    = lastname_th;
            ps.lastname_en    = lastname_en;
            ps.gender         = gender;
            ps.blood          = blood;
            ps.national_id    = national_id;
            ps.national_start = national_start;
            ps.national_end   = national_end;
            ps.birthday       = birthday;
            ps.nationality    = nationality;
            ps.race           = race;
            ps.religion       = gion;
            ps.marital        = marital;
            ps.insertPersonal();

            DateTime            dt = new DateTime(3000, 01, 01);
            personalChangeModel pc = new personalChangeModel();

            pc.ch_ref_prefix_id     = prefix_th;
            pc.ch_ref_prefix_id_old = prefix_th;
            pc.ch_ref_person_id     = ps.personal_id;
            pc.ch_name_th           = name_th;
            pc.ch_name_th_old       = name_th;
            pc.ch_name_en           = name_en;
            pc.ch_name_en_old       = name_en;
            pc.ch_lastname_th       = lastname_th;
            pc.ch_lastname_th_old   = lastname_th;
            pc.ch_lastname_en       = lastname_en;
            pc.ch_lastname_en_old   = lastname_en;
            pc.ch_start_date        = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            pc.ch_end_date          = Convert.ToDateTime(dt).ToString("yyyy-MM-dd HH:mm:ss");
            pc.insert_person_change();


            return(ps.personal_id);
        }
コード例 #7
0
        public IActionResult viewPersonal(string person)
        {
            personalModel     ps = new personalModel();
            info_prefixModels px = new info_prefixModels();

            ps.select_personal(person);

            ViewData["ps_id"]          = ps.personal_id;
            ViewData["prefix_th"]      = px.select_prefixTH_for_edit(ps.prefix_th);
            ViewData["prefix_en"]      = px.select_prefixEN_for_edit(ps.prefix_en);
            ViewData["prefix_th_name"] = ps.prefix_th_name;
            ViewData["prefix_en_name"] = ps.prefix_en_name;
            ViewData["name_th"]        = ps.name_th;
            ViewData["name_en"]        = ps.name_en;
            ViewData["lastname_th"]    = ps.lastname_th;
            ViewData["lastname_en"]    = ps.lastname_en;
            ViewData["gender"]         = ps.gender;
            ViewData["blood"]          = ps.blood;
            ViewData["national_id"]    = ps.national_id;
            ViewData["national_start"] = ps.national_start;
            ViewData["national_end"]   = ps.national_end;
            ViewData["birthday"]       = ps.birthday;
            ViewData["age"]            = ps.age;
            ViewData["nationality"]    = ps.nationality;
            ViewData["race"]           = ps.race;
            ViewData["marital"]        = ps.marital;
            ViewData["religion"]       = ps.religion;

            selectAddressPerson(person);
            selectContact(person);
            selectFamily(person);
            select_kid(person);
            select_study(person);
            select_work(person);
            select_train(person);

            return(View());
        }
コード例 #8
0
        public IActionResult update_person_profile(string emp_id, string gender_edit, string blood_edit, string national_id_edit, string national_start_edit, string national_end_edit, string birthday_edit, string age_edit, string nationality_edit, string race_edit, string religion_edit, string marital_edit)
        {
            personalModel ps = new personalModel();

            ps.select_person_byEmp(emp_id);
            ps.insertPersonalLOG();

            ps.gender         = gender_edit;
            ps.blood          = blood_edit;
            ps.national_id    = national_id_edit;
            ps.national_start = national_start_edit;
            ps.national_end   = national_end_edit;
            ps.birthday       = birthday_edit;
            ps.age            = age_edit;
            ps.nationality    = nationality_edit;
            ps.race           = race_edit;
            ps.religion       = religion_edit;
            ps.marital        = marital_edit;

            ps.updatePersonal();

            return(RedirectToAction("emp", "Employee", new { code = emp_id }));
        }
コード例 #9
0
        public string getPerson(string id)
        {
            personalModel ps = new personalModel();

            return(ps.getdata_personal(id));
        }
コード例 #10
0
        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());
        }
コード例 #11
0
        public async Task <IActionResult> insert_change_name(IList <IFormFile> file, string prefix_th, string name_th, string lastname_th, string prefix_en, string name_en, string lastname_en, string person_id)
        {
            DateTime dt = new DateTime(3000, 01, 01);

            personalModel ps = new personalModel();

            ps.select_personal(person_id); //person

            //
            personalChangeModel pc = new personalChangeModel();

            pc.ch_ref_person_id = person_id;
            pc.select_max_id();
            //
            if (pc.max_id != "N")
            {
                pc.ch_name_id = pc.max_id;
                pc.select_data_id();
                pc.ch_end_date  = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                pc.event_status = "U";
                pc.update_person_change();
            }

            //

            pc.ch_ref_prefix_id_old = ps.prefix_th;
            pc.ch_name_th_old       = ps.name_th;
            pc.ch_lastname_th_old   = ps.lastname_th;
            pc.ch_name_en_old       = ps.name_en;
            pc.ch_lastname_en_old   = ps.lastname_en;
            pc.ch_ref_prefix_id     = prefix_th;
            pc.ch_name_th           = name_th;
            pc.ch_lastname_th       = lastname_th;
            pc.ch_name_en           = name_en;
            pc.ch_lastname_en       = lastname_en;
            pc.ch_ref_person_id     = person_id;
            pc.ch_start_date        = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            pc.ch_end_date          = Convert.ToDateTime(dt).ToString("yyyy-MM-dd HH:mm:ss");
            //change
            pc.insert_person_change();
            //
            ps.event_status = "U";
            ps.insertPersonalLOG();
            //person
            ps.personal_id = person_id;
            ps.prefix_th   = prefix_th;
            ps.name_th     = name_th;
            ps.lastname_th = lastname_th;
            ps.prefix_en   = prefix_en;
            ps.name_en     = name_en;
            ps.lastname_en = lastname_en;
            //person
            ps.updatePerson();
            //
            personFileModel pf = new personFileModel();


            var uploads = Path.Combine(_hostingEnvironment.WebRootPath, "profile");

            foreach (var fl in file)
            {
                if (fl.Length > 0)
                {
                    pf.ch_file_ref_person_id = person_id;
                    pf.ch_file_name          = fl.FileName;
                    pf.ch_ref_change_name_id = pc.turn_id;
                    pf.insert_file();

                    var filePath = Path.Combine(uploads, fl.FileName);
                    using (var fileStream = new FileStream(filePath, FileMode.Create))
                    {
                        await fl.CopyToAsync(fileStream);
                    }
                }
            }


            return(RedirectToAction("editPersonal", "Personal", new { person = person_id }));
        }
コード例 #12
0
        private bool CheckUser(string username, string password)
        {
            using (var client = new HttpClient())
            {
                LoginModel anvandareAttKolla = new LoginModel {
                    AnvandarNamn = username, Losenord = password
                };

                client.BaseAddress = new Uri("http://193.10.202.74/inlogg/personals");

                var response = client.PostAsJsonAsync("Login", anvandareAttKolla).Result;
                if (response.IsSuccessStatusCode)
                {
                    string svarFrånInloggning = response.Content.ReadAsStringAsync().Result;



                    if (svarFrånInloggning != "" && svarFrånInloggning != "0" && svarFrånInloggning != null)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    } Logger.Info("Misslyckad inloggning");



                    personalModel objektFrånWS = JsonConvert.DeserializeObject <personalModel>(svarFrånInloggning);
                    if (objektFrånWS != null)
                    {
                        if (objektFrånWS.Behorighetniva == 2 || objektFrånWS.Behorighetniva == 3)
                        {
                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }

                //Om  svaret inte är IsSuccessStatusCode så kan vi inte godkänna inloggningen
            }

            //public personalModel hamtaUser(string AnvNamn, string Losenord)
            //{
            //    personalModel svarAnv = new personalModel();

            //    svarAnv.AnvandarNamn = AnvNamn;
            //    svarAnv.Losenord = Losenord;

            //    using (var client = new HttpClient()) {

            //        client.BaseAddress = new Uri("http://193.10.202.74/inlogg/personals");
            //        var svar = client.PostAsJsonAsync("Login", svarAnv).Result;

            //        if (svar.IsSuccessStatusCode)
            //        {
            //            var personalSvar = svar.Content.ReadAsStringAsync().Result;
            //            svarAnv.Behorighetsniva = JsonConvert.DeserializeObject<personalModel>(personalSvar).Behorighetsniva;
            //        }
            //        return (svarAnv);
            //    }
        }