protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Login"] == null || Session["Package"] == null)
            {
                Response.Redirect("/Authorization/Login");
            }

            if (!IsPostBack)
            {
                if (Request.Params["code"] != null)
                {
                    string[] code      = Request.Params["code"].Split('U');
                    string   Origin_id = code[1];

                    if (Request.Params["mode"] == "e")
                    {
                        bs_ntn = bs_ntn_mng.getOriginById(Convert.ToInt32(Origin_id));

                        _loadOrigin(bs_ntn);
                    }
                    else if (Request.Params["mode"] == "r")
                    {
                        _removeOrigin(Origin_id);

                        Response.Redirect("/Form_Base/Base_Origins_Management");
                    }
                }
            }
        }
        /*******************************************************************************************************************************************************************************
        ****************************************************                   Load Default Data to Form                        ********************************************************
        ****************************************************                                                                    ********************************************************
        *******************************************************************************************************************************************************************************/

        // เชื้อชาติ
        private void _loadOrigin()
        {
            List <Base_Origins> list_data = new Base_Origins_Manager().getOrigins();

            Cust_Origin_DDL.Items.Add(new ListItem("กรุณาเลือก", "0"));
            Marry_Origin_DDL.Items.Add(new ListItem("กรุณาเลือก", "0"));
            for (int i = 0; i < list_data.Count; i++)
            {
                Base_Origins data = list_data[i];
                Cust_Origin_DDL.Items.Add(new ListItem(data.Origin_name_TH + " ( " + data.Origin_name_ENG + " ) ", data.Origin_id.ToString()));
                Marry_Origin_DDL.Items.Add(new ListItem(data.Origin_name_TH + " ( " + data.Origin_name_ENG + " ) ", data.Origin_id.ToString()));
            }
        }
        public List <Base_Origins> getOrigins()
        {
            MySqlConnection con = MySQLConnection.connectionMySQL();

            try
            {
                con.Open();
                string          sql    = "SELECT * FROM base_origins";
                MySqlCommand    cmd    = new MySqlCommand(sql, con);
                MySqlDataReader reader = cmd.ExecuteReader();

                int    defaultNum    = 0;
                string defaultString = "";

                List <Base_Origins> list_bs_org = new List <Base_Origins>();

                while (reader.Read())
                {
                    Base_Origins bs_org = new Base_Origins();

                    bs_org.Origin_id       = reader.IsDBNull(0) ? defaultNum : reader.GetInt32(0);
                    bs_org.Origin_name_ENG = reader.IsDBNull(1) ? defaultString : reader.GetString(1);
                    bs_org.Origin_name_TH  = reader.IsDBNull(2) ? defaultString : reader.GetString(2);

                    list_bs_org.Add(bs_org);
                }

                return(list_bs_org);
            }
            catch (MySqlException ex)
            {
                error = "MysqlException ==> Managers_Base --> Base_Origins_Manager --> getOrigins() ";
                Log_Error._writeErrorFile(error, ex);
                return(null);
            }
            catch (Exception ex)
            {
                error = "Exception ==> Managers_Base --> Base_Origins_Manager --> getOrigins() ";
                Log_Error._writeErrorFile(error, ex);
                return(null);
            }
            finally
            {
                con.Close();
                con.Dispose();
            }
        }
 private void _loadOrigin(Base_Origins bs_ntn)
 {
     Origin_name_ENG_TBx.Text = bs_ntn.Origin_name_ENG;
     Origin_name_TH_TBx.Text  = bs_ntn.Origin_name_TH;
 }