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

            if (!IsPostBack)
            {
                _loadThaiProvinces();

                /// 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
            }

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

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

            /// แสดงสาขาทุกสาขา เฉพาะผู้เกี่ยวข้อง
            if (acc_lgn.acc_lv.level_access >= 5)
            {
                Leasing_Code_Panel.Visible = true;
                Comapnys_Panel.Visible     = true;;
            }
            else if (acc_lgn.acc_lv.level_access == 4)
            {
                Leasing_Code_Panel.Visible = true;
                Comapnys_Panel.Visible     = false;
            }
            else
            {
                Leasing_Code_Panel.Visible = false;
                Comapnys_Panel.Visible     = false;
            }

            /// แสดงปุ่มการออกรายงาน เฉพาะผู้เกี่ยวข้อง
            if (acc_lgn.acc_lv.level_access >= 5)
            {
                Export_Reported_mod_I_Btn.Visible  = true;
                Export_Reported_mod_II_Btn.Visible = true;
            }
            else if (acc_lgn.acc_lv.level_access <= 4)
            {
                Export_Reported_mod_I_Btn.Visible  = true;
                Export_Reported_mod_II_Btn.Visible = false;
            }
            else
            {
                Export_Reported_mod_I_Btn.Visible  = false;
                Export_Reported_mod_II_Btn.Visible = false;
            }

            if (!IsPostBack)
            {
                _loadCompanys();
                _loadLeasingCode();
                _loadZoneService();

                /// Acticity Logs System
                ///

                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 Page_Load(object sender, EventArgs e)
        {
            if (Session["Login"] == null || Session["Package"] == null)
            {
                Response.Redirect("/Authorization/Login");
            }

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

            if (!IsPostBack)
            {
                _loadCompanys();
                _loadLeasingCode();
                _loadZoneService();

                /// Acticity Logs System
                ///

                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
            }
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Login"] == null || Session["Package"] == null)
            {
                Response.Redirect("/Authorization/Login");
            }

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

            if (!IsPostBack)
            {
                if (Session["Uploaded"] != null)
                {
                    Session.Remove("Uploaded");
                }

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

                    Customers_Manager    ctm_mng        = new Customers_Manager();
                    Customers_Home_Photo ctm_home_photo = ctm_mng.getCustomersHomePhotoSelected(Cust_id, number_img);

                    if (string.IsNullOrEmpty(ctm_home_photo.Home_img_path))
                    {
                        ctm_mng.removeCustomersHomePhoto(ctm_home_photo.Cust_id, ctm_home_photo.Home_img_num);
                    }
                    else
                    {
                        File.Delete(ctm_home_photo.Home_img_local_path);
                        ctm_mng.removeCustomersHomePhoto(ctm_home_photo.Cust_id, ctm_home_photo.Home_img_num);
                    }


                    /// 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

                    Session["Remove_Message"]        = 1;
                    Session["Class_Active_Customer"] = 2;
                    Response.Redirect("/Form_Customer/Customer_Home_Photo");
                }
            }
        }
        protected void Save_Btn_Click(object sender, EventArgs e)
        {
            string[] code = Request.Params["code"].Split('U');
            string   id   = code[1];

            Account_Login acc_lgn_edit = new Account_Login();

            acc_lgn_edit.Account_id  = id;
            acc_lgn_edit.Username_md = username_TBx.Text;
            acc_lgn_edit.Password_md = password_TBx.Text;

            acc_lgn_edit.acc_lv          = new Account_Level();
            acc_lgn_edit.acc_lv.level_id = level_DDL.SelectedIndex <= 0 ? 1 : Convert.ToInt32(level_DDL.SelectedValue);

            acc_lgn_edit.Account_Idcard      = Account_Idcard_TBx.Text;
            acc_lgn_edit.Account_F_name      = Account_F_name_TBx.Text;
            acc_lgn_edit.Account_N_Name      = Account_N_Name_TBx.Text;
            acc_lgn_edit.Account_Address_pri = Account_Address_pri_TBx.Text;
            acc_lgn_edit.Account_Tel         = Account_Tel_TBx.Text;
            acc_lgn_edit.Account_Email       = Account_Email_TBx.Text;

            acc_lgn_edit.bs_cpn            = new Base_Companys();
            acc_lgn_edit.bs_cpn.Company_id = Company_DDL.SelectedIndex <= 0 ? 1 : Convert.ToInt32(Company_DDL.SelectedValue);

            acc_lgn_edit.Account_status = Convert.ToInt32(Account_status_DDL.SelectedValue);

            Account_Manager acc_mng = new Account_Manager();

            if (acc_mng.editAccount(acc_lgn_edit))
            {
                /// 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_edit.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

                Response.Redirect("/Form_Account/Account_Search");
            }
            else
            {
                Alert_Danger_Panel.Visible   = true;
                alert_header_danger_Lbl.Text = "แจ้งเตือน!!";
                alert_danger_Lbl.Text        = "กรุณาตรวจสอบ ข้อมูลอีกครั้ง";

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

            if (!IsPostBack)
            {
                if (Session["Uploaded"] != null)
                {
                    Session.Remove("Uploaded");
                }

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

                    cls_photo = cls_mng.getLeasingsCarPhotoSelected(Leasing_id, number_img);

                    if (string.IsNullOrEmpty(cls_photo.Car_img_path))
                    {
                        cls_mng.removeLeasingsCarPhoto(cls_photo.Leasing_id, cls_photo.Car_img_num);
                    }
                    else
                    {
                        File.Delete(cls_photo.Car_img_local_path);
                        cls_mng.removeLeasingsCarPhoto(cls_photo.Leasing_id, cls_photo.Car_img_num);
                    }

                    cls = (Car_Leasings)Session["Leasings"];

                    /// 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, " ลบรูปรถ ในสัญญา : " + cls.Leasing_no + " เลขที่ฝาก : " + cls.Deps_no, 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

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

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

            if (acc_lgn.acc_lv.level_access < 7)
            {
                Save_Btn.Visible = false;
            }

            if (!IsPostBack)
            {
                if (Request.Params["code"] != null)
                {
                    string[] code       = Request.Params["code"].Split('U');
                    string   leasing_id = code[1];
                    string   bill_no    = code[2];
                    string   idcard     = (string)Session["ctm_leasing_payment"];

                    if (Request.Params["mode"] == "e")
                    {
                        Close_Leasing_Lbl.Visible = false;

                        _loadLeasingDetails(leasing_id, idcard, bill_no);
                    }
                    else if (Request.Params["mode"] == "r")
                    {
                        Car_Leasings_Payment_Manager cls_pay_mng = new Car_Leasings_Payment_Manager();

                        cls_pay_mng.removePayment(leasing_id, bill_no);

                        /// Acticity Logs System
                        ///

                        string message = Messages_Logs._messageLogsNormal(acc_lgn.Account_F_name, " ลบข้อมูลการจ่ายเงิน เลขที่ใบเสร็จ : " + bill_no, 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

                        string ogn_code = CryptographyCode.GenerateSHA512String(leasing_id);

                        Response.Redirect("/Form_Leasings/Leasing_Payment?code=" + CryptographyCode.EncodeTOAddressBar(ogn_code, leasing_id, idcard));
                    }
                }
            }
        }
예제 #8
0
        protected void link_Logout_Click(object sender, EventArgs e)
        {
            string package = (string)Session["lctn"];

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

            /// Acticity Logs System
            ///
            string message = Messages_Logs._messageLogsLogout(acc_lgn.Account_F_name, acc_lgn.resu, package_login.Company_N_name, 1);

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

            /// Acticity Logs System

            Session.RemoveAll();

            Response.Redirect("/Authorization/Login?pack=" + package);
        }
예제 #9
0
        private void _removeLeasingCode(string Leasing_code_id)
        {
            if (Request.Params["mode"] == "r")
            {
                bs_lscd_mng.removeLeasingCode(Convert.ToInt32(Leasing_code_id));

                /// 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
            }
        }
        private void _removeData(string id)
        {
            if (Request.Params["mode"] == "r")
            {
                bs_mng.removeCarBrand(Convert.ToInt32(id));

                /// 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
            }
        }
예제 #11
0
        private void _editCompany(string Company_id)
        {
            if (Request.Params["mode"] == "e")
            {
                Base_Companys bs_cpn = new Base_Companys();

                bs_cpn.Company_id = Convert.ToInt32(Company_id);

                bs_cpn.Company_code        = string.IsNullOrEmpty(Company_code_TBx.Text) ? "" : Company_code_TBx.Text;
                bs_cpn.Company_N_name      = string.IsNullOrEmpty(Company_N_name_TBx.Text) ? "" : Company_N_name_TBx.Text;
                bs_cpn.Company_F_name      = string.IsNullOrEmpty(Company_F_name_TBx.Text) ? "" : Company_F_name_TBx.Text;
                bs_cpn.Company_tax_id      = string.IsNullOrEmpty(Company_tax_id_TBx.Text) ? "" : Company_tax_id_TBx.Text;
                bs_cpn.Company_tax_subcode = string.IsNullOrEmpty(Company_tax_subcode_TBx.Text) ? "" : Company_tax_subcode_TBx.Text;

                bs_cpn.Company_address_no  = string.IsNullOrEmpty(Company_address_no_TBx.Text) ? "" : Company_address_no_TBx.Text;
                bs_cpn.Company_vilage      = string.IsNullOrEmpty(Company_vilage_TBx.Text) ? "บ.-" : "บ." + Company_vilage_TBx.Text;
                bs_cpn.Company_vilage_no   = string.IsNullOrEmpty(Company_vilage_no_TBx.Text) ? "ม.-" : "ม." + Company_vilage_no_TBx.Text;
                bs_cpn.Company_alley       = string.IsNullOrEmpty(Company_alley_TBx.Text) ? "ซ.-" : "ซ." + Company_alley_TBx.Text;
                bs_cpn.Company_road        = string.IsNullOrEmpty(Company_road_TBx.Text) ? "ถ.-" : "ถ." + Company_road_TBx.Text;
                bs_cpn.Company_subdistrict = string.IsNullOrEmpty(Company_subdistrict_TBx.Text) ? "ต.-" : "ต." + Company_subdistrict_TBx.Text;
                bs_cpn.Company_district    = string.IsNullOrEmpty(Company_district_TBx.Text) ? "อ.-" : "อ." + Company_district_TBx.Text;
                bs_cpn.Company_province    = Company_province_DDL.SelectedIndex <= 0 ? "จ.-" : "จ." + Company_province_DDL.SelectedItem.Text;
                bs_cpn.Company_country     = string.IsNullOrEmpty(Company_contry_TBx.Text) ? "" : Company_contry_TBx.Text;
                bs_cpn.Company_zipcode     = string.IsNullOrEmpty(Company_zipcode_TBx.Text) ? "" : Company_zipcode_TBx.Text;
                bs_cpn.Company_tel         = string.IsNullOrEmpty(Company_tel_TBx.Text) ? "" : Company_tel_TBx.Text;

                bs_cpn_mng.editCompany(bs_cpn);


                /// 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
            }
        }
예제 #12
0
        protected void Search_Btn_Click(object sender, EventArgs e)
        {
            Session.Remove("List_Leasings");

            Paging_DDL.Items.Clear();

            _getLeasing();

            /// 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 Search_Btn_Click(object sender, EventArgs e)
        {
            Session.Remove("List_Agents");

            Paging_DDL.Items.Clear();

            _GetAgent();

            /// 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
        }
예제 #14
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
            }
        }
예제 #15
0
        private void _editData(string id)
        {
            if (Request.Params["mode"] == "e")
            {
                string value_1 = string.IsNullOrEmpty(Value_1_TBx.Text) ? "" : Value_1_TBx.Text;

                bs_mng.editCourts(Convert.ToInt32(id), value_1);

                /// 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);
        }
        protected void Save_Btn_Click(object sender, EventArgs e)
        {
            bs_cpn = new Base_Companys();

            bs_cpn.Company_code        = string.IsNullOrEmpty(Company_code_TBx.Text) ? "" : Company_code_TBx.Text;
            bs_cpn.Company_N_name      = string.IsNullOrEmpty(Company_N_name_TBx.Text) ? "" : Company_N_name_TBx.Text;
            bs_cpn.Company_F_name      = string.IsNullOrEmpty(Company_F_name_TBx.Text) ? "" : Company_F_name_TBx.Text;
            bs_cpn.Company_tax_id      = string.IsNullOrEmpty(Company_tax_id_TBx.Text) ? "" : Company_tax_id_TBx.Text;
            bs_cpn.Company_tax_subcode = string.IsNullOrEmpty(Company_tax_subcode_TBx.Text) ? "" : Company_tax_subcode_TBx.Text;

            bs_cpn.Company_address_no  = string.IsNullOrEmpty(Company_address_no_TBx.Text)? "" : Company_address_no_TBx.Text;
            bs_cpn.Company_vilage      = string.IsNullOrEmpty(Company_vilage_TBx.Text) ? "บ.-" : "บ." + Company_vilage_TBx.Text;
            bs_cpn.Company_vilage_no   = string.IsNullOrEmpty(Company_vilage_no_TBx.Text) ? "ม.-" : "ม." + Company_vilage_no_TBx.Text;
            bs_cpn.Company_alley       = string.IsNullOrEmpty(Company_alley_TBx.Text) ? "ซ.-" : "ซ." + Company_alley_TBx.Text;
            bs_cpn.Company_road        = string.IsNullOrEmpty(Company_road_TBx.Text) ? "ถ.-" : "ถ." + Company_road_TBx.Text;
            bs_cpn.Company_subdistrict = string.IsNullOrEmpty(Company_subdistrict_TBx.Text) ? "ต.-" : "ต." + Company_subdistrict_TBx.Text;
            bs_cpn.Company_district    = string.IsNullOrEmpty(Company_district_TBx.Text) ? "อ.-" : "อ." + Company_district_TBx.Text;
            bs_cpn.Company_province    = Company_province_DDL.SelectedIndex <= 0 ? "จ.-" : "จ.-" + Company_province_DDL.SelectedItem.Text;
            bs_cpn.Company_country     = string.IsNullOrEmpty(Company_contry_TBx.Text) ? "" : Company_contry_TBx.Text;
            bs_cpn.Company_zipcode     = string.IsNullOrEmpty(Company_zipcode_TBx.Text) ? "" : Company_zipcode_TBx.Text;
            bs_cpn.Company_tel         = string.IsNullOrEmpty(Company_tel_TBx.Text) ? "" : Company_tel_TBx.Text;

            bs_cpn_mng.addCompany(bs_cpn);

            /// 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);
        }
예제 #18
0
        protected void Save_Btn_Click(object sender, EventArgs e)
        {
            string value_1 = string.IsNullOrEmpty(Value_1_TBx.Text) ? "" : Value_1_TBx.Text;

            bs_mng.addCourts(value_1);

            /// 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);
        }
        protected void Save_Btn_Click(object sender, EventArgs e)
        {
            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.addNationality(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

            _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
            }
        }
        /*******************************************************************************************************************************************************************************
        ****************************************************                               Add Data Function                    ********************************************************
        ****************************************************                                                                    ********************************************************
        *******************************************************************************************************************************************************************************/


        private void _EditLeasings()
        {
            Car_Leasings_Manager cls_mng = new Car_Leasings_Manager();
            Car_Leasings         cls     = new Car_Leasings();

            Car_Leasings cls_tmp = (Car_Leasings)Session["Leasings"];

            // ข้อมูลสัญญา
            cls.Leasing_id = cls_tmp.Leasing_id;
            cls.Deps_no    = string.IsNullOrEmpty(Deps_No_TBx.Text) ? "" : Deps_No_TBx.Text;
            cls.Leasing_no = string.IsNullOrEmpty(Leasing_No_TBx.Text) ? "" : Leasing_No_TBx.Text;

            cls.bs_ls_code = new Base_Leasing_Code();
            cls.bs_ls_code.Leasing_code_id = Leasing_Code_DDL.SelectedIndex <= 0 ? 1 : Convert.ToInt32(Leasing_Code_DDL.SelectedValue);

            cls.Leasing_date = string.IsNullOrEmpty(Leasing_Date_TBx.Text) ? DateTimeUtility._dateNOWForServer() : DateTimeUtility.convertDateToMYSQL(Leasing_Date_TBx.Text);

            cls.bs_cpn            = new Base_Companys();
            cls.bs_cpn.Company_id = Company_DDL.SelectedIndex <= 0 ? 1 : Convert.ToInt32(Company_DDL.SelectedValue);

            cls.bs_zn         = new Base_Zone_Service();
            cls.bs_zn.Zone_id = Zone_DDL.SelectedIndex <= 0 ? 1 : Convert.ToInt32(Zone_DDL.SelectedValue);

            cls.bs_ct          = new Base_Courts();
            cls.bs_ct.Court_id = Court_DDL.SelectedIndex <= 0 ? 1 : Convert.ToInt32(Court_DDL.SelectedValue);

            cls.PeReT = string.IsNullOrEmpty(Person_Receive_Trasfer_TBx.Text) ? "" : Person_Receive_Trasfer_TBx.Text;

            // ข้อมูลการประเมิน
            cls.TotalPaymentTime   = TotalPaymentTime_DDL.SelectedIndex <= 0 ? 1 : Convert.ToInt32(TotalPaymentTime_DDL.SelectedValue);
            cls.Total_require      = string.IsNullOrEmpty(Total_Require_TBx.Text) ? 0 : Convert.ToDouble(Total_Require_TBx.Text);
            cls.Vat_rate           = string.IsNullOrEmpty(Vat_TBx.Text) ? 0 : Convert.ToDouble(Vat_TBx.Text);
            cls.Interest_rate      = string.IsNullOrEmpty(Interest_Rate_TBx.Text) ? 0 : Convert.ToDouble(Interest_Rate_TBx.Text);
            cls.Total_period       = string.IsNullOrEmpty(Total_Period_TBx.Text) ? 0 : Convert.ToInt32(Total_Period_TBx.Text);
            cls.Total_sum          = string.IsNullOrEmpty(Total_Sum_TBx.Text) ? 0 : Convert.ToDouble(Total_Sum_TBx.Text);
            cls.Total_Interest     = string.IsNullOrEmpty(Total_Interest_TBx.Text) ? 0 : Convert.ToDouble(Total_Interest_TBx.Text);
            cls.Total_Tax          = string.IsNullOrEmpty(Total_Tax_TBx.Text) ? 0 : Convert.ToDouble(Total_Tax_TBx.Text);
            cls.Total_leasing      = string.IsNullOrEmpty(Total_Leasing_TBx.Text) ? 0 : Convert.ToDouble(Total_Leasing_TBx.Text);
            cls.Total_Net_leasing  = string.IsNullOrEmpty(Total_Net_Leasing_TBx.Text) ? 0 : Convert.ToDouble(Total_Net_Leasing_TBx.Text);
            cls.Period_cal         = string.IsNullOrEmpty(Period_Cal_TBx.Text) ? 0 : Convert.ToDouble(Period_Cal_TBx.Text);
            cls.Period_interst     = string.IsNullOrEmpty(Period_interst_TBx.Text) ? 0 : Convert.ToDouble(Period_interst_TBx.Text);
            cls.Period_tax         = string.IsNullOrEmpty(Period_tax_TBx.Text) ? 0 : Convert.ToDouble(Period_tax_TBx.Text);
            cls.Period_pure        = string.IsNullOrEmpty(Period_pure_TBx.Text) ? 0 : Convert.ToDouble(Period_pure_TBx.Text);
            cls.Period_payment     = string.IsNullOrEmpty(Period_Payment_TBx.Text) ? 0 : Convert.ToDouble(Period_Payment_TBx.Text);
            cls.Period_require     = string.IsNullOrEmpty(Period_require_TBx.Text) ? 0 : Convert.ToDouble(Period_require_TBx.Text);
            cls.Total_period_left  = string.IsNullOrEmpty(Total_Period_TBx.Text) ? 0 : Convert.ToInt32(Total_Period_TBx.Text);
            cls.Total_payment_left = string.IsNullOrEmpty(Total_Net_Leasing_TBx.Text) ? 0 : Convert.ToDouble(Total_Net_Leasing_TBx.Text);
            cls.Payment_schedule   = Payment_Schedule_DDL.SelectedIndex <= 0 ? 1 : Convert.ToInt32(Payment_Schedule_DDL.SelectedValue);
            cls.First_payment_date = string.IsNullOrEmpty(First_Payment_Date_TBx.Text) ? DateTimeUtility._dateNOWForServer() : DateTimeUtility.convertDateToMYSQL(First_Payment_Date_TBx.Text);

            // ข้อมูลรถ
            cls.Car_register_date          = string.IsNullOrEmpty(Car_Register_Date_TBx.Text) ? null : DateTimeUtility.convertDateToMYSQL(Car_Register_Date_TBx.Text);
            cls.Car_license_plate          = string.IsNullOrEmpty(Car_Plate_TBx.Text) ? "" : Car_Plate_TBx.Text;
            cls.Car_license_plate_province = Car_Plate_Province_DDL.SelectedIndex <= 0 ? "จ.-" : "จ." + Car_Plate_Province_DDL.SelectedItem.Text;

            cls.Car_type    = string.IsNullOrEmpty(Car_Type_TBx.Text) ? "" : Car_Type_TBx.Text;
            cls.Car_feature = string.IsNullOrEmpty(Car_Feature_TBx.Text) ? "" : Car_Feature_TBx.Text;

            cls.bs_cbrn = new Base_Car_Brands();
            cls.bs_cbrn.car_brand_id = Car_Brand_DDL.SelectedIndex <= 0 ? 1 : Convert.ToInt32(Car_Brand_DDL.SelectedValue);

            cls.Car_model              = string.IsNullOrEmpty(Car_Model_TBx.Text) ? "" : Car_Model_TBx.Text;
            cls.Car_year               = Car_Year_DDL.SelectedIndex <= 0 ? "" : Car_Year_DDL.SelectedValue;
            cls.Car_color              = string.IsNullOrEmpty(Car_Color_TBx.Text) ? "" : Car_Color_TBx.Text;
            cls.Car_engine_no          = string.IsNullOrEmpty(Engine_No_TBx.Text) ? "" : Engine_No_TBx.Text;
            cls.Car_engine_no_at       = string.IsNullOrEmpty(Engine_No_At_TBx.Text) ? "" : Engine_No_At_TBx.Text;
            cls.Car_engine_brand       = string.IsNullOrEmpty(Engine_Brand_TBx.Text) ? "" : Engine_Brand_TBx.Text;
            cls.Car_chassis_no         = string.IsNullOrEmpty(Chassis_No_TBx.Text) ? "" : Chassis_No_TBx.Text;
            cls.Car_chassis_no_at      = string.IsNullOrEmpty(Chassis_No_At_TBx.Text) ? "" : Chassis_No_At_TBx.Text;
            cls.Car_fual_type          = string.IsNullOrEmpty(Car_Fuel_Type_TBx.Text) ? "" : Car_Fuel_Type_TBx.Text;
            cls.Car_gas_No             = string.IsNullOrEmpty(Car_Gas_No_TBx.Text) ? "" : Car_Gas_No_TBx.Text;
            cls.Car_used_id            = Car_Used_DDL.SelectedIndex <= 0 ? 1 : Convert.ToInt32(Car_Used_DDL.SelectedValue);
            cls.Car_distance           = string.IsNullOrEmpty(Car_Distance_TBx.Text) ? 0 : Convert.ToInt32(Car_Distance_TBx.Text);
            cls.Car_next_register_date = string.IsNullOrEmpty(Car_Next_Register_Date_TBx.Text) ? null : DateTimeUtility.convertDateToMYSQL(Car_Next_Register_Date_TBx.Text);
            cls.Car_tax_value          = string.IsNullOrEmpty(Car_Tax_Value_TBx.Text) ? 0 : Convert.ToDouble(Car_Tax_Value_TBx.Text);
            cls.Car_credits            = string.IsNullOrEmpty(Car_Credits_TBx.Text) ? "" : Car_Credits_TBx.Text;
            cls.Car_agent              = string.IsNullOrEmpty(Car_agent_TBx.Text) ? "" : Car_agent_TBx.Text;

            // ข้อมูลเจ้าของรถเดิม
            cls.Car_old_owner             = string.IsNullOrEmpty(Car_Old_Owner_TBx.Text) ? "" : Car_Old_Owner_TBx.Text;
            cls.Car_old_owner_idcard      = string.IsNullOrEmpty(Car_Old_Owner_Idcard_TBx.Text) ? "" : Car_Old_Owner_Idcard_TBx.Text;
            cls.Car_old_owner_b_date      = string.IsNullOrEmpty(Car_old_owner_b_date_TBx.Text) ? null : DateTimeUtility.convertDateToMYSQL(Car_old_owner_b_date_TBx.Text);
            cls.Car_old_owner_address_no  = string.IsNullOrEmpty(Car_Old_Owner_Address_No_TBx.Text) ? "" : Car_Old_Owner_Address_No_TBx.Text;
            cls.Car_old_owner_vilage      = string.IsNullOrEmpty(Car_Old_Owner_Vilage_TBx.Text) ? "บ.-" : "บ." + Car_Old_Owner_Vilage_TBx.Text;
            cls.Car_old_owner_vilage_no   = string.IsNullOrEmpty(Car_Old_Owner_Vilage_No_TBx.Text) ? "ม.-" : "ม." + Car_Old_Owner_Vilage_No_TBx.Text;
            cls.Car_old_owner_alley       = string.IsNullOrEmpty(Car_Old_Owner_alley_TBx.Text) ? "ซ.-" : "ซ." + Car_Old_Owner_alley_TBx.Text;
            cls.Car_old_owner_road        = string.IsNullOrEmpty(Car_Old_Owner_Road_TBx.Text) ? "ถ.-" : "ถ." + Car_Old_Owner_Road_TBx.Text;
            cls.Car_old_owner_subdistrict = string.IsNullOrEmpty(Car_Old_Owner_Subdistrict_TBx.Text) ? "ต.-" : "ต." + Car_Old_Owner_Subdistrict_TBx.Text;
            cls.Car_old_owner_district    = string.IsNullOrEmpty(Car_Old_Owner_District_TBx.Text) ? "อ.-" : "อ." + Car_Old_Owner_District_TBx.Text;
            cls.Car_old_owner_province    = Car_Old_Owner_Province_DDL.SelectedIndex < 0 ? "จ.-" : "จ." + Car_Old_Owner_Province_DDL.SelectedItem.Text;
            cls.Car_old_owner_contry      = string.IsNullOrEmpty(Car_Old_Owner_Contry_TBx.Text) ? "" : Car_Old_Owner_Contry_TBx.Text;
            cls.Car_old_owner_zipcode     = string.IsNullOrEmpty(Car_Old_Owner_Zipcode_TBx.Text) ? "" : Car_Old_Owner_Zipcode_TBx.Text;

            cls.tent_car             = new Base_Tents_Car();
            cls.tent_car.Tent_car_id = Tent_car_DDL.SelectedIndex < 0 ? 0 : Convert.ToInt32(Tent_car_DDL.SelectedValue);

            // ข้อมูลเช็คและการโอน
            cls.Cheque_receiver     = string.IsNullOrEmpty(Cheque_receiver_TBx.Text) ? "" : Cheque_receiver_TBx.Text;
            cls.Cheque_bank         = string.IsNullOrEmpty(Cheque_bank_TBx.Text) ? "" : Cheque_bank_TBx.Text;
            cls.Cheque_bank_branch  = string.IsNullOrEmpty(Cheque_bank_branch_TBx.Text) ? "" : Cheque_bank_branch_TBx.Text;
            cls.Cheque_number       = string.IsNullOrEmpty(Cheque_number_TBx.Text) ? "" : Cheque_number_TBx.Text;
            cls.Cheque_sum          = string.IsNullOrEmpty(Cheque_sum_TBx.Text) ? 0 : Convert.ToDouble(Cheque_sum_TBx.Text);
            cls.Cheque_receive_date = string.IsNullOrEmpty(Cheque_receive_date_TBx.Text) ? null : DateTimeUtility.convertDateToMYSQL(Cheque_receive_date_TBx.Text);
            cls.Guarantee           = string.IsNullOrEmpty(Guarantee_TBx.Text) ? "" : Guarantee_TBx.Text;

            cls.bs_ls_stt = new Base_Leasing_Status();
            cls.bs_ls_stt.Contract_Status_id = 1;

            cls.Leasing_Comment = string.IsNullOrEmpty(Leasing_Comment_TBx.Text) ? "" : Leasing_Comment_TBx.Text;

            Session["Leasings"] = cls;

            if (cls_mng.editCarLeasings(cls))
            {
                /// 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, " แก้ไขข้อมูลสัญญาเช่า-ซื้อ ในสัญญา : " + cls.Leasing_no + " เลขที่ฝาก : " + cls.Deps_no, 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
                ///

                Session["Class_Active"] = 3;

                if (Session["Agents_Leasing"] == null)
                {
                    Response.Redirect("/Form_Leasings/Leasing_Add_Agent");
                }
                else
                {
                    Response.Redirect("/Form_Leasings/Leasing_Edit_Agent");
                }
            }
            else
            {
                Alert_Danger_Panel.Visible   = true;
                alert_header_danger_Lbl.Text = "แจ้งเตือน!!";
                alert_danger_Lbl.Text        = "กรุณาตรวจสอบ ข้อมูลอีกครั้ง";

                Alert_Danger_Panel.Focus();
            }
        }
        private void _loadReport()
        {
            string deposit_no          = (string)Session["deposit_no_rpt"];
            string leasing_no          = (string)Session["leasing_no_rpt"];
            string idcard              = (string)Session["idcard_rpt"];
            string fname               = (string)Session["fname_rpt"];
            string lname               = (string)Session["lname_rpt"];
            string date_str            = (string)Session["date_str_rpt"];
            string date_end            = (string)Session["date_end_rpt"];
            string lost_str            = (string)Session["lost_str_rpt"];
            string lost_end            = (string)Session["lost_end_rpt"];
            string district            = (string)Session["district_rpt"];
            string province            = (string)Session["province_rpt"];
            string leasing_Code_inline = (string)Session["leasing_Code_inline_rpt"];
            string Company_id_inline   = (string)Session["Company_id_inline_rpt"];
            string zone_id_inline      = (string)Session["zone_id_inline_rpt"];

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

            MySqlConnection con = MySQLConnection.connectionMySQL();

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

                cmd.Parameters.AddWithValue("@i_Deps_no", deposit_no);
                cmd.Parameters.AddWithValue("@i_Leasing_no", leasing_no);
                cmd.Parameters.AddWithValue("@i_Cust_idcard", idcard);
                cmd.Parameters.AddWithValue("@i_Cust_Fname", fname);
                cmd.Parameters.AddWithValue("@i_Cust_LName", lname);
                cmd.Parameters.AddWithValue("@i_Leasing_date_str", date_str);
                cmd.Parameters.AddWithValue("@i_Leasing_date_end", date_end);
                cmd.Parameters.AddWithValue("@i_Leasing_code_id", leasing_Code_inline);
                cmd.Parameters.AddWithValue("@i_Company_id", Company_id_inline);
                cmd.Parameters.AddWithValue("@i_Zone_id", zone_id_inline);
                cmd.Parameters.AddWithValue("@i_lost_str", lost_str);
                cmd.Parameters.AddWithValue("@i_lost_end", lost_end);
                cmd.Parameters.AddWithValue("@i_district", district);
                cmd.Parameters.AddWithValue("@i_province", province);
                cmd.Parameters.AddWithValue("@i_row_str", 0);
                cmd.Parameters.AddWithValue("@i_row_limit", 0);

                MySqlDataReader reader = cmd.ExecuteReader();

                Leasing_Ds ls_ds = new Leasing_Ds();
                ls_ds.Clear();
                ls_ds.Tables["Report_General_Leasings"].Load(reader);

                Notification_Payment_Guarantor rpt = new Notification_Payment_Guarantor();
                rpt.SetDataSource(ls_ds);


                CRV_Display_Report.ReportSource = rpt;

                /// Export Report to PDF File with Save As Mode
                /// rpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "หน้าการ์ด_" + cls.Deps_no);
                /// Response.End();

                ExportReport_Mod_I(rpt);
            }
            catch (MySqlException ex)
            {
                error = "MysqlException ==> Notification_Payment_Export --> _loadReport() ";
                Log_Error._writeErrorFile(error, ex);
            }
            catch (Exception ex)
            {
                error = "Exception ==> Notification_Payment_Export --> _loadReport() ";
                Log_Error._writeErrorFile(error, ex);
            }
            finally
            {
                con.Close();
                con.Dispose();
            }

            /// Acticity Logs System
            ///

            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

            GC.Collect();
        }
예제 #23
0
        /*******************************************************************************************************************************************************************************
        ****************************************************                               Add Data Function                    ********************************************************
        ****************************************************                                                                    ********************************************************
        *******************************************************************************************************************************************************************************/

        private void _AddAgent()
        {
            Agents_Manager cag_mng = new Agents_Manager();
            Agents         cag     = new Agents();

            bool past_page = false;

            if (Session["chk_agent"] != null)
            {
                Agents cag_tmp = (Agents)Session["chk_agent"];

                cag.Agent_id          = cag_mng.generateAgentID();
                cag.Agent_Fname       = string.IsNullOrEmpty(Agent_fname_TBx.Text) ? "" : Agent_fname_TBx.Text;
                cag.Agent_Lname       = string.IsNullOrEmpty(Agent_lname_TBx.Text) ? "" : Agent_lname_TBx.Text;
                cag.Agent_Idcard      = string.IsNullOrEmpty(Agent_idcard_TBx.Text) ? "" : Agent_idcard_TBx.Text;
                cag.Agent_Address_no  = string.IsNullOrEmpty(Agent_address_no_TBx.Text) ? "" : Agent_address_no_TBx.Text;
                cag.Agent_Vilage      = string.IsNullOrEmpty(Agent_vilage_TBx.Text) ? "บ.-" : "บ." + Agent_vilage_TBx.Text;
                cag.Agent_Vilage_no   = string.IsNullOrEmpty(Agent_vilage_no_TBx.Text) ? "ม.-" : "ม." + Agent_vilage_no_TBx.Text;
                cag.Agent_Alley       = string.IsNullOrEmpty(Agent_alley_TBx.Text) ? "ซ.-" : "ซ." + Agent_alley_TBx.Text;
                cag.Agent_Road        = string.IsNullOrEmpty(Agent_road_TBx.Text) ? "ถ.-" : "ถ." + Agent_road_TBx.Text;
                cag.Agent_Subdistrict = string.IsNullOrEmpty(Agent_subdistrict_TBx.Text) ? "ต.-" : "ต." + Agent_subdistrict_TBx.Text;
                cag.Agent_District    = string.IsNullOrEmpty(Agent_district_TBx.Text) ? "อ.-" : "อ." + Agent_district_TBx.Text;
                cag.Agent_Province    = Agent_province_DDL.SelectedIndex <= 0 ? "จ.-" : "จ." + Agent_province_DDL.SelectedItem.Text;
                cag.Agent_Country     = string.IsNullOrEmpty(Agent_country_TBx.Text) ? "" : Agent_country_TBx.Text;
                cag.Agent_Zipcode     = string.IsNullOrEmpty(Agent_zipcode_TBx.Text) ? "" : Agent_zipcode_TBx.Text;

                past_page = cag_mng.editAgent(cag);
            }
            else
            {
                cag.Agent_id          = cag_mng.generateAgentID();
                cag.Agent_Fname       = string.IsNullOrEmpty(Agent_fname_TBx.Text) ? "" : Agent_fname_TBx.Text;
                cag.Agent_Lname       = string.IsNullOrEmpty(Agent_lname_TBx.Text) ? "" : Agent_lname_TBx.Text;
                cag.Agent_Idcard      = string.IsNullOrEmpty(Agent_idcard_TBx.Text) ? "" : Agent_idcard_TBx.Text;
                cag.Agent_Address_no  = string.IsNullOrEmpty(Agent_address_no_TBx.Text) ? "" : Agent_address_no_TBx.Text;
                cag.Agent_Vilage      = string.IsNullOrEmpty(Agent_vilage_TBx.Text) ? "บ.-" : "บ." + Agent_vilage_TBx.Text;
                cag.Agent_Vilage_no   = string.IsNullOrEmpty(Agent_vilage_no_TBx.Text) ? "ม.-" : "ม." + Agent_vilage_no_TBx.Text;
                cag.Agent_Alley       = string.IsNullOrEmpty(Agent_alley_TBx.Text) ? "ซ.-" : "ซ." + Agent_alley_TBx.Text;
                cag.Agent_Road        = string.IsNullOrEmpty(Agent_road_TBx.Text) ? "ถ.-" : "ถ." + Agent_road_TBx.Text;
                cag.Agent_Subdistrict = string.IsNullOrEmpty(Agent_subdistrict_TBx.Text) ? "ต.-" : "ต." + Agent_subdistrict_TBx.Text;
                cag.Agent_District    = string.IsNullOrEmpty(Agent_district_TBx.Text) ? "อ.-" : "อ." + Agent_district_TBx.Text;
                cag.Agent_Province    = Agent_province_DDL.SelectedIndex <= 0 ? "จ.-" : "จ." + Agent_province_DDL.SelectedItem.Text;
                cag.Agent_Country     = string.IsNullOrEmpty(Agent_country_TBx.Text) ? "" : Agent_country_TBx.Text;
                cag.Agent_Zipcode     = string.IsNullOrEmpty(Agent_zipcode_TBx.Text) ? "" : Agent_zipcode_TBx.Text;

                past_page = cag_mng.addAgent(cag);
            }

            if (past_page)
            {
                Session.Remove("chk_agent");

                Alert_Success_Panel.Visible = true;

                /// 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
            }
            else
            {
                Alert_Danger_Panel.Visible   = true;
                alert_header_danger_Lbl.Text = "แจ้งเตือน!!";
                alert_danger_Lbl.Text        = "กรุณาตรวจสอบ ข้อมูลอีกครั้ง";

                Alert_Danger_Panel.Focus();
            }
        }
예제 #24
0
        protected void Upload_Btn_Click(object sender, EventArgs e)
        {
            ctm = (Customers)Session["Customer"];

            string server_path = Server.MapPath("/");

            /* Create Main Folder for Detected Images of Contact Leasing  */
            string mainDirectory = ctm.Cust_id;

            string mainDirectoryPath = server_path + "\\Uploaded_Images\\" + mainDirectory;

            if (!Directory.Exists(mainDirectoryPath))
            {
                Directory.CreateDirectory(mainDirectoryPath);
            }

            /* Create Sub Folder for Save Images of Car */
            string subDirectory = "Home_Images";

            string subDirectoryPath = mainDirectoryPath + "\\" + subDirectory;

            if (!Directory.Exists(subDirectoryPath))
            {
                Directory.CreateDirectory(subDirectoryPath);
            }


            /* Get File From TextFile  */
            HttpFileCollection uploadedFiles = Request.Files;

            for (int i = 0; i < uploadedFiles.Count; i++)
            {
                HttpPostedFile userPostedFile = uploadedFiles[i];

                try
                {
                    if (userPostedFile.ContentLength > 0)
                    {
                        ctm_mng = new Customers_Manager();
                        string number_img = ctm_mng.getLastNumberPhotoId(ctm.Cust_id);
                        string digit      = ctm_mng.generateDigitID();

                        string old_name = userPostedFile.FileName;
                        string new_name = number_img + "_" + ctm.Cust_id + "_" + digit + Path.GetExtension(userPostedFile.FileName);

                        string db_path       = "../Uploaded_Images/" + mainDirectory + "/" + subDirectory + "/" + new_name;
                        string db_full_path  = subDirectoryPath.Replace('\\', '/') + "/" + new_name;
                        string db_local_path = subDirectoryPath + "\\" + new_name;

                        userPostedFile.SaveAs(subDirectoryPath + "\\" + Path.GetFileName(old_name).Replace(old_name, new_name));

                        Customers_Home_Photo ctm_photo = new Customers_Home_Photo();

                        ctm_photo.Cust_id             = ctm.Cust_id;
                        ctm_photo.Home_img_num        = Convert.ToInt32(number_img);
                        ctm_photo.Home_img_old_name   = old_name;
                        ctm_photo.Home_img_path       = db_path;
                        ctm_photo.Home_img_full_path  = db_full_path;
                        ctm_photo.Home_img_local_path = db_local_path;

                        ctm_mng.addCustomersHomePhoto(ctm_photo);

                        /// 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
                    }
                }
                catch (Exception ex)
                {
                    Session["Uploaded"] = 0;
                    string error = "ไม่สามารถ Upload รูปภาพนี้ได้ ";
                    Log_Error._writeErrorFile(error, ex);
                }
            }

            Session["Uploaded"] = 1;

            _GetHomePhoto();
        }
예제 #25
0
        protected void btn_Login_Click(object sender, EventArgs e)
        {
            string pack     = Request.Params["pack"];
            string username = Username_TBx.Text;
            string password = Password_TBx.Text;

            Base_Companys package_login = new Base_Companys_Manager().getCompanypackage(pack);
            Account_Login acc_lgn       = new Account_Manager().getLogin(username, password);

            if (acc_lgn.Account_status == 1 && package_login != null)
            {
                Alert_Warning_Panel.Visible = false;

                Session["Login"]   = acc_lgn;
                Session["Package"] = package_login;

                /// Acticity Logs System
                ///
                string message = Messages_Logs._messageLogsAccess(acc_lgn.Account_F_name, acc_lgn.resu, package_login.Company_N_name, 1);

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

                /// Acticity Logs System

                Response.Redirect("/Form_Main/Main_JKL_Form");
            }
            else if (acc_lgn.Account_status == 2)
            {
                alert_danger_Lbl.Visible = true;

                alert_danger_Lbl.Text = " ** ชื่อผู้ใช้งาน ' " + username + " ' ถูกระงับการใช้งานชั่วคราว กรุณาติดต่อเจ้าหน้าที่ฝ่าย IT ** ";

                /// Acticity Logs System
                ///
                string message = Messages_Logs._messageLogsWarning(acc_lgn.Account_F_name, "ตรวจพบการเข้าใช้งานระบบ ในขณะ ถูกระงับการใช้งานชั่วคราว", username, package_login.Company_N_name);

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

                /// Acticity Logs System
            }
            else if (acc_lgn.Account_status == 3)
            {
                alert_danger_Lbl.Visible = true;

                alert_danger_Lbl.Text = " ** ชื่อผู้ใช้งาน ' " + username + " ' ถูกระงับการใช้งานถาวร เนื่องจากพ้นสภาพพนักงาน ** ";

                /// Acticity Logs System
                ///
                string message = Messages_Logs._messageLogsWarning(acc_lgn.Account_F_name, "ตรวจพบการเข้าใช้งานระบบ ในขณะ ถูกระงับการใช้งานถาวร", username, package_login.Company_N_name);

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

                /// Acticity Logs System
            }
            else
            {
                alert_danger_Lbl.Visible = true;

                alert_danger_Lbl.Text = "** ไม่พบข้อมูลผู้ใช้งาน หรือ ชื่อผู้ใช้งาน (Username) หรือ รหัสผ่านไม่ถูกต้อง (Password) กรุณาตรวจสอบ **";

                /// Acticity Logs System
                ///
                string message = Messages_Logs._messageLogsWarning(acc_lgn.Account_F_name, "ตรวจพบการเข้าใช้งานระบบโดยใช้ ชื่อผู้ใช้งาน หรือรหัสผ่าน ไม่ตามที่กำหนด", username, package_login.Company_N_name);

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

                /// Acticity Logs System
            }
        }
예제 #26
0
        /*******************************************************************************************************************************************************************************
        ****************************************************                               Add Data Function                    ********************************************************
        ****************************************************                                                                    ********************************************************
        *******************************************************************************************************************************************************************************/

        private void _EditAgent()
        {
            Agents_Manager cag_mng = new Agents_Manager();
            Agents         cag     = new Agents();

            bool past_page = false;

            if (Session["chk_agent_leasing"] != null)
            {
                Agents cag_tmp = (Agents)Session["chk_agent_leasing"];

                cag.Agent_id          = cag_tmp.Agent_id;
                cag.Agent_Fname       = string.IsNullOrEmpty(Agent_fname_TBx.Text) ? "" : Agent_fname_TBx.Text;
                cag.Agent_Lname       = string.IsNullOrEmpty(Agent_lname_TBx.Text) ? "" : Agent_lname_TBx.Text;
                cag.Agent_Idcard      = string.IsNullOrEmpty(Agent_idcard_TBx.Text) ? "" : Agent_idcard_TBx.Text;
                cag.Agent_Address_no  = string.IsNullOrEmpty(Agent_address_no_TBx.Text) ? "" : Agent_address_no_TBx.Text;
                cag.Agent_Vilage      = string.IsNullOrEmpty(Agent_vilage_TBx.Text) ? "บ.-" : "บ." + Agent_vilage_TBx.Text;
                cag.Agent_Vilage_no   = string.IsNullOrEmpty(Agent_vilage_no_TBx.Text) ? "ม.-" : "ม." + Agent_vilage_no_TBx.Text;
                cag.Agent_Alley       = string.IsNullOrEmpty(Agent_alley_TBx.Text) ? "ซ.-" : "ซ." + Agent_alley_TBx.Text;
                cag.Agent_Road        = string.IsNullOrEmpty(Agent_road_TBx.Text) ? "ถ.-" : "ถ." + Agent_road_TBx.Text;
                cag.Agent_Subdistrict = string.IsNullOrEmpty(Agent_subdistrict_TBx.Text) ? "ต.-" : "ต." + Agent_subdistrict_TBx.Text;
                cag.Agent_District    = string.IsNullOrEmpty(Agent_district_TBx.Text) ? "อ.-" : "อ." + Agent_district_TBx.Text;
                cag.Agent_Province    = Agent_province_DDL.SelectedIndex <= 0 ? "จ.-" : "จ." + Agent_province_DDL.SelectedItem.Text;
                cag.Agent_Country     = string.IsNullOrEmpty(Agent_country_TBx.Text) ? "" : Agent_country_TBx.Text;
                cag.Agent_Zipcode     = string.IsNullOrEmpty(Agent_zipcode_TBx.Text) ? "" : Agent_zipcode_TBx.Text;

                past_page = cag_mng.editAgent(cag);
            }
            else
            {
                cag.Agent_id          = cag_mng.generateAgentID();
                cag.Agent_Fname       = string.IsNullOrEmpty(Agent_fname_TBx.Text) ? "" : Agent_fname_TBx.Text;
                cag.Agent_Lname       = string.IsNullOrEmpty(Agent_lname_TBx.Text) ? "" : Agent_lname_TBx.Text;
                cag.Agent_Idcard      = string.IsNullOrEmpty(Agent_idcard_TBx.Text) ? "" : Agent_idcard_TBx.Text;
                cag.Agent_Address_no  = string.IsNullOrEmpty(Agent_address_no_TBx.Text) ? "" : Agent_address_no_TBx.Text;
                cag.Agent_Vilage      = string.IsNullOrEmpty(Agent_vilage_TBx.Text) ? "บ.-" : "บ." + Agent_vilage_TBx.Text;
                cag.Agent_Vilage_no   = string.IsNullOrEmpty(Agent_vilage_no_TBx.Text) ? "ม.-" : "ม." + Agent_vilage_no_TBx.Text;
                cag.Agent_Alley       = string.IsNullOrEmpty(Agent_alley_TBx.Text) ? "ซ.-" : "ซ." + Agent_alley_TBx.Text;
                cag.Agent_Road        = string.IsNullOrEmpty(Agent_road_TBx.Text) ? "ถ.-" : "ถ." + Agent_road_TBx.Text;
                cag.Agent_Subdistrict = string.IsNullOrEmpty(Agent_subdistrict_TBx.Text) ? "ต.-" : "ต." + Agent_subdistrict_TBx.Text;
                cag.Agent_District    = string.IsNullOrEmpty(Agent_district_TBx.Text) ? "อ.-" : "อ." + Agent_district_TBx.Text;
                cag.Agent_Province    = Agent_province_DDL.SelectedIndex <= 0 ? "จ.-" : "จ." + Agent_province_DDL.SelectedItem.Text;
                cag.Agent_Country     = string.IsNullOrEmpty(Agent_country_TBx.Text) ? "" : Agent_country_TBx.Text;
                cag.Agent_Zipcode     = string.IsNullOrEmpty(Agent_zipcode_TBx.Text) ? "" : Agent_zipcode_TBx.Text;

                past_page = cag_mng.addAgent(cag);
            }

            Car_Leasings cls_tmp = (Car_Leasings)Session["Leasings"];

            Agents_Commission cag_com = new Agents_Commission();

            cag_com.Leasing_id = cls_tmp.Leasing_id;

            cag_com.cag = new Agents();
            cag_com.cag = cag;

            cag_com.Agent_commission = string.IsNullOrEmpty(Agent_commission_TBx.Text) ? 0 : Convert.ToDouble(Agent_commission_TBx.Text);
            cag_com.Agent_percen     = string.IsNullOrEmpty(Agent_percen_TBx.Text) ? 0 : Convert.ToDouble(Agent_percen_TBx.Text);
            cag_com.Agent_cash       = string.IsNullOrEmpty(Agent_cash_TBx.Text) ? 0 : Convert.ToDouble(Agent_cash_TBx.Text);
            cag_com.Agent_net_com    = string.IsNullOrEmpty(Agent_net_com_TBx.Text) ? 0 : Convert.ToDouble(Agent_net_com_TBx.Text);
            cag_com.Agent_num_code   = string.IsNullOrEmpty(Agent_com_code_TBx.Text) ? "" : Agent_com_code_TBx.Text;
            cag_com.Agent_book_code  = string.IsNullOrEmpty(Agent_bookcode_TBx.Text) ? "" : Agent_bookcode_TBx.Text;
            cag_com.Agent_date_print = string.IsNullOrEmpty(Agent_date_print_TBx.Text) ? DateTimeUtility._dateNOWForServer() : DateTimeUtility.convertDateToMYSQL(Agent_date_print_TBx.Text);

            if (cag_mng.editAgentCommission(cag_com) && past_page)
            {
                cag_com = cag_mng.getAgentCommission(cag_com.cag.Agent_id, cls_tmp.Leasing_id);

                Session["Agents_Leasing"] = string.IsNullOrEmpty(cag_com.cag.Agent_id) ? null : cag_com;

                /// 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, " แก้ไขข้อมูลนายหน้า ในสัญญา : " + cls_tmp.Leasing_no + " เลขที่ฝาก : " + cls_tmp.Deps_no, 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
                ///

                Session.Remove("chk_agent_leasing");

                Session["Class_Active"] = 4;

                Session["Number_Of_Guarantor"] = "1";

                if (Session["Guarantor_1"] == null)
                {
                    Response.Redirect("/Form_Leasings/Leasing_Add_Guarantor");
                }
                else
                {
                    Response.Redirect("/Form_Leasings/Leasing_Edit_Guarantor");
                }
            }
            else
            {
                Alert_Danger_Panel.Visible   = true;
                alert_header_danger_Lbl.Text = "แจ้งเตือน!!";
                alert_danger_Lbl.Text        = "กรุณาตรวจสอบ ข้อมูลอีกครั้ง";

                Alert_Danger_Panel.Focus();
            }
        }
        private void _loadReport()
        {
            string deposit_no          = (string)Session["deposit_no_rpt"];
            string leasing_no          = (string)Session["leasing_no_rpt"];
            string idcard              = (string)Session["idcard_rpt"];
            string fname               = (string)Session["fname_rpt"];
            string lname               = (string)Session["lname_rpt"];
            string date_str            = (string)Session["date_str_rpt"];
            string date_end            = (string)Session["date_end_rpt"];
            string lost_str            = (string)Session["lost_str_rpt"];
            string lost_end            = (string)Session["lost_end_rpt"];
            string district            = (string)Session["district_rpt"];
            string province            = (string)Session["province_rpt"];
            string leasing_Code_inline = (string)Session["leasing_Code_inline_rpt"];
            string Company_id_inline   = (string)Session["Company_id_inline_rpt"];
            string zone_id_inline      = (string)Session["zone_id_inline_rpt"];

            string report_header = " รายงานลูกค้าขาดชำระค่างวด ";

            string report_case = "ค้นหา : ";

            if (!string.IsNullOrEmpty(lost_str) && string.IsNullOrEmpty(lost_end))
            {
                report_case = report_case + " [ ขาด " + lost_str + " ] ";
            }
            else if (string.IsNullOrEmpty(lost_str) && !string.IsNullOrEmpty(lost_end))
            {
                report_case = report_case + " [ ขาด " + lost_end + " ] ";
            }
            else if (!string.IsNullOrEmpty(lost_str) && !string.IsNullOrEmpty(lost_end))
            {
                report_case = report_case + " [ ขาด " + lost_str + " - " + lost_end + " ] ";
            }

            if (!string.IsNullOrEmpty(district))
            {
                report_case = report_case + " [ " + district + " ] ";
            }

            if (!string.IsNullOrEmpty(province))
            {
                report_case = report_case + " [ " + province + " ] ";
            }

            if (!string.IsNullOrEmpty(leasing_Code_inline))
            {
                string[] lsc = leasing_Code_inline.Split(',');

                List <Base_Leasing_Code> list_data = new Base_Leasing_Code_Manager().getLeasingCode();

                for (int lsc_index = 0; lsc_index < lsc.Length; lsc_index++)
                {
                    for (int i = 0; i < list_data.Count; i++)
                    {
                        if (lsc[lsc_index] == list_data[i].Leasing_code_id.ToString())
                        {
                            report_case = report_case + " [ " + list_data[i].Leasing_code_name + " ] ";
                        }
                    }
                }
            }

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

            MySqlConnection con = MySQLConnection.connectionMySQL();

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

                cmd.Parameters.AddWithValue("@i_Deps_no", deposit_no);
                cmd.Parameters.AddWithValue("@i_Leasing_no", leasing_no);
                cmd.Parameters.AddWithValue("@i_Cust_idcard", idcard);
                cmd.Parameters.AddWithValue("@i_Cust_Fname", fname);
                cmd.Parameters.AddWithValue("@i_Cust_LName", lname);
                cmd.Parameters.AddWithValue("@i_Leasing_date_str", date_str);
                cmd.Parameters.AddWithValue("@i_Leasing_date_end", date_end);
                cmd.Parameters.AddWithValue("@i_Leasing_code_id", leasing_Code_inline);
                cmd.Parameters.AddWithValue("@i_Company_id", Company_id_inline);
                cmd.Parameters.AddWithValue("@i_Zone_id", zone_id_inline);
                cmd.Parameters.AddWithValue("@i_lost_str", lost_str);
                cmd.Parameters.AddWithValue("@i_lost_end", lost_end);
                cmd.Parameters.AddWithValue("@i_district", district);
                cmd.Parameters.AddWithValue("@i_province", province);
                cmd.Parameters.AddWithValue("@i_row_str", 0);
                cmd.Parameters.AddWithValue("@i_row_limit", 0);

                MySqlDataReader reader = cmd.ExecuteReader();

                Leasing_Ds ls_ds = new Leasing_Ds();
                ls_ds.Clear();
                ls_ds.Tables["Report_General_Leasings"].Load(reader);

                Lost_Payment rpt = new Lost_Payment();
                rpt.SetDataSource(ls_ds);
                rpt.SetParameterValue("Reported_By_User", "ออกโดย : " + acc_lgn.Account_F_name);
                rpt.SetParameterValue("Reported_Print_Date", "วันที่พิมพ์ : " + DateTimeUtility.convertDateTimeToPage(DateTimeUtility._dateTimeNOWForServer()));
                rpt.SetParameterValue("Report_Header", report_header);
                rpt.SetParameterValue("Report_Case", report_case);

                CRV_Display_Report.ReportSource = rpt;

                /// Export Report to PDF File with Save As Mode
                /// rpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "หน้าการ์ด_" + cls.Deps_no);
                /// Response.End();

                ExportReport_Mod_I(rpt);
            }
            catch (MySqlException ex)
            {
                error = "MysqlException ==> Lost_Payment_Hurry_Export --> _loadReport() ";
                Log_Error._writeErrorFile(error, ex);
            }
            catch (Exception ex)
            {
                error = "Exception ==> Lost_Payment_Hurry_Export --> _loadReport() ";
                Log_Error._writeErrorFile(error, ex);
            }
            finally
            {
                con.Close();
                con.Dispose();
            }

            /// Acticity Logs System
            ///

            string message = Messages_Logs._messageLogsNormal(acc_lgn.Account_F_name, " ออก" + report_header, 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

            GC.Collect();
        }
예제 #28
0
        private void _loadReport()
        {
            string deposit_no          = (string)Session["deposit_no_rpt"];
            string leasing_no          = (string)Session["leasing_no_rpt"];
            string idcard              = (string)Session["idcard_rpt"];
            string fname               = (string)Session["fname_rpt"];
            string lname               = (string)Session["lname_rpt"];
            string lost_str            = (string)Session["lost_str_rpt"];
            string lost_end            = (string)Session["lost_end_rpt"];
            string district            = (string)Session["district_rpt"];
            string province            = (string)Session["province_rpt"];
            string leasing_Code_inline = (string)Session["leasing_Code_inline_rpt"];
            string Company_id_inline   = (string)Session["Company_id_inline_rpt"];
            string zone_id_inline      = (string)Session["zone_id_inline_rpt"];
            string report_header       = " รายงานลูกหนี้คงเหลือ ";

            bool chk_all = false;

            if (leasing_Code_inline == "" && Company_id_inline == "" && zone_id_inline == "")
            {
                report_header = " รายงานลูกหนี้คงเหลือ (ทั้งหมด)";

                chk_all = true;
            }

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

            MySqlConnection con = MySQLConnection.connectionMySQL();

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

                cmd.Parameters.AddWithValue("@i_Deps_no", deposit_no);
                cmd.Parameters.AddWithValue("@i_Leasing_no", leasing_no);
                cmd.Parameters.AddWithValue("@i_Cust_idcard", idcard);
                cmd.Parameters.AddWithValue("@i_Cust_Fname", fname);
                cmd.Parameters.AddWithValue("@i_Cust_LName", lname);
                cmd.Parameters.AddWithValue("@i_Leasing_date_str", "");
                cmd.Parameters.AddWithValue("@i_Leasing_date_end", "");
                cmd.Parameters.AddWithValue("@i_Leasing_code_id", leasing_Code_inline);
                cmd.Parameters.AddWithValue("@i_Company_id", Company_id_inline);
                cmd.Parameters.AddWithValue("@i_Zone_id", zone_id_inline);
                cmd.Parameters.AddWithValue("@i_lost_str", lost_str);
                cmd.Parameters.AddWithValue("@i_lost_end", lost_end);
                cmd.Parameters.AddWithValue("@i_district", district);
                cmd.Parameters.AddWithValue("@i_province", province);
                cmd.Parameters.AddWithValue("@i_row_str", 0);
                cmd.Parameters.AddWithValue("@i_row_limit", 0);

                MySqlDataReader reader = cmd.ExecuteReader();

                Leasing_Ds ls_ds = new Leasing_Ds();
                ls_ds.Clear();
                ls_ds.Tables["Report_General_Leasings"].Load(reader);

                if (chk_all)
                {
                    Total_Balance_Payment_All rpt = new Total_Balance_Payment_All();
                    rpt.SetDataSource(ls_ds);
                    rpt.SetParameterValue("Reported_By_User", "ออกโดย : " + acc_lgn.Account_F_name);
                    rpt.SetParameterValue("Reported_Print_Date", "วันที่พิมพ์ : " + DateTimeUtility.convertDateTimeToPage(DateTimeUtility._dateTimeNOWForServer()));
                    rpt.SetParameterValue("Report_Header", report_header);


                    CRV_Display_Report.ReportSource = rpt;

                    /// Export Report to PDF File with Save As Mode
                    /// rpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "หน้าการ์ด_" + cls.Deps_no);
                    /// Response.End();

                    ExportReport_Mod_II(rpt);
                }
                else
                {
                    Total_Balance_Payment rpt = new Total_Balance_Payment();
                    rpt.SetDataSource(ls_ds);
                    rpt.SetParameterValue("Reported_By_User", "ออกโดย : " + acc_lgn.Account_F_name);
                    rpt.SetParameterValue("Reported_Print_Date", "วันที่พิมพ์ : " + DateTimeUtility.convertDateTimeToPage(DateTimeUtility._dateTimeNOWForServer()));
                    rpt.SetParameterValue("Report_Header", report_header);


                    CRV_Display_Report.ReportSource = rpt;

                    /// Export Report to PDF File with Save As Mode
                    /// rpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "หน้าการ์ด_" + cls.Deps_no);
                    /// Response.End();

                    ExportReport_Mod_I(rpt);
                }
            }
            catch (MySqlException ex)
            {
                error = "MysqlException ==> Total_Balance_Payment_Export --> _loadReport() ";
                Log_Error._writeErrorFile(error, ex);
            }
            catch (Exception ex)
            {
                error = "Exception ==> Total_Balance_Payment_Export --> _loadReport() ";
                Log_Error._writeErrorFile(error, ex);
            }
            finally
            {
                con.Close();
                con.Dispose();
            }

            /// Acticity Logs System
            ///

            string message = Messages_Logs._messageLogsNormal(acc_lgn.Account_F_name, " ออก" + report_header, 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

            GC.Collect();
        }
        /*******************************************************************************************************************************************************************************
        ****************************************************                               Edit Data Function                    ********************************************************
        ****************************************************                                                                    ********************************************************
        *******************************************************************************************************************************************************************************/

        private void _EditCustomer()
        {
            Customers_Manager ctm_mng = new Customers_Manager();
            Customers         ctm     = new Customers();

            Customers ctm_tmp = (Customers)Session["Customer"];

            ctm.Cust_id             = ctm_tmp.Cust_id;
            ctm.Cust_Idcard         = string.IsNullOrEmpty(Cust_idcard_TBx.Text) ? "" : Cust_idcard_TBx.Text;
            ctm.Cust_Fname          = string.IsNullOrEmpty(Cust_Fname_TBx.Text) ? "" : Cust_Fname_TBx.Text;
            ctm.Cust_LName          = string.IsNullOrEmpty(Cust_LName_TBx.Text) ? "" : Cust_LName_TBx.Text;
            ctm.Cust_B_date         = string.IsNullOrEmpty(Cust_B_date_TBx.Text) ? null : DateTimeUtility.convertDateToMYSQL(Cust_B_date_TBx.Text);
            ctm.Cust_Age            = string.IsNullOrEmpty(Cust_B_date_TBx.Text) ? 0 : DateTime.Now.Year - (Convert.ToInt32(Cust_B_date_TBx.Text.Split('/')[2].ToString()) - 543);
            ctm.Cust_Idcard_without = string.IsNullOrEmpty(Cust_Idcard_without_TBx.Text) ? "" : Cust_Idcard_without_TBx.Text;
            ctm.Cust_Idcard_start   = string.IsNullOrEmpty(Cust_Idcard_start_TBx.Text) ? null : DateTimeUtility.convertDateToMYSQL(Cust_Idcard_start_TBx.Text);
            ctm.Cust_Idcard_expire  = string.IsNullOrEmpty(Cust_Idcard_expire_TBx.Text) ? null : DateTimeUtility.convertDateToMYSQL(Cust_Idcard_expire_TBx.Text);

            ctm.ctm_ntnlt = new Base_Nationalitys();
            ctm.ctm_ntnlt.Nationality_id = Cust_Nationality_DDL.SelectedIndex <= 0 ? 1 : Convert.ToInt32(Cust_Nationality_DDL.SelectedValue);

            ctm.ctm_org           = new Base_Origins();
            ctm.ctm_org.Origin_id = Cust_Origin_DDL.SelectedIndex <= 0 ? 1 : Convert.ToInt32(Cust_Origin_DDL.SelectedValue);

            ctm.Cust_Tel             = string.IsNullOrEmpty(Cust_Tel_TBx.Text) ? "" : Cust_Tel_TBx.Text;
            ctm.Cust_Email           = string.IsNullOrEmpty(Cust_Email_TBx.Text) ? "" : Cust_Email_TBx.Text;
            ctm.Cust_Job             = string.IsNullOrEmpty(Cust_job_TBx.Text) ? "" : Cust_job_TBx.Text;
            ctm.Cust_Job_position    = string.IsNullOrEmpty(Cust_job_position_TBx.Text) ? "" : Cust_job_position_TBx.Text;
            ctm.Cust_Job_long        = string.IsNullOrEmpty(Cust_job_long_TBx.Text) ? 0 : Convert.ToInt32(Cust_job_long_TBx.Text);
            ctm.Cust_Job_local_name  = string.IsNullOrEmpty(Cust_job_local_name_TBx.Text) ? "" : Cust_job_local_name_TBx.Text;
            ctm.Cust_Job_address_no  = string.IsNullOrEmpty(Cust_job_address_no_TBx.Text) ? "" : Cust_job_address_no_TBx.Text;
            ctm.Cust_Job_vilage      = string.IsNullOrEmpty(Cust_job_vilage_TBx.Text) ? "บ.-" : "บ." + Cust_job_vilage_TBx.Text;
            ctm.Cust_Job_vilage_no   = string.IsNullOrEmpty(Cust_job_vilage_no_TBx.Text) ? "ม.-." : "ม." + Cust_job_vilage_no_TBx.Text;
            ctm.Cust_Job_alley       = string.IsNullOrEmpty(Cust_job_alley_TBx.Text) ? "ซ.-" : "ซ." + Cust_job_alley_TBx.Text;
            ctm.Cust_Job_road        = string.IsNullOrEmpty(Cust_job_road_TBx.Text) ? "ถ.-" : "ถ." + Cust_job_road_TBx.Text;
            ctm.Cust_Job_subdistrict = string.IsNullOrEmpty(Cust_job_subdistrict_TBx.Text) ? "ต.-" : "ต." + Cust_job_subdistrict_TBx.Text;
            ctm.Cust_Job_district    = string.IsNullOrEmpty(Cust_job_district_TBx.Text) ? "อ.-" : "อ." + Cust_job_district_TBx.Text;
            ctm.Cust_Job_province    = Cust_job_province_DDL.SelectedIndex <= 0 ? "จ.-" : "จ." + Cust_job_province_DDL.SelectedItem.Text;
            ctm.Cust_Job_country     = string.IsNullOrEmpty(Cust_job_contry_TBx.Text) ? "" : Cust_job_contry_TBx.Text;
            ctm.Cust_Job_zipcode     = string.IsNullOrEmpty(Cust_job_zipcode_TBx.Text) ? "" : Cust_job_zipcode_TBx.Text;
            ctm.Cust_Job_tel         = string.IsNullOrEmpty(Cust_job_tel_TBx.Text) ? "" : Cust_job_tel_TBx.Text;
            ctm.Cust_Job_email       = string.IsNullOrEmpty(Cust_job_email_TBx.Text) ? "" : Cust_job_email_TBx.Text;
            ctm.Cust_Job_salary      = string.IsNullOrEmpty(Cust_job_salary_TBx.Text) ? 0 : Convert.ToDouble(Cust_job_salary_TBx.Text);

            ctm.ctm_pstt = new Base_Person_Status();
            ctm.ctm_pstt.person_status_id = Cust_status_DDL.SelectedIndex <= 0 ? 1 : Convert.ToInt32(Cust_status_DDL.SelectedValue);

            ctm.Cust_Marry_idcard = string.IsNullOrEmpty(Marry_idcard_TBx.Text) ? "" : Marry_idcard_TBx.Text;
            ctm.Cust_Marry_Fname  = string.IsNullOrEmpty(Marry_Fname_TBx.Text) ? "" : Marry_Fname_TBx.Text;
            ctm.Cust_Marry_Lname  = string.IsNullOrEmpty(Marry_Lname_TBx.Text) ? "" : Marry_Lname_TBx.Text;

            ctm.ctm_marry_ntnlt = new Base_Nationalitys();
            ctm.ctm_marry_ntnlt.Nationality_id = Marry_Nationality_DDL.SelectedIndex <= 0 ? 1 : Convert.ToInt32(Marry_Nationality_DDL.SelectedValue);

            ctm.ctm_marry_org           = new Base_Origins();
            ctm.ctm_marry_org.Origin_id = Marry_Origin_DDL.SelectedIndex <= 0 ? 1 : Convert.ToInt32(Marry_Origin_DDL.SelectedValue);

            ctm.Cust_Marry_Address_no  = string.IsNullOrEmpty(Marry_address_no_TBx.Text) ? "" : Marry_address_no_TBx.Text;
            ctm.Cust_Marry_vilage      = string.IsNullOrEmpty(Marry_vilage_TBx.Text) ? "บ.-" : "บ." + Marry_vilage_TBx.Text;
            ctm.Cust_Marry_vilage_no   = string.IsNullOrEmpty(Marry_vilage_no_TBx.Text) ? "ม.-" : "ม." + Marry_vilage_no_TBx.Text;
            ctm.Cust_Marry_alley       = string.IsNullOrEmpty(Marry_alley_TBx.Text) ? "ซ.-" : "ซ." + Marry_alley_TBx.Text;
            ctm.Cust_Marry_road        = string.IsNullOrEmpty(Marry_road_TBx.Text) ? "ถ.-" : "ถ." + Marry_road_TBx.Text;
            ctm.Cust_Marry_subdistrict = string.IsNullOrEmpty(Marry_subdistrict_TBx.Text) ? "ต.-" : "ต." + Marry_subdistrict_TBx.Text;
            ctm.Cust_Marry_district    = string.IsNullOrEmpty(Marry_district_TBx.Text) ? "อ.-" : "อ." + Marry_district_TBx.Text;
            ctm.Cust_Marry_province    = Marry_province_DDL.SelectedIndex <= 0 ? "จ.-" : "จ." + Marry_province_DDL.SelectedItem.Text;
            ctm.Cust_Marry_country     = string.IsNullOrEmpty(Marry_country_TBx.Text) ? "" : Marry_country_TBx.Text;
            ctm.Cust_Marry_zipcode     = string.IsNullOrEmpty(Marry_zipcode_TBx.Text) ? "" : Marry_zipcode_TBx.Text;

            ctm.Cust_Marry_job             = string.IsNullOrEmpty(Marry_job_TBx.Text) ? "" : Marry_job_TBx.Text;
            ctm.Cust_Marry_job_position    = string.IsNullOrEmpty(Marry_job_position_TBx.Text) ? "" : Marry_job_position_TBx.Text;
            ctm.Cust_Marry_job_long        = string.IsNullOrEmpty(Marry_job_long_TBx.Text) ? 0 : Convert.ToInt32(Marry_job_long_TBx.Text);
            ctm.Cust_Marry_job_salary      = string.IsNullOrEmpty(Marry_job_salary_TBx.Text) ? 0 : Convert.ToDouble(Marry_job_salary_TBx.Text);
            ctm.Cust_Marry_job_local_name  = string.IsNullOrEmpty(Marry_job_local_name_TBx.Text) ? "" : Marry_job_local_name_TBx.Text;
            ctm.Cust_Marry_job_address_no  = string.IsNullOrEmpty(Marry_job_address_no_TBx.Text) ? "" : Marry_job_address_no_TBx.Text;
            ctm.Cust_Marry_job_vilage      = string.IsNullOrEmpty(Marry_job_vilage_TBx.Text) ? "บ.-" : "บ." + Marry_job_vilage_TBx.Text;
            ctm.Cust_Marry_job_vilage_no   = string.IsNullOrEmpty(Marry_job_vilage_no_TBx.Text) ? "ม.-" : "ม." + Marry_job_vilage_no_TBx.Text;
            ctm.Cust_Marry_job_alley       = string.IsNullOrEmpty(Marry_job_alley_TBx.Text) ? "ซ.-" : "ซ." + Marry_job_alley_TBx.Text;
            ctm.Cust_Marry_job_road        = string.IsNullOrEmpty(Marry_job_road_TBx.Text) ? "ถ.-" : "ถ." + Marry_job_road_TBx.Text;
            ctm.Cust_Marry_job_subdistrict = string.IsNullOrEmpty(Marry_job_subdistrict_TBx.Text) ? "ต.-" : "ต." + Marry_job_subdistrict_TBx.Text;
            ctm.Cust_Marry_job_district    = string.IsNullOrEmpty(Marry_job_district_TBx.Text) ? "อ.-" : "อ." + Marry_job_district_TBx.Text;
            ctm.Cust_Marry_job_province    = Marry_job_province_DDL.SelectedIndex <= 0 ? "จ.-" : "จ." + Marry_job_province_DDL.SelectedItem.Text;
            ctm.Cust_Marry_job_country     = string.IsNullOrEmpty(Marry_job_country_TBx.Text) ? "" : Marry_job_country_TBx.Text;
            ctm.Cust_Marry_job_zipcode     = string.IsNullOrEmpty(Marry_job_zipcode_TBx.Text) ? "" : Marry_job_zipcode_TBx.Text;
            ctm.Cust_Marry_job_tel         = string.IsNullOrEmpty(Marry_job_tel_TBx.Text) ? "" : Marry_job_tel_TBx.Text;
            ctm.Cust_Marry_tel             = string.IsNullOrEmpty(Marry_tel_TBx.Text) ? "" : Marry_tel_TBx.Text;
            ctm.Cust_Marry_email           = string.IsNullOrEmpty(Marry_email_TBx.Text) ? "" : Marry_email_TBx.Text;

            ctm.Cust_Home_address_no  = string.IsNullOrEmpty(Home_Cust_Address_no_TBx.Text) ? "" : Home_Cust_Address_no_TBx.Text;
            ctm.Cust_Home_vilage      = string.IsNullOrEmpty(Home_Cust_Vilage_TBx.Text) ? "บ.-" : "บ." + Home_Cust_Vilage_TBx.Text;
            ctm.Cust_Home_vilage_no   = string.IsNullOrEmpty(Home_Cust_Vilage_no_TBx.Text) ? "ม.-" : "ม." + Home_Cust_Vilage_no_TBx.Text;
            ctm.Cust_Home_alley       = string.IsNullOrEmpty(Home_Cust_Alley_TBx.Text) ? "ซ.-" : "ซ." + Home_Cust_Alley_TBx.Text;
            ctm.Cust_Home_road        = string.IsNullOrEmpty(Home_Cust_Road_TBx.Text) ? "ถ.-" : "ถ." + Home_Cust_Road_TBx.Text;
            ctm.Cust_Home_subdistrict = string.IsNullOrEmpty(Home_Cust_Subdistrict_TBx.Text) ? "ต.-" : "ต." + Home_Cust_Subdistrict_TBx.Text;
            ctm.Cust_Home_district    = string.IsNullOrEmpty(Home_Cust_District_TBx.Text) ? "อ.-" : "อ." + Home_Cust_District_TBx.Text;
            ctm.Cust_Home_province    = Home_Cust_Province_DDL.SelectedIndex <= 0 ? "จ.-" : "จ." + Home_Cust_Province_DDL.SelectedItem.Text;
            ctm.Cust_Home_country     = string.IsNullOrEmpty(Home_Cust_Country_TBx.Text) ? "" : Home_Cust_Country_TBx.Text;
            ctm.Cust_Home_zipcode     = string.IsNullOrEmpty(Home_Cust_Zipcode_TBx.Text) ? "" : Home_Cust_Zipcode_TBx.Text;
            ctm.Cust_Home_tel         = string.IsNullOrEmpty(Home_Cust_Tel_TBx.Text) ? "" : Home_Cust_Tel_TBx.Text;

            ctm.ctm_home_stt = new Base_Home_Status();
            ctm.ctm_home_stt.Home_status_id = Home_Cust_Home_status_id_DDL.SelectedIndex <= 0 ? 1 : Convert.ToInt32(Home_Cust_Home_status_id_DDL.SelectedValue);

            ctm.Cust_Home_GPS_Latitude  = string.IsNullOrEmpty(Home_Cust_Gps_Latitude_TBx.Text) ? "" : Home_Cust_Gps_Latitude_TBx.Text;
            ctm.Cust_Home_GPS_Longitude = string.IsNullOrEmpty(Home_Cust_Gps_Longitude_TBx.Text) ? "" : Home_Cust_Gps_Longitude_TBx.Text;

            ctm.Cust_Idcard_address_no  = string.IsNullOrEmpty(Idcard_Cust_Address_no_TBx.Text) ? "" : Idcard_Cust_Address_no_TBx.Text;
            ctm.Cust_Idcard_vilage      = string.IsNullOrEmpty(Idcard_Cust_Vilage_TBx.Text) ? "บ.-" : "บ." + Idcard_Cust_Vilage_TBx.Text;
            ctm.Cust_Idcard_vilage_no   = string.IsNullOrEmpty(Idcard_Cust_Vilage_no_TBx.Text) ? "ม.-" : "ม." + Idcard_Cust_Vilage_no_TBx.Text;
            ctm.Cust_Idcard_alley       = string.IsNullOrEmpty(Idcard_Cust_Alley_TBx.Text) ? "ซ.-" : "ซ." + Idcard_Cust_Alley_TBx.Text;
            ctm.Cust_Idcard_road        = string.IsNullOrEmpty(Idcard_Cust_Road_TBx.Text) ? "ถ.-" : "ถ." + Idcard_Cust_Road_TBx.Text;
            ctm.Cust_Idcard_subdistrict = string.IsNullOrEmpty(Idcard_Cust_Subdistrict_TBx.Text) ? "ต.-" : "ต." + Idcard_Cust_Subdistrict_TBx.Text;
            ctm.Cust_Idcard_district    = string.IsNullOrEmpty(Idcard_Cust_District_TBx.Text) ? "อ.-" : "อ." + Idcard_Cust_District_TBx.Text;
            ctm.Cust_Idcard_province    = Idcard_Cust_Province_DDL.SelectedIndex <= 0 ? "จ.-" : "จ." + Idcard_Cust_Province_DDL.SelectedItem.Text;
            ctm.Cust_Idcard_country     = string.IsNullOrEmpty(Idcard_Cust_Country_TBx.Text) ? "" : Idcard_Cust_Country_TBx.Text;
            ctm.Cust_Idcard_zipcode     = string.IsNullOrEmpty(Idcard_Cust_Zipcode_TBx.Text) ? "" : Idcard_Cust_Zipcode_TBx.Text;
            ctm.Cust_Idcard_tel         = string.IsNullOrEmpty(Idcard_Cust_Tel_TBx.Text) ? "" : Idcard_Cust_Tel_TBx.Text;

            ctm.ctm_idcard_stt = new Base_Home_Status();
            ctm.ctm_idcard_stt.Home_status_id = Idcard_Cust_Home_status_DDL.SelectedIndex <= 0 ? 1 : Convert.ToInt32(Idcard_Cust_Home_status_DDL.SelectedValue);

            ctm.Cust_Current_address_no  = string.IsNullOrEmpty(Current_Cust_Address_no_TBx.Text) ? "" : Current_Cust_Address_no_TBx.Text;
            ctm.Cust_Current_vilage      = string.IsNullOrEmpty(Current_Cust_Vilage_TBx.Text) ? "บ.-" : "บ." + Current_Cust_Vilage_TBx.Text;
            ctm.Cust_Current_vilage_no   = string.IsNullOrEmpty(Current_Cust_Vilage_no_TBx.Text) ? "ม.-" : "ม." + Current_Cust_Vilage_no_TBx.Text;
            ctm.Cust_Current_alley       = string.IsNullOrEmpty(Current_Cust_Alley_TBx.Text) ? "ซ.-" : "ซ." + Current_Cust_Alley_TBx.Text;
            ctm.Cust_Current_road        = string.IsNullOrEmpty(Current_Cust_Road_TBx.Text) ? "ถ.-" : "ถ." + Current_Cust_Road_TBx.Text;
            ctm.Cust_Current_subdistrict = string.IsNullOrEmpty(Current_Cust_Subdistrict_TBx.Text) ? "ต.-" : "ต." + Current_Cust_Subdistrict_TBx.Text;
            ctm.Cust_Current_district    = string.IsNullOrEmpty(Current_Cust_District_TBx.Text) ? "อ.-" : "อ." + Current_Cust_District_TBx.Text;
            ctm.Cust_Current_province    = Current_Cust_Province_DDL.SelectedIndex <= 0 ? "จ.-" : "จ." + Current_Cust_Province_DDL.SelectedItem.Text;
            ctm.Cust_Current_country     = string.IsNullOrEmpty(Current_Cust_Country_TBx.Text) ? "" : Current_Cust_Country_TBx.Text;
            ctm.Cust_Current_zipcode     = string.IsNullOrEmpty(Current_Cust_Zipcode_TBx.Text) ? "" : Current_Cust_Zipcode_TBx.Text;
            ctm.Cust_Current_tel         = string.IsNullOrEmpty(Current_Cust_Tel_TBx.Text) ? "" : Current_Cust_Tel_TBx.Text;

            ctm.ctm_current_stt = new Base_Home_Status();
            ctm.ctm_current_stt.Home_status_id = Current_Cust_Home_status_id_DDL.SelectedIndex <= 0 ? 1 : Convert.ToInt32(Current_Cust_Home_status_id_DDL.SelectedValue);

            Session["Customer"] = ctm;

            if (ctm_mng.editCustomers(ctm))
            {
                /// 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

                Session.Remove("chk_customer");

                Session["Class_Active_Customer"] = 2;
                Response.Redirect("/Form_Customer/Customer_Home_Photo");
            }
            else
            {
                Alert_Danger_Panel.Visible   = true;
                alert_header_danger_Lbl.Text = "แจ้งเตือน!!";
                alert_danger_Lbl.Text        = "กรุณาตรวจสอบ ข้อมูลอีกครั้ง";

                Alert_Danger_Panel.Focus();
            }
        }
        private void _loadReport_mod_I()
        {
            string month               = (string)Session["month"];
            string year                = (string)Session["year"];
            string Company_id_inline   = (string)Session["Company_id_inline_rpt"];
            string leasing_Code_inline = (string)Session["leasing_Code_inline_rpt"];
            string zone_id_inline      = (string)Session["zone_id_inline_rpt"];

            string report_header = "รายงานการชำระเงิน 1 ประจำเดือน " + DateTimeUtility.convertMonthToThai(month) + " " + (Convert.ToInt32(year) + 543);

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

            MySqlConnection con = MySQLConnection.connectionMySQL();

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

                cmd.Parameters.AddWithValue("@i_month", month);
                cmd.Parameters.AddWithValue("@i_year", year);
                cmd.Parameters.AddWithValue("@i_Leasing_code_id", leasing_Code_inline);
                cmd.Parameters.AddWithValue("@i_Company_id", Company_id_inline);
                cmd.Parameters.AddWithValue("@i_Zone_id", zone_id_inline);
                cmd.Parameters.AddWithValue("@i_row_str", 0);
                cmd.Parameters.AddWithValue("@i_row_limit", 0);

                MySqlDataReader reader = cmd.ExecuteReader();

                Leasing_Ds ls_ds = new Leasing_Ds();
                ls_ds.Clear();
                ls_ds.Tables["Report_Payments"].Load(reader);

                Payment_Summary_Monthly_mod_I_001 rpt = new Payment_Summary_Monthly_mod_I_001();
                rpt.SetDataSource(ls_ds);
                rpt.SetParameterValue("Reported_By_User", "ออกโดย : " + acc_lgn.Account_F_name);
                rpt.SetParameterValue("Reported_Print_Date", "วันที่พิมพ์ : " + DateTimeUtility.convertDateTimeToPage(DateTimeUtility._dateTimeNOWForServer()));
                rpt.SetParameterValue("Report_Header", report_header);


                CRV_Display_Report.ReportSource = rpt;

                /// Export Report to PDF File with Save As Mode
                /// rpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "หน้าการ์ด_" + cls.Deps_no);
                /// Response.End();

                ExportReport_Mod_I(rpt);
            }
            catch (MySqlException ex)
            {
                error = "MysqlException ==> Payment_Summary_Monthly_Export --> _loadReport_mod_I() ";
                Log_Error._writeErrorFile(error, ex);
            }
            catch (Exception ex)
            {
                error = "Exception ==> Payment_Summary_Monthly_Export --> _loadReport_mod_I() ";
                Log_Error._writeErrorFile(error, ex);
            }
            finally
            {
                con.Close();
                con.Dispose();
            }

            /// Acticity Logs System
            ///

            string message = Messages_Logs._messageLogsNormal(acc_lgn.Account_F_name, " ออก" + report_header, 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

            GC.Collect();
        }