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

            if (!IsPostBack)
            {
                _loadThaiProvinces();

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

                    if (Request.Params["mode"] == "e")
                    {
                        bs_lscd = bs_lscd_mng.getLeasingCodeById(Convert.ToInt32(Leasing_code_id));

                        _loadLeasingCod(bs_lscd);
                    }
                    else if (Request.Params["mode"] == "r")
                    {
                        _removeLeasingCode(Leasing_code_id);

                        Response.Redirect("/Form_Base/Base_Leasing_Code_Management");
                    }
                }
            }
        }
示例#2
0
        public Base_Leasing_Code getLeasingCodeById(int Leasing_code_id)
        {
            MySqlConnection con = MySQLConnection.connectionMySQL();

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

                int    defaultNum    = 0;
                string defaultString = "";

                Base_Leasing_Code bs_ls_code = new Base_Leasing_Code();

                if (reader.Read())
                {
                    bs_ls_code.Leasing_code_id          = reader.IsDBNull(0) ? defaultNum : reader.GetInt32(0);
                    bs_ls_code.Leasing_code_name        = reader.IsDBNull(1) ? defaultString : reader.GetString(1);
                    bs_ls_code.Leasing_code_S_Name      = reader.IsDBNull(2) ? defaultString : reader.GetString(2);
                    bs_ls_code.Leasing_code_F_Name      = reader.IsDBNull(3) ? defaultString : reader.GetString(3);
                    bs_ls_code.Leasing_code_Tax_id      = reader.IsDBNull(4) ? defaultString : reader.GetString(4);
                    bs_ls_code.Leasing_code_Tax_subcode = reader.IsDBNull(5) ? defaultString : reader.GetString(5);
                    bs_ls_code.Leasing_code_address_no  = reader.IsDBNull(6) ? defaultString : reader.GetString(6);
                    bs_ls_code.Leasing_code_vilage      = reader.IsDBNull(7) ? defaultString : reader.GetString(7);
                    bs_ls_code.Leasing_code_vilage_no   = reader.IsDBNull(8) ? defaultString : reader.GetString(8);
                    bs_ls_code.Leasing_code_alley       = reader.IsDBNull(9) ? defaultString : reader.GetString(9);
                    bs_ls_code.Leasing_code_road        = reader.IsDBNull(10) ? defaultString : reader.GetString(10);
                    bs_ls_code.Leasing_code_subdistrict = reader.IsDBNull(11) ? defaultString : reader.GetString(11);
                    bs_ls_code.Leasing_code_district    = reader.IsDBNull(12) ? defaultString : reader.GetString(12);
                    bs_ls_code.Leasing_code_province    = reader.IsDBNull(13) ? defaultString : reader.GetString(13);
                    bs_ls_code.Leasing_code_country     = reader.IsDBNull(14) ? defaultString : reader.GetString(14);
                    bs_ls_code.Leasing_code_zipcode     = reader.IsDBNull(15) ? defaultString : reader.GetString(15);
                    bs_ls_code.Leasing_code_tel         = reader.IsDBNull(16) ? defaultString : reader.GetString(16);
                }

                return(bs_ls_code);
            }
            catch (MySqlException ex)
            {
                error = "MysqlException ==> Managers_Base --> Base_Leasing_Code_Manager --> getLeasingCodeById() ";
                Log_Error._writeErrorFile(error, ex);
                return(null);
            }
            catch (Exception ex)
            {
                error = "Exception ==> Managers_Base --> Base_Leasing_Code_Manager --> getLeasingCodeById() ";
                Log_Error._writeErrorFile(error, ex);
                return(null);
            }
            finally
            {
                con.Close();
                con.Dispose();
            }
        }
示例#3
0
        public bool editLeasingCode(Base_Leasing_Code bs_ls_cd)
        {
            MySqlConnection con = MySQLConnection.connectionMySQL();

            try
            {
                con.Open();
                MySqlCommand cmd = new MySqlCommand("u_base_leasing_code", con);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@i_Leasing_code_id", bs_ls_cd.Leasing_code_id);
                cmd.Parameters.AddWithValue("@i_Leasing_code_name", bs_ls_cd.Leasing_code_name);
                cmd.Parameters.AddWithValue("@i_Leasing_code_S_Name", bs_ls_cd.Leasing_code_S_Name);
                cmd.Parameters.AddWithValue("@i_Leasing_code_F_Name", bs_ls_cd.Leasing_code_F_Name);
                cmd.Parameters.AddWithValue("@i_Leasing_code_Tax_id", bs_ls_cd.Leasing_code_Tax_id);
                cmd.Parameters.AddWithValue("@i_Leasing_code_Tax_subcode", bs_ls_cd.Leasing_code_Tax_subcode);
                cmd.Parameters.AddWithValue("@i_Leasing_code_address_no", bs_ls_cd.Leasing_code_address_no);
                cmd.Parameters.AddWithValue("@i_Leasing_code_vilage", bs_ls_cd.Leasing_code_vilage);
                cmd.Parameters.AddWithValue("@i_Leasing_code_vilage_no", bs_ls_cd.Leasing_code_vilage_no);
                cmd.Parameters.AddWithValue("@i_Leasing_code_alley", bs_ls_cd.Leasing_code_alley);
                cmd.Parameters.AddWithValue("@i_Leasing_code_road", bs_ls_cd.Leasing_code_road);
                cmd.Parameters.AddWithValue("@i_Leasing_code_subdistrict", bs_ls_cd.Leasing_code_subdistrict);
                cmd.Parameters.AddWithValue("@i_Leasing_code_district", bs_ls_cd.Leasing_code_district);
                cmd.Parameters.AddWithValue("@i_Leasing_code_province", bs_ls_cd.Leasing_code_province);
                cmd.Parameters.AddWithValue("@i_Leasing_code_country", bs_ls_cd.Leasing_code_country);
                cmd.Parameters.AddWithValue("@i_Leasing_code_zipcode", bs_ls_cd.Leasing_code_zipcode);
                cmd.Parameters.AddWithValue("@i_Leasing_code_tel", bs_ls_cd.Leasing_code_tel);

                cmd.ExecuteNonQuery();

                return(true);
            }
            catch (MySqlException ex)
            {
                error = "MysqlException ==> Managers_Base --> Base_Leasing_Code_Manager --> editLeasingCode() ";
                Log_Error._writeErrorFile(error, ex);
                return(false);
            }
            catch (Exception ex)
            {
                error = "Exception ==> Managers_Base --> Base_Leasing_Code_Manager --> editLeasingCode() ";
                Log_Error._writeErrorFile(error, ex);
                return(false);
            }
            finally
            {
                con.Close();
                con.Dispose();
            }
        }
        /*******************************************************************************************************************************************************************************
        ****************************************************                   Load Default Data to Form                        ********************************************************
        ****************************************************                                                                    ********************************************************
        *******************************************************************************************************************************************************************************/

        // รหัสสัญญา
        private void _loadLeasingCode()
        {
            List <Base_Leasing_Code> list_data = new Base_Leasing_Code_Manager().getLeasingCode();

            for (int i = 0; i < list_data.Count; i++)
            {
                Base_Leasing_Code data = list_data[i];
                if (string.IsNullOrEmpty(data.Leasing_code_S_Name))
                {
                    Leasing_Code_ChkBxL.Items.Add(new ListItem(data.Leasing_code_name, data.Leasing_code_id.ToString()));
                }
                else
                {
                    Leasing_Code_ChkBxL.Items.Add(new ListItem(data.Leasing_code_name + " ( " + data.Leasing_code_S_Name + " ) ", data.Leasing_code_id.ToString()));
                }
            }
        }
示例#5
0
        private void _loadLeasingCod(Base_Leasing_Code bs_lscd)
        {
            Leasing_code_name_TBx.Text        = bs_lscd.Leasing_code_name;
            Leasing_code_S_Name_TBx.Text      = bs_lscd.Leasing_code_S_Name;
            Leasing_code_F_name_TBx.Text      = bs_lscd.Leasing_code_F_Name;
            Leasing_code_tax_id_TBx.Text      = bs_lscd.Leasing_code_Tax_id;
            Leasing_code_tax_subcode_TBx.Text = bs_lscd.Leasing_code_Tax_subcode;

            Leasing_code_address_no_TBx.Text        = bs_lscd.Leasing_code_address_no;
            Leasing_code_vilage_TBx.Text            = bs_lscd.Leasing_code_vilage.IndexOf('.') >= 1 ? bs_lscd.Leasing_code_vilage.Split('.')[1] : "";
            Leasing_code_vilage_no_TBx.Text         = bs_lscd.Leasing_code_vilage_no.IndexOf('.') >= 1 ? bs_lscd.Leasing_code_vilage_no.Split('.')[1] : "";
            Leasing_code_alley_TBx.Text             = bs_lscd.Leasing_code_alley.IndexOf('.') >= 1 ? bs_lscd.Leasing_code_alley.Split('.')[1] : "";
            Leasing_code_road_TBx.Text              = bs_lscd.Leasing_code_road.IndexOf('.') >= 1 ? bs_lscd.Leasing_code_road.Split('.')[1] : "";
            Leasing_code_subdistrict_TBx.Text       = bs_lscd.Leasing_code_subdistrict.IndexOf('.') >= 1 ? bs_lscd.Leasing_code_subdistrict.Split('.')[1] : "";
            Leasing_code_district_TBx.Text          = bs_lscd.Leasing_code_district.IndexOf('.') >= 1 ? bs_lscd.Leasing_code_district.Split('.')[1] : "";
            Leasing_code_province_DDL.SelectedValue = bs_lscd.Leasing_code_province.IndexOf('.') >= 1 ? Thai_Province._getThaiProvinces(bs_lscd.Leasing_code_province.Split('.')[1]) : "";
            Leasing_code_contry_TBx.Text            = bs_lscd.Leasing_code_country;
            Leasing_code_zipcode_TBx.Text           = bs_lscd.Leasing_code_zipcode;
            Leasing_code_tel_TBx.Text = bs_lscd.Leasing_code_tel;
        }
示例#6
0
        private void _editLeasingCod(string Leasing_code_id)
        {
            if (Request.Params["mode"] == "e")
            {
                Base_Leasing_Code bs_lscd = new Base_Leasing_Code();

                bs_lscd.Leasing_code_id = Convert.ToInt32(Leasing_code_id);

                bs_lscd.Leasing_code_name        = string.IsNullOrEmpty(Leasing_code_name_TBx.Text) ? "" : Leasing_code_name_TBx.Text;
                bs_lscd.Leasing_code_S_Name      = string.IsNullOrEmpty(Leasing_code_S_Name_TBx.Text) ? "" : Leasing_code_S_Name_TBx.Text;
                bs_lscd.Leasing_code_F_Name      = string.IsNullOrEmpty(Leasing_code_F_name_TBx.Text) ? "" : Leasing_code_F_name_TBx.Text;
                bs_lscd.Leasing_code_Tax_id      = string.IsNullOrEmpty(Leasing_code_tax_id_TBx.Text) ? "" : Leasing_code_tax_id_TBx.Text;
                bs_lscd.Leasing_code_Tax_subcode = string.IsNullOrEmpty(Leasing_code_tax_subcode_TBx.Text) ? "" : Leasing_code_tax_subcode_TBx.Text;

                bs_lscd.Leasing_code_address_no  = string.IsNullOrEmpty(Leasing_code_address_no_TBx.Text) ? "" : Leasing_code_address_no_TBx.Text;
                bs_lscd.Leasing_code_vilage      = string.IsNullOrEmpty(Leasing_code_vilage_TBx.Text) ? "บ.-" : "บ." + Leasing_code_vilage_TBx.Text;
                bs_lscd.Leasing_code_vilage_no   = string.IsNullOrEmpty(Leasing_code_vilage_no_TBx.Text) ? "ม.-" : "ม." + Leasing_code_vilage_no_TBx.Text;
                bs_lscd.Leasing_code_alley       = string.IsNullOrEmpty(Leasing_code_alley_TBx.Text) ? "ซ.-" : "ซ." + Leasing_code_alley_TBx.Text;
                bs_lscd.Leasing_code_road        = string.IsNullOrEmpty(Leasing_code_road_TBx.Text) ? "ถ.-" : "ถ." + Leasing_code_road_TBx.Text;
                bs_lscd.Leasing_code_subdistrict = string.IsNullOrEmpty(Leasing_code_subdistrict_TBx.Text) ? "ต.-" : "ต." + Leasing_code_subdistrict_TBx.Text;
                bs_lscd.Leasing_code_district    = string.IsNullOrEmpty(Leasing_code_district_TBx.Text) ? "อ.-" : "อ." + Leasing_code_district_TBx.Text;
                bs_lscd.Leasing_code_province    = Leasing_code_province_DDL.SelectedIndex <= 0 ? "จ.-" : "จ." + Leasing_code_province_DDL.SelectedItem.Text;
                bs_lscd.Leasing_code_country     = string.IsNullOrEmpty(Leasing_code_contry_TBx.Text) ? "" : Leasing_code_contry_TBx.Text;
                bs_lscd.Leasing_code_zipcode     = string.IsNullOrEmpty(Leasing_code_zipcode_TBx.Text) ? "" : Leasing_code_zipcode_TBx.Text;
                bs_lscd.Leasing_code_tel         = string.IsNullOrEmpty(Leasing_code_tel_TBx.Text) ? "" : Leasing_code_tel_TBx.Text;

                bs_lscd_mng.editLeasingCode(bs_lscd);

                /// Acticity Logs System
                ///

                package_login = (Base_Companys)Session["Package"];
                acc_lgn       = (Account_Login)Session["Login"];

                string message = Messages_Logs._messageLogsNormal(acc_lgn.Account_F_name, " แก้ไขข้อมูลรหัสลิสซิ่ง ", acc_lgn.resu, package_login.Company_N_name);

                new Activity_Log_Manager().addActivityLogs(message, acc_lgn.Account_id, package_login.Company_id);

                /// Acticity Logs System
            }
        }
        protected void Save_Btn_Click(object sender, EventArgs e)
        {
            Base_Leasing_Code bs_lscd = new Base_Leasing_Code();

            bs_lscd.Leasing_code_name        = string.IsNullOrEmpty(Leasing_code_name_TBx.Text) ? "" : Leasing_code_name_TBx.Text;
            bs_lscd.Leasing_code_S_Name      = string.IsNullOrEmpty(Leasing_code_S_Name_TBx.Text) ? "" : Leasing_code_S_Name_TBx.Text;
            bs_lscd.Leasing_code_F_Name      = string.IsNullOrEmpty(Leasing_code_F_name_TBx.Text) ? "" : Leasing_code_F_name_TBx.Text;
            bs_lscd.Leasing_code_Tax_id      = string.IsNullOrEmpty(Leasing_code_tax_id_TBx.Text) ? "" : Leasing_code_tax_id_TBx.Text;
            bs_lscd.Leasing_code_Tax_subcode = string.IsNullOrEmpty(Leasing_code_tax_subcode_TBx.Text) ? "" : Leasing_code_tax_subcode_TBx.Text;

            bs_lscd.Leasing_code_address_no  = string.IsNullOrEmpty(Leasing_code_address_no_TBx.Text) ? "" : Leasing_code_address_no_TBx.Text;
            bs_lscd.Leasing_code_vilage      = string.IsNullOrEmpty(Leasing_code_vilage_TBx.Text) ? "บ.-" : "บ." + Leasing_code_vilage_TBx.Text;
            bs_lscd.Leasing_code_vilage_no   = string.IsNullOrEmpty(Leasing_code_vilage_no_TBx.Text) ? "ม.-" : "ม." + Leasing_code_vilage_no_TBx.Text;
            bs_lscd.Leasing_code_alley       = string.IsNullOrEmpty(Leasing_code_alley_TBx.Text) ? "ซ.-" : "ซ." + Leasing_code_alley_TBx.Text;
            bs_lscd.Leasing_code_road        = string.IsNullOrEmpty(Leasing_code_road_TBx.Text) ? "ถ.-" : "ถ." + Leasing_code_road_TBx.Text;
            bs_lscd.Leasing_code_subdistrict = string.IsNullOrEmpty(Leasing_code_subdistrict_TBx.Text) ? "ต.-" : "ต." + Leasing_code_subdistrict_TBx.Text;
            bs_lscd.Leasing_code_district    = string.IsNullOrEmpty(Leasing_code_district_TBx.Text) ? "อ.-" : "อ." + Leasing_code_district_TBx.Text;
            bs_lscd.Leasing_code_province    = Leasing_code_province_DDL.SelectedIndex <= 0 ? "จ.-" : "จ.-" + Leasing_code_province_DDL.SelectedItem.Text;
            bs_lscd.Leasing_code_country     = string.IsNullOrEmpty(Leasing_code_contry_TBx.Text) ? "" : Leasing_code_contry_TBx.Text;
            bs_lscd.Leasing_code_zipcode     = string.IsNullOrEmpty(Leasing_code_zipcode_TBx.Text) ? "" : Leasing_code_zipcode_TBx.Text;
            bs_lscd.Leasing_code_tel         = string.IsNullOrEmpty(Leasing_code_tel_TBx.Text) ? "" : Leasing_code_tel_TBx.Text;

            new Base_Leasing_Code_Manager().addLeasingCode(bs_lscd);

            /// Acticity Logs System
            ///

            package_login = (Base_Companys)Session["Package"];
            acc_lgn       = (Account_Login)Session["Login"];

            string message = Messages_Logs._messageLogsNormal(acc_lgn.Account_F_name, " เพิ่มข้อมูลรหัสลิสซิ่ง ", acc_lgn.resu, package_login.Company_N_name);

            new Activity_Log_Manager().addActivityLogs(message, acc_lgn.Account_id, package_login.Company_id);

            /// Acticity Logs System

            _clearDataAfterAdded();

            Page_Load(sender, e);
        }
        private void _editNationality(string Nationality_id)
        {
            if (Request.Params["mode"] == "e")
            {
                Base_Leasing_Code bs_lscd = new Base_Leasing_Code();

                string Nationality_name_ENG = string.IsNullOrEmpty(Nationality_name_ENG_TBx.Text) ? "" : Nationality_name_ENG_TBx.Text;
                string Nationality_name_TH  = string.IsNullOrEmpty(Nationality_name_TH_TBx.Text) ? "" : Nationality_name_TH_TBx.Text;

                bs_ntn_mng.editNationality(Convert.ToInt32(Nationality_id), Nationality_name_ENG, Nationality_name_TH);

                /// Acticity Logs System
                ///

                package_login = (Base_Companys)Session["Package"];
                acc_lgn       = (Account_Login)Session["Login"];

                string message = Messages_Logs._messageLogsNormal(acc_lgn.Account_F_name, " แก้ไขข้อมูลสัญชาติ ", acc_lgn.resu, package_login.Company_N_name);

                new Activity_Log_Manager().addActivityLogs(message, acc_lgn.Account_id, package_login.Company_id);

                /// Acticity Logs System
            }
        }