예제 #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 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());
        }
예제 #3
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());
        }
예제 #4
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 }));
        }