protected void Page_Load(object sender, EventArgs e)
        {
            PersonnelSystem ps = PersonnelSystem.GetPersonnelSystem(this);
            loginPerson = ps.LoginPerson;

            LoadCalendar(Table1, DateTime.Today);
            LoadCalendar(Table2, DateTime.Today.AddMonths(1));
            if(!IsPostBack) {
                LoadAbsentLate();
            }
        }
        //private List<DateTime> datetimeList;
        protected void Page_Load(object sender, EventArgs e)
        {
            PersonnelSystem ps = PersonnelSystem.GetPersonnelSystem(this);
            pp = ps.LoginPerson;
            //datetimeList = DatabaseManager.GetLeaveDateTimeFromToDate(pp.CitizenID);
            LoadCalendar(Panel1, DateTime.Today);

            if(!IsPostBack) {
                DateTime dt = DateTime.Today;
                ddlMonth.SelectedValue = "" + dt.Month;
                tbYear.Text = "" + (dt.Year + 543);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            PersonnelSystem ps = PersonnelSystem.GetPersonnelSystem(this);
            loginPerson = ps.LoginPerson;

            FuncGVFinish();
            FuncGVProcessing();
            FuncGVHistory();
            FuncGVCH();
            FuncLeaveClaim();

            if(!IsPostBack) {
                lbuVS1.CssClass = "ps-tab-selected";
            }
        }
Beispiel #4
0
        public void Load(int ID)
        {
            HasData = false;
            OracleConnection.ClearAllPools();
            using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING)) {
                con.Open();
                using(OracleCommand com = new OracleCommand("SELECT LEV_DATA.*, (SELECT LEAVE_TYPE_NAME FROM LEV_TYPE WHERE LEV_TYPE.LEAVE_TYPE_ID = LEV_DATA.LEAVE_TYPE_ID) LEAVE_TYPE_NAME, (SELECT LEAVE_STATUS_NAME FROM LEV_STATUS WHERE LEV_STATUS.LEAVE_STATUS_ID = LEV_DATA.LEAVE_STATUS_ID) LEAVE_STATUS_NAME FROM LEV_DATA WHERE LEAVE_ID = " + ID, con)) {
                    using(OracleDataReader reader = com.ExecuteReader()) {
                        while(reader.Read()) {
                            HasData = true;
                            int i = 1;
                            LeaveID = ID;
                            LeaveTypeID = reader.GetInt32(i++);
                            LeaveStatusID = reader.GetInt32(i++);

                            if(reader.IsDBNull(i)) {
                                RequestDate = null;
                            } else {
                                RequestDate = reader.GetDateTime(i);
                            }
                            ++i;

                            if (reader.IsDBNull(i)) {
                                CancelDate = null;
                            } else {
                                CancelDate = reader.GetDateTime(i);
                            }
                            ++i;

                            if (reader.IsDBNull(i)) {
                                FromDate = null;
                            } else {
                                FromDate = reader.GetDateTime(i);
                            }
                            ++i;

                            if (reader.IsDBNull(i)) {
                                ToDate = null;
                            } else {
                                ToDate = reader.GetDateTime(i);
                            }
                            ++i;

                            TotalDay = reader.IsDBNull(i) ? -1 : reader.GetInt32(i); ++i;

                            if (reader.IsDBNull(i)) {
                                LastFromDate = null;
                            } else {
                                LastFromDate = reader.GetDateTime(i);
                            }
                            ++i;

                            if (reader.IsDBNull(i)) {
                                LastToDate = null;
                            } else {
                                LastToDate = reader.GetDateTime(i);
                            }
                            ++i;

                            LastTotalDay = reader.IsDBNull(i) ? -1 : reader.GetInt32(i); ++i;
                            Reason = reader.IsDBNull(i) ? null : reader.GetString(i); ++i;
                            Contact = reader.IsDBNull(i) ? null : reader.GetString(i); ++i;
                            Telephone = reader.IsDBNull(i) ? null : reader.GetString(i); ++i;
                            PS_ID = reader.IsDBNull(i) ? null : reader.GetString(i); ++i;

                            DocterCertificationFileName = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                            CountPast = reader.IsDBNull(i) ? -1 : reader.GetInt32(i); ++i;
                            CountNow = reader.IsDBNull(i) ? -1 : reader.GetInt32(i); ++i;
                            CountTotal = reader.IsDBNull(i) ? -1 : reader.GetInt32(i); ++i;
                            WifeFirstName = reader.IsDBNull(i) ? null : reader.GetString(i); ++i;
                            WifeLastName = reader.IsDBNull(i) ? null : reader.GetString(i); ++i;

                            if (reader.IsDBNull(i)) {
                                GiveBirthDate = null;
                            } else {
                                GiveBirthDate = reader.GetDateTime(i);
                            }
                            ++i;

                            TempleName = reader.IsDBNull(i) ? null : reader.GetString(i); ++i;
                            TempleLocation = reader.IsDBNull(i) ? null : reader.GetString(i); ++i;

                            if (reader.IsDBNull(i)) {
                                OrdainDate = null;
                            } else {
                                OrdainDate = reader.GetDateTime(i);
                            }
                            ++i;

                            Ordained = reader.IsDBNull(i) ? -1 : reader.GetInt32(i); ++i;
                            Hujed = reader.IsDBNull(i) ? -1 : reader.GetInt32(i); ++i;

                            PS_Department = reader.IsDBNull(i) ? null : reader.GetString(i); ++i;

                            RestSave = reader.IsDBNull(i) ? -1 : reader.GetInt32(i); ++i;
                            RestLeft = reader.IsDBNull(i) ? -1 : reader.GetInt32(i); ++i;
                            RestTotal = reader.IsDBNull(i) ? -1 : reader.GetInt32(i); ++i;
                            BudgetYear = reader.IsDBNull(i) ? -1 : reader.GetInt32(i); ++i;

                            if (reader.IsDBNull(i)) {
                                Allow = null;
                            } else {
                                Allow = reader.GetInt32(i);
                            }
                            ++i;

                            if (reader.IsDBNull(i)) {
                                AllowDate = null;
                            } else {
                                AllowDate = reader.GetDateTime(i);
                            }
                            ++i;

                            if (reader.IsDBNull(i)) {
                                CancelAllow = null;
                            } else {
                                CancelAllow = reader.GetInt32(i);
                            }
                            ++i;

                            if (reader.IsDBNull(i)) {
                                CancelAllowDate = null;
                            } else {
                                CancelAllowDate = reader.GetDateTime(i);
                            }
                            ++i;

                            BossState = reader.IsDBNull(i) ? -1 : reader.GetInt32(i); ++i;
                            BossStateMax = reader.IsDBNull(i) ? -1 : reader.GetInt32(i); ++i;

                            CancelReason = reader.IsDBNull(i) ? null : reader.GetString(i); ++i;

                            LeaveTypeName = reader.IsDBNull(i) ? null : reader.GetString(i); ++i;
                            LeaveStatusName = reader.IsDBNull(i) ? null : reader.GetString(i); ++i;
                        }
                    }
                }

                Person = DatabaseManager.GetPerson(PS_ID);

                using (OracleCommand com = new OracleCommand("SELECT LEV_BOSS_DATA.* FROM LEV_BOSS_DATA WHERE LEAVE_ID = " + ID, con)) {
                    using (OracleDataReader reader = com.ExecuteReader()) {
                        while (reader.Read()) {
                            LeaveBossData leaveBossData = new LeaveBossData();
                            leaveBossData.LeaveBossID = reader.GetInt32(0);
                            leaveBossData.LeaveID = reader.GetInt32(1);
                            leaveBossData.CitizenID = reader.GetString(2);
                            leaveBossData.Comment = reader.IsDBNull(3) ? null : reader.GetString(3);
                            if(reader.IsDBNull(4)) {
                                leaveBossData.Allow = null;
                            } else {
                                leaveBossData.Allow = reader.GetInt32(4);
                            }

                            leaveBossData.State = reader.GetInt32(5);
                            if(reader.IsDBNull(6)) {
                                leaveBossData.AllowDate = null;
                            } else {
                                leaveBossData.AllowDate = reader.GetDateTime(6);
                            }
                            leaveBossData.CancelComment = reader.IsDBNull(7) ? null : reader.GetString(7);
                            if (reader.IsDBNull(8)) {
                                leaveBossData.CancelAllow = null;
                            } else {
                                leaveBossData.CancelAllow = reader.GetInt32(8);
                            }
                            if (reader.IsDBNull(9)) {
                                leaveBossData.CancelAllowDate = null;
                            } else {
                                leaveBossData.CancelAllowDate = reader.GetDateTime(9);
                            }
                            leaveBossData.Person = DatabaseManager.GetPerson(leaveBossData.CitizenID);
                            LeaveBossDataList.Add(leaveBossData);

                        }
                    }
                }

            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            PersonnelSystem ps = PersonnelSystem.GetPersonnelSystem(this);
            loginPerson = ps.LoginPerson;

            lbReqBusinessDay.Text = businessBeforeDay.ToString();
            lbReqRestDay.Text = restBeforeDay.ToString();
            lbReqGiveBirthDay.Text = giveBirthAfterDay.ToString();
            lbReqHelpGiveBirthDay.Text = helpGiveBirthAfterDay.ToString();
            lbReqOrdainDay.Text = ordainBeforeDay.ToString();
            lbReqHujDay.Text = hujBeforeDay.ToString();

            DateTime dt = DateTime.Today;
            lbReqBusinessDate.Text = dt.AddDays(businessBeforeDay).ToLongDateString();
            lbReqRestDate.Text = dt.AddDays(restBeforeDay).ToLongDateString();
            lbReqGiveBirthDate.Text = dt.AddDays(-giveBirthAfterDay).ToLongDateString();
            lbReqHelpGiveBirthDate.Text = dt.AddDays(-helpGiveBirthAfterDay).ToLongDateString();
            lbReqOrdainDate.Text = dt.AddDays(ordainBeforeDay).ToLongDateString();
            lbReqHujDate.Text = dt.AddDays(hujBeforeDay).ToLongDateString();

            using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING)) {
                OracleConnection.ClearAllPools();
                con.Open();
                using (OracleCommand com = new OracleCommand("SELECT SICK_MAX - SICK_NOW, BUSINESS_MAX - BUSINESS_NOW, REST_MAX - REST_NOW, ORDAIN_MAX - ORDAIN_NOW, HUJ_MAX - HUJ_NOW FROM LEV_CLAIM WHERE PS_CITIZEN_ID = '" + loginPerson.CitizenID + "' AND YEAR = " + Util.BudgetYear(), con)) {
                    using (OracleDataReader reader = com.ExecuteReader()) {
                        while(reader.Read()) {
                            lbSickLeftDay.Text = reader.GetInt32(0).ToString();
                            lbBusinessLeftDay.Text = reader.GetInt32(1).ToString();
                            lbRestLeftDay.Text = reader.GetInt32(2).ToString();
                            lbOrdainLeftDay.Text = reader.GetInt32(3).ToString();
                            lbHujLeftDay.Text = reader.GetInt32(4).ToString();
                        }
                    }
                }
                using (OracleCommand com = new OracleCommand("SELECT TO_DATE FROM LEV_DATA WHERE PS_ID = '" + loginPerson.CitizenID + "' AND LEAVE_TYPE_ID = 1 AND EXTRACT(YEAR FROM FROM_DATE) = " + Util.BudgetYear() + " AND V_ALLOW = 1 ORDER BY LEAVE_ID DESC", con)) {
                    using (OracleDataReader reader = com.ExecuteReader()) {
                        if (reader.Read()) {
                            divSickFrom.Visible = true;
                            DateTime dtLastToDate = reader.GetDateTime(0);
                            dtLastToDate = dtLastToDate.AddDays(1);
                            lbSickFrom.Text = dtLastToDate.ToLongDateString();
                        } else {
                            divSickFrom.Visible = false;
                        }
                    }
                }
            }

            if(!IsPostBack) {
                if (loginPerson.IsMale()) {
                    trReqGiveBirth.Visible = false;
                    trReqHelpGiveBirth.Visible = true;
                    trReqOrdain.Visible = true;
                    trReqHuj.Visible = true;

                    lbuSelectGiveBirth.Visible = false;
                    lbuSelectHelpGiveBirth.Visible = true;
                    lbuSelectOrdain.Visible = true;
                    lbuSelectHuj.Visible = true;

                } else {
                    trReqGiveBirth.Visible = true;
                    trReqHelpGiveBirth.Visible = false;
                    trReqOrdain.Visible = false;
                    trReqHuj.Visible = false;

                    lbuSelectGiveBirth.Visible = true;
                    lbuSelectHelpGiveBirth.Visible = false;
                    lbuSelectOrdain.Visible = false;
                    lbuSelectHuj.Visible = false;
                }
            }
        }
        public static Person GetPerson(string citizenID)
        {
            OracleConnection.ClearAllPools();

            using (OracleConnection con = new OracleConnection(CONNECTION_STRING)) {
                con.Open();
                using (OracleCommand com = new OracleCommand(

                    "SELECT PS_PERSON.PS_CITIZEN_ID, PS_PERSON.PS_TITLE_ID, (SELECT TITLE_NAME_TH FROM TB_TITLENAME WHERE TB_TITLENAME.TITLE_ID = PS_PERSON.PS_TITLE_ID) TITLE_NAME_TH, PS_PERSON.PS_FN_TH, PS_PERSON.PS_LN_TH, PS_GENDER_ID, (SELECT GENDER_NAME FROM TB_GENDER WHERE TB_GENDER.GENDER_ID = PS_PERSON.PS_GENDER_ID) GENDER_NAME, PS_BIRTHDAY_DATE, PS_BIRTHDAY_LONG, PS_RETIRE_DATE, PS_RETIRE_LONG, PS_INWORK_DATE, PS_PERSON.PS_STAFFTYPE_ID, (SELECT STAFFTYPE_NAME FROM TB_STAFFTYPE WHERE TB_STAFFTYPE.STAFFTYPE_ID = PS_PERSON.PS_STAFFTYPE_ID) STAFFTYPE_NAME, PS_DAD_FN, PS_DAD_LN, PS_MOM_FN, PS_MOM_LN, PS_MOM_LN_OLD, PS_LOV_FN, PS_LOV_LN, PS_LOV_LN_OLD, PS_PERSON.PS_MINISTRY_ID, (SELECT MINISTRY_NAME FROM TB_MINISTRY WHERE TB_MINISTRY.MINISTRY_ID = PS_PERSON.PS_MINISTRY_ID) MINISTRY_NAME, PS_DIVISION_ID, (SELECT DIVISION_NAME FROM TB_DIVISION WHERE TB_DIVISION.DIVISION_ID = PS_PERSON.PS_DIVISION_ID) DIVISION_NAME, PS_PASSWORD, PS_RACE_ID, (SELECT NATION_THA FROM TB_NATIONAL WHERE TB_NATIONAL.NATION_SEQ = PS_PERSON.PS_RACE_ID) RACE_THA, PS_NATION_ID, (SELECT NATION_THA FROM TB_NATIONAL WHERE TB_NATIONAL.NATION_SEQ = PS_PERSON.PS_NATION_ID) NATION_THA, PS_HOMEADD, PS_SOI, PS_MOO, PS_STREET, PS_DISTRICT, (SELECT DISTRICT_TH FROM TB_DISTRICT WHERE TB_DISTRICT.DISTRICT_ID = PS_PERSON.PS_DISTRICT) DISTRICT_TH, PS_AMPHUR_ID, (SELECT AMPHUR_TH FROM TB_AMPHUR WHERE TB_AMPHUR.AMPHUR_ID = PS_PERSON.PS_AMPHUR_ID) AMPHUR_TH, PS_PROVINCE_ID, (SELECT PROVINCE_TH FROM TB_PROVINCE WHERE TB_PROVINCE.PROVINCE_ID = PS_PERSON.PS_PROVINCE_ID) PROVINCE_TH, PS_ZIPCODE, PS_COUNTRY_ID, (SELECT COUNTRY_TH FROM TB_COUNTRY WHERE TB_COUNTRY.COUNTRY_ID = PS_PERSON.PS_COUNTRY_ID) PS_COUNTRY_NAME, PS_STATE, PS_HOMEADD_NOW, PS_SOI_NOW, PS_MOO_NOW, PS_STREET_NOW, PS_DISTRICT_ID_NOW, (SELECT DISTRICT_TH FROM TB_DISTRICT WHERE TB_DISTRICT.DISTRICT_ID = PS_PERSON.PS_DISTRICT_ID_NOW) DISTRICT_TH, PS_AMPHUR_ID_NOW, (SELECT AMPHUR_TH FROM TB_AMPHUR WHERE TB_AMPHUR.AMPHUR_ID = PS_PERSON.PS_AMPHUR_ID_NOW) AMPHUR_TH, PS_PROVINCE_ID_NOW, (SELECT PROVINCE_TH FROM TB_PROVINCE WHERE TB_PROVINCE.PROVINCE_ID = PS_PERSON.PS_PROVINCE_ID_NOW) PROVINCE_TH, PS_ZIPCODE_NOW, PS_COUNTRY_ID_NOW, (SELECT COUNTRY_TH FROM TB_COUNTRY WHERE TB_COUNTRY.COUNTRY_ID = PS_PERSON.PS_COUNTRY_ID_NOW) PS_COUNTRY_NAME_NOW, PS_STATE_NOW, PS_PHONE, PS_BUDGET_ID, (SELECT BUDGET_NAME FROM TB_BUDGET WHERE TB_BUDGET.BUDGET_ID = PS_PERSON.PS_BUDGET_ID) BUDGET_NAME, PS_ADMIN_POS_ID, (SELECT ADMIN_POSITION_NAME FROM TB_ADMIN_POSITION WHERE TB_ADMIN_POSITION.ADMIN_POSITION_ID = PS_PERSON.PS_ADMIN_POS_ID) ADMIN_POSITION_NAME, (SELECT ADMIN_POSITION_POWER FROM TB_ADMIN_POSITION WHERE TB_ADMIN_POSITION.ADMIN_POSITION_ID = PS_PERSON.PS_ADMIN_POS_ID) ADMIN_POSITION_POWER, PS_SPECIAL_WORK, PS_TEACH_ISCED_ID, PS_FACULTY_ID, (SELECT FACULTY_NAME FROM TB_FACULTY WHERE TB_FACULTY.FACULTY_ID = PS_PERSON.PS_FACULTY_ID) FACULTY_NAME, PS_CAMPUS_ID, (SELECT CAMPUS_NAME FROM TB_CAMPUS WHERE TB_CAMPUS.CAMPUS_ID = PS_PERSON.PS_CAMPUS_ID) CAMPUS_NAME, PS_SW_ID, PS_RELIGION_ID, (SELECT RELIGION_NAME FROM TB_RELIGION WHERE TB_RELIGION.RELIGION_ID = PS_PERSON.PS_RELIGION_ID) RELIGION_NAME, (SELECT PS_POSITION_AND_SALARY.PS_POSITION_NO FROM PS_POSITION_AND_SALARY WHERE PS_PERSON.PS_CITIZEN_ID = PS_POSITION_AND_SALARY.PS_CITIZEN_ID AND PRESENT = 1) POSITION_NO, (SELECT TB_POSITION.NAME FROM TB_POSITION WHERE PS_PERSON.PS_POSITION_ID = TB_POSITION.ID) POSITION_NAME, PS_SALARY, PS_STATUS_ID, (SELECT STATUS_NAME FROM TB_STATUS_PERSON WHERE PS_PERSON.PS_STATUS_ID = TB_STATUS_PERSON.STATUS_ID) STATUS_PERSON_NAME, PS_BLOOD_ID, (SELECT BLOOD_NAME FROM TB_BLOOD WHERE PS_PERSON.PS_BLOOD_ID = TB_BLOOD.BLOOD_ID) BLOOD_NAME, PS_TELEPHONE_WORK, PS_EMAIL, PS_GROM, (SELECT SW_NAME FROM TB_STATUS_WORK WHERE PS_PERSON.PS_SW_ID = TB_STATUS_WORK.SW_ID) STATUS_NAME, PS_WORK_DIVISION_ID, (SELECT WORK_NAME FROM TB_WORK_DIVISION WHERE PS_PERSON.PS_WORK_DIVISION_ID = TB_WORK_DIVISION.WORK_ID) WORK_NAME, PS_WORK_POS_ID, (SELECT POSITION_WORK_NAME FROM TB_POSITION_WORK WHERE TB_POSITION_WORK.POSITION_WORK_ID = PS_PERSON.PS_WORK_POS_ID) POSITION_WORK_NAME, PS_RANK_ID, (SELECT RANK_NAME_TH FROM TB_RANK WHERE TB_RANK.RANK_ID = PS_PERSON.PS_RANK_ID) RANK_NAME, PS_START_POSI_ID, (SELECT POSITION_WORK_NAME FROM TB_POSITION_WORK WHERE TB_POSITION_WORK.POSITION_WORK_ID = PS_PERSON.PS_START_POSI_ID) START_POSITION_WORK_NAME, PS_START_ADMIN_POSI_ID, (SELECT ADMIN_POSITION_NAME FROM TB_ADMIN_POSITION WHERE TB_ADMIN_POSITION.ADMIN_POSITION_ID = PS_PERSON.PS_START_ADMIN_POSI_ID) START_ADMIN_POSITION_NAME, PS_POSS_SALARY, PS_DATE_QUIT, PS_PERMISSION FROM PS_PERSON WHERE PS_CITIZEN_ID = '" + citizenID + "'"

                    , con)) {
                    using (OracleDataReader reader = com.ExecuteReader()) {
                        while (reader.Read()) {

                            Person person = new Person();
                            int i = 0;

                            person.CitizenID = reader.GetValue(i++).ToString();
                            person.TitleID = reader.GetValue(i++).ToString();
                            person.TitleName = reader.GetValue(i++).ToString();
                            person.FirstName = reader.GetValue(i++).ToString();
                            person.LastName = reader.GetValue(i++).ToString();
                            person.GenderID = reader.GetValue(i++).ToString();
                            person.GenderName = reader.GetValue(i++).ToString();
                            person.BirthDate = reader.GetDateTime(i++);
                            person.BirthDateLong = reader.GetValue(i++).ToString();

                            if(reader.IsDBNull(i)) {
                                person.RetireDate = null;
                            } else {
                                person.RetireDate = reader.GetDateTime(i);
                            }
                            ++i;

                            person.RetireDateLong = reader.GetValue(i++).ToString();

                            if (reader.IsDBNull(i))
                            {
                                person.InWorkDate = null;
                            }
                            else
                            {
                                person.InWorkDate = reader.GetDateTime(i);
                            }
                            ++i;

                            person.StaffTypeID = reader.GetValue(i++).ToString();
                            person.StaffTypeName = reader.GetValue(i++).ToString();
                            person.FatherFirstName = reader.GetValue(i++).ToString();
                            person.FatherLastName = reader.GetValue(i++).ToString();
                            person.MotherFirstName = reader.GetValue(i++).ToString();
                            person.MotherLastName = reader.GetValue(i++).ToString();
                            person.MotherOldLastName = reader.GetValue(i++).ToString();
                            person.CoupleFirstName = reader.GetValue(i++).ToString();
                            person.CoupleLastName = reader.GetValue(i++).ToString();
                            person.CoupleOldLastName = reader.GetValue(i++).ToString();
                            person.MinistryID = reader.GetValue(i++).ToString();
                            person.MinistryName = reader.GetValue(i++).ToString();

                            if (reader.IsDBNull(i)) {
                                person.DivisionID = null;
                            } else {
                                person.DivisionID = reader.GetValue(i).ToString();
                            }
                            ++i;

                            if (reader.IsDBNull(i)) {
                                person.DivisionName = null;
                            } else {
                                person.DivisionName = reader.GetValue(i).ToString();
                            }
                            ++i;

                            person.Password = reader.GetValue(i++).ToString();
                            person.RaceID = reader.GetValue(i++).ToString();
                            person.RaceName = reader.GetValue(i++).ToString();
                            person.NationID = reader.GetValue(i++).ToString();
                            person.NationName = reader.GetValue(i++).ToString();

                            person.HomeAdd = reader.GetValue(i++).ToString();
                            person.Soi = reader.GetValue(i++).ToString();
                            person.Moo = reader.GetValue(i++).ToString();
                            person.Street = reader.GetValue(i++).ToString();
                            person.DistrictID = reader.GetValue(i++).ToString();
                            person.DistrictName = reader.GetValue(i++).ToString();
                            person.AmphurID = reader.GetValue(i++).ToString();
                            person.AmphurName = reader.GetValue(i++).ToString();
                            person.ProvinceID = reader.GetValue(i++).ToString();
                            person.ProvinceName = reader.GetValue(i++).ToString();
                            person.ZipCode = reader.GetValue(i++).ToString();
                            person.PlaceCountryID = reader.GetValue(i++).ToString();
                            person.PlaceCountryName = reader.GetValue(i++).ToString();
                            person.PlaceState = reader.GetValue(i++).ToString();

                            person.HomeAddNow = reader.GetValue(i++).ToString();
                            person.SoiNow = reader.GetValue(i++).ToString();
                            person.MooNow = reader.GetValue(i++).ToString();
                            person.StreetNow = reader.GetValue(i++).ToString();
                            person.DistrictIDNow = reader.GetValue(i++).ToString();
                            person.DistrictNameNow = reader.GetValue(i++).ToString();
                            person.AmphurIDNow = reader.GetValue(i++).ToString();
                            person.AmphurNameNow = reader.GetValue(i++).ToString();
                            person.ProvinceIDNow = reader.GetValue(i++).ToString();
                            person.ProvinceNameNow = reader.GetValue(i++).ToString();
                            person.ZipCodeNow = reader.GetValue(i++).ToString();
                            person.PlaceCountryID = reader.GetValue(i++).ToString();
                            person.PlaceCountryNowName = reader.GetValue(i++).ToString();
                            person.PlaceStateNow = reader.GetValue(i++).ToString();

                            person.Telephone = reader.GetValue(i++).ToString();
                            person.BudgetID = reader.GetValue(i++).ToString();
                            person.BudgetName = reader.GetValue(i++).ToString();
                            person.AdminPositionID = reader.GetValue(i++).ToString();
                            person.AdminPositionName = reader.GetValue(i++).ToString();
                            person.AdminPositionPower = reader.GetValue(i++).ToString();
                            person.SpecialName = reader.GetValue(i++).ToString();
                            person.TeachISCEDID = reader.GetValue(i++).ToString();
                            person.FacultyID = reader.GetValue(i++).ToString();
                            person.FacultyName = reader.GetValue(i++).ToString();
                            person.CampusID = reader.GetValue(i++).ToString();
                            person.CampusName = reader.GetValue(i++).ToString();
                            person.StatusID = reader.GetValue(i++).ToString();
                            person.ReligionID = reader.GetValue(i++).ToString();
                            person.ReligionName = reader.GetValue(i++).ToString();
                            person.PositionID = reader.GetValue(i++).ToString();
                            person.PositionName = reader.GetValue(i++).ToString();

                            if (reader.IsDBNull(i))
                            {
                                person.Salary = 0;
                            }
                            else {
                                person.Salary = reader.GetInt32(i);
                            }
                            ++i;

                            //person.Salary = reader.GetInt32(i++);
                            person.StatusPersonID = reader.GetValue(i++).ToString();
                            person.StatusPersonName = reader.GetValue(i++).ToString();
                            person.BloodID = reader.GetValue(i++).ToString();
                            person.BloodName = reader.GetValue(i++).ToString();
                            person.WorkTelephone = reader.GetValue(i++).ToString();
                            person.Email = reader.GetValue(i++).ToString();
                            person.Grom = reader.GetValue(i++).ToString();
                            person.StatusName = reader.GetValue(i++).ToString();

                            if (reader.IsDBNull(i)) {
                                person.WorkDivisionID = null;
                            } else {
                                person.WorkDivisionID = reader.GetValue(i).ToString();
                            }
                            ++i;

                            if (reader.IsDBNull(i)) {
                                person.WorkDivisionName = null;
                            } else {
                                person.WorkDivisionName = reader.GetValue(i).ToString();
                            }
                            ++i;

                            person.PositionWorkID = reader.GetValue(i++).ToString();
                            person.PositionWorkName = reader.GetValue(i++).ToString();

                            person.RankID = reader.GetValue(i++).ToString();
                            person.RankName = reader.GetValue(i++).ToString();

                            person.StartPositionWorkID = reader.GetValue(i++).ToString();
                            person.StartPositionWorkName = reader.GetValue(i++).ToString();
                            person.StartAdminPositionID = reader.GetValue(i++).ToString();
                            person.StartAdminPositionName = reader.GetValue(i++).ToString();

                            person.PositionSalary = reader.GetValue(i++).ToString();

                            if (reader.IsDBNull(i))
                            {
                                person.DateQuit = null;
                            }
                            else
                            {
                                person.DateQuit = reader.GetDateTime(i);
                            }
                            ++i;

                            person.Permission = reader.GetInt32(i++);

                            return person;
                        }
                    }
                }
            }
            return null;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            loginPerson = PersonnelSystem.GetPersonnelSystem(this).LoginPerson;

            if (!IsPostBack) {
                //Session["LeaveReportTable"] = null;
                for (int i = 2500; i < 2600; ++i) {
                    DropDownList1.Items.Add(new System.Web.UI.WebControls.ListItem("" + i, "" + i));
                }
                //DateTime dt = Util.ODTT();

                /*if (dt.Month >= 10) {
                    DropDownList1.SelectedValue = "" + (dt.Year + 1);
                } else {
                    DropDownList1.SelectedValue = "" + dt.Year;
                }*/

                DropDownList1.SelectedValue = "" + (Util.BudgetYear() + 543);

                ddlView.Items.Add(new ListItem("แสดงทั้งหมด", "1"));
                ddlView.Items.Add(new ListItem("แสดงเฉพาะภายในวิทยาเขต", "2"));
                ddlView.Items.Add(new ListItem("แสดงเฉพาะภายใน สำนัก / สถาบัน / คณะ", "3"));
                ddlView.Items.Add(new ListItem("แสดงเฉพาะภายใน กอง / สำนักงานเลขา / ภาควิชา", "4"));
                ddlView.Items.Add(new ListItem("แสดงเฉพาะภายใน งาน / ฝ่าย", "5"));
                ddlView.Items.Add(new ListItem("แสดงเฉพาะตนเอง", "6"));

                ddlSelfView.Items.Add(new ListItem("แสดงการลาทั้งหมด", "1"));
                ddlSelfView.Items.Add(new ListItem("แสดงตามรหัสการลา", "2"));

                /*  trSelfView.Style.Add("display", "none");
                  trSelfViewLeaveID.Style.Add("display", "none");*/

            }

            /*if(Session["LeaveReportTable"] != null) {
                Table tb = (Table)Session["LeaveReportTable"];
                Panel1.Controls.Clear();
                Panel1.Controls.Add(tb);
            }*/
        }