示例#1
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 }));
        }
示例#2
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 }));
        }
示例#3
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 }));
        }