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(); } }
/******************************************************************************************************************************************************************************* **************************************************** 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(); } }
/******************************************************************************************************************************************************************************* **************************************************** 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(); } }
/******************************************************************************************************************************************************************************* **************************************************** 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(); } }
/******************************************************************************************************************************************************************************* **************************************************** 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(); } }
protected void Save_Btn_Click(object sender, EventArgs e) { string[] code = Request.Params["code"].Split('U'); string leasing_id = code[1]; string bill_no = code[2]; string idcard = (string)Session["ctm_leasing_payment"]; cls = cls_mng.getCarLeasingById(leasing_id); double total_payment_left = string.IsNullOrEmpty(Total_payment_left_TBx.Text) ? 0 : Convert.ToDouble(Total_payment_left_TBx.Text); double period_fine = string.IsNullOrEmpty(Total_payment_fine_TBx.Text) ? 0 : Convert.ToDouble(Total_payment_fine_TBx.Text); double old_period_fee = string.IsNullOrEmpty(Old_Period_fee_TBx.Text) ? 0.00 : Convert.ToDouble(Old_Period_fee_TBx.Text); double old_period_track = string.IsNullOrEmpty(Old_Period_track_TBx.Text) ? 0.00 : Convert.ToDouble(Old_Period_track_TBx.Text); double old_payment = string.IsNullOrEmpty(Old_Real_Payment_TBx.Text) ? 0 : Convert.ToDouble(Old_Real_Payment_TBx.Text); double old_payment_fine = string.IsNullOrEmpty(Old_Real_Payment_Fine_TBx.Text) ? 0 : Convert.ToDouble(Old_Real_Payment_Fine_TBx.Text); double old_discount = string.IsNullOrEmpty(Old_Real_Discount_TBx.Text) ? 0 : Convert.ToDouble(Old_Real_Discount_TBx.Text); double real_period_fee = string.IsNullOrEmpty(Period_fee_TBx.Text) ? 0.00 : Convert.ToDouble(Period_fee_TBx.Text); double real_period_track = string.IsNullOrEmpty(Period_track_TBx.Text) ? 0.00 : Convert.ToDouble(Period_track_TBx.Text); double real_payment = string.IsNullOrEmpty(Real_Payment_TBx.Text) ? 0 : Convert.ToDouble(Real_Payment_TBx.Text); double real_payment_fine = string.IsNullOrEmpty(Real_Payment_Fine_TBx.Text) ? 0 : Convert.ToDouble(Real_Payment_Fine_TBx.Text); double real_discount = string.IsNullOrEmpty(Real_Discount_TBx.Text) ? 0 : Convert.ToDouble(Real_Discount_TBx.Text); cls_pay.Leasing_id = leasing_id; cls_pay.Period_fee = real_period_fee; cls_pay.Period_track = real_period_track; cls_pay.Total_payment_fine = real_payment_fine; cls_pay.Discount = real_discount; cls_pay.Real_payment = real_payment; cls_pay.Real_payment_date = string.IsNullOrEmpty(Payment_Date_TBx.Text) ? DateTimeUtility._dateNOWForServer() : DateTimeUtility.convertDateToMYSQL(Payment_Date_TBx.Text); cls_pay.Bill_no_manual_ref = string.IsNullOrEmpty(Bill_No_Manual_Ref_TBx.Text) ? "" : Bill_No_Manual_Ref_TBx.Text; Base_Companys package_login = new Base_Companys(); Account_Login acc_lgn = new Account_Login(); package_login = (Base_Companys)Session["Package"]; acc_lgn = (Account_Login)Session["Login"]; cls_pay.acc_lgn = new Account_Login(); cls_pay.acc_lgn.Account_id = acc_lgn.Account_id; cls_pay.bs_cpn = new Base_Companys(); cls_pay.bs_cpn.Company_id = (int)Session["old_company"]; if (total_payment_left == 0) { if (real_payment <= 0) { Note_Lbl.Text = "*** ระบุยอดชำระมากกว่า : 0.00 บาท ***"; Real_Payment_TBx.Focus(); } else if (real_payment > old_payment) { Note_Lbl.Text = "*** ยอดชำระเกินกว่ายอดเดิม : " + old_payment.ToString("#,###.00") + " บาท ***"; Real_Payment_TBx.Focus(); } /* else if (period_fine == 0 && old_payment_fine != 0) * { * Note_Lbl.Text = "*** ระบุยอดชำระค่าปรับ : " + old_payment_fine.ToString("#,###.00") + " บาท ***"; * * Real_Payment_Fine_TBx.Focus(); * }*/ else if (old_discount != 0) { Note_Lbl.Text = "*** ระบุยอดส่วนลด : " + old_discount.ToString("#,###.00") + " บาท ***"; Real_Discount_TBx.Focus(); } else { Note_Lbl.Text = ""; if (cls_pay_mng.editPayment(cls_pay, bill_no)) { /// Acticity Logs System /// string message = Messages_Logs._messageLogsNormal(acc_lgn.Account_F_name, " แก้ไขข้อมูลการจ่ายเงิน ในสัญญา : " + cls.Leasing_no + " เลขที่ฝาก : " + cls.Deps_no + " เลขที่ใบเสร็จ : " + bill_no + " จำนวนเงิน [ค่างวด] [ค่าปรับ] [ส่วนลด] : [" + real_payment + "] [" + period_fine + "] [" + real_discount + "] ", 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); Session.Remove("old_company"); Response.Redirect("/Form_Leasings/Leasing_Payment?code=" + CryptographyCode.EncodeTOAddressBar(ogn_code, leasing_id, idcard)); } else { Alert_Danger_Panel.Visible = true; alert_header_danger_Lbl.Text = "แจ้งเตือน!!"; alert_danger_Lbl.Text = "กรุณาตรวจสอบ ข้อมูลอีกครั้ง"; Alert_Danger_Panel.Focus(); } } } else { if (real_payment <= 0) { Note_Lbl.Text = "*** ระบุยอดชำระมากกว่า : 0.00 บาท ***"; Real_Payment_TBx.Focus(); } /*else if(real_payment > total_payment_left && real_payment > 0) * { * Note_Lbl.Text = "*** ยอดชำระเกินกว่ายอดคงค้าง : " + total_payment_left.ToString("#,###.00") + " บาท ***"; * * Real_Payment_TBx.Focus(); * }*/ else if (old_discount == 0 && real_discount != 0) { Note_Lbl.Text = "*** ไม่มียอดส่วนลดกรุณาใส่ 0 ในช่องส่วนลด ***"; Real_Discount_TBx.Focus(); } else { Note_Lbl.Text = ""; if (cls_pay_mng.editPayment(cls_pay, bill_no)) { /// Acticity Logs System /// string message = Messages_Logs._messageLogsNormal(acc_lgn.Account_F_name, " แก้ไขข้อมูลการจ่ายเงิน ในสัญญา : " + cls.Leasing_no + " เลขที่ฝาก : " + cls.Deps_no + " เลขที่ใบเสร็จ : " + bill_no + " จำนวนเงิน [ค่างวด] [ค่าปรับ] [ส่วนลด] : [" + real_payment + "] [" + period_fine + "] [" + real_discount + "] ", 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); Session.Remove("old_company"); Response.Redirect("/Form_Leasings/Leasing_Payment?code=" + CryptographyCode.EncodeTOAddressBar(ogn_code, leasing_id, idcard)); } else { Alert_Danger_Panel.Visible = true; alert_header_danger_Lbl.Text = "แจ้งเตือน!!"; alert_danger_Lbl.Text = "กรุณาตรวจสอบ ข้อมูลอีกครั้ง"; Alert_Danger_Panel.Focus(); } } } }
protected void Payment_Btn_Click(object sender, EventArgs e) { string[] code = Request.Params["code"].Split('U'); string leasing_id = code[1]; string idcard = code[2]; cls = cls_mng.getCarLeasingById(leasing_id); double real_payment = string.IsNullOrEmpty(Real_Payment_TBx.Text) ? 0 : Convert.ToDouble(Real_Payment_TBx.Text); double cal_payment = string.IsNullOrEmpty(Cal_Period_Payment_TBx.Text) ? 0 : Convert.ToDouble(Cal_Period_Payment_TBx.Text); double total_payment_left = string.IsNullOrEmpty(Total_payment_left_TBx.Text) ? 0 : Convert.ToDouble(Total_payment_left_TBx.Text); double period_fine = string.IsNullOrEmpty(Total_payment_fine_TBx.Text) ? 0 : Convert.ToDouble(Total_payment_fine_TBx.Text); double real_payment_fine = string.IsNullOrEmpty(Real_Payment_Fine_TBx.Text) ? 0 : Convert.ToDouble(Real_Payment_Fine_TBx.Text); double discount = string.IsNullOrEmpty(Discount_TBx.Text) ? 0 : Convert.ToDouble(Discount_TBx.Text); double real_discount = string.IsNullOrEmpty(Real_Discount_TBx.Text) ? 0 : Convert.ToDouble(Real_Discount_TBx.Text); double sum_payment_left = total_payment_left; cls_pay.Leasing_id = leasing_id; cls_pay.Period_fee = string.IsNullOrEmpty(Period_free_TBx.Text) ? 0.00 : Convert.ToDouble(Period_free_TBx.Text); cls_pay.Period_track = string.IsNullOrEmpty(Period_track_TBx.Text) ? 0.00 : Convert.ToDouble(Period_track_TBx.Text); cls_pay.Total_payment_fine = Convert.ToDouble(Real_Payment_Fine_TBx.Text); cls_pay.Discount = Convert.ToDouble(Real_Discount_TBx.Text); cls_pay.Real_payment = Convert.ToDouble(Real_Payment_TBx.Text); cls_pay.Real_payment_date = string.IsNullOrEmpty(Payment_Date_TBx.Text) ? DateTimeUtility._dateNOWForServer() : DateTimeUtility.convertDateToMYSQL(Payment_Date_TBx.Text); cls_pay.Bill_no_manual_ref = string.IsNullOrEmpty(Bill_No_Manual_Ref_TBx.Text) ? "" : Bill_No_Manual_Ref_TBx.Text; Base_Companys package_login = new Base_Companys(); Account_Login acc_lgn = new Account_Login(); package_login = (Base_Companys)Session["Package"]; acc_lgn = (Account_Login)Session["Login"]; cls_pay.acc_lgn = new Account_Login(); cls_pay.acc_lgn.Account_id = acc_lgn.Account_id; cls_pay.bs_cpn = new Base_Companys(); cls_pay.bs_cpn.Company_id = package_login.Company_id; bool past_page = false; if (Cal_Status_Lbl.Visible == false) /* กรณีจ่าค่างวดแบบธรรมดา */ { if (real_payment >= sum_payment_left) { if (real_payment <= 0) { Note_Lbl.Text = "*** ระบุยอดชำระมากกว่า : 0.00 บาท ***"; Real_Payment_TBx.Focus(); } /*else if (period_fine > 0 && real_payment_fine != period_fine) * { * Note_Lbl.Text = "*** มียอดค่าปรับค้างชำระจำนวน : " + period_fine.ToString("#,###.00") + " บาท ***"; * * Real_Payment_Fine_TBx.Focus(); * } * else if (period_fine == 0 && real_payment_fine != period_fine) * { * Note_Lbl.Text = "*** ไม่มียอดค่าปรับค้างชำระกรุณาใส่ 0 ในช่องชำระค่าปรับ ***"; * * Real_Payment_Fine_TBx.Focus(); * }*/ else if (discount == 0 && real_discount != 0) { Note_Lbl.Text = "*** ไม่มียอดส่วนลดกรุณาใส่ 0 ในช่องส่วนลด ***"; Real_Payment_Fine_TBx.Focus(); } else if (real_payment > sum_payment_left) { Note_Lbl.Text = "*** ยอดปิดบัญชีจำนวน : " + sum_payment_left.ToString("#,###.00") + " บาท ***"; } else { Note_Lbl.Text = ""; if (!string.IsNullOrEmpty(Bill_No_Manual_Ref_TBx.Text)) { past_page = cls_pay_mng.addPayment_Mod_III(cls_pay, 1); } else { past_page = cls_pay_mng.addPayment(cls_pay, 1); } if (past_page) { /// Acticity Logs System /// string message = Messages_Logs._messageLogsNormal(acc_lgn.Account_F_name, " บันทึกข้อมูลการจ่ายเงิน ในสัญญา : " + cls.Leasing_no + " เลขที่ฝาก : " + cls.Deps_no + " จำนวนเงิน [ค่างวด] [ค่าปรับ] [ส่วนลด] : [" + real_payment + "] [" + period_fine + "] [" + real_discount + "] ", 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 _clearRealPayment(); } else { Alert_Danger_Panel.Visible = true; alert_header_danger_Lbl.Text = "แจ้งเตือน!!"; alert_danger_Lbl.Text = "กรุณาตรวจสอบ ข้อมูลอีกครั้ง"; Alert_Danger_Panel.Focus(); } } } else { if (real_payment <= 0) { Note_Lbl.Text = "*** ระบุยอดชำระมากกว่า : 0.00 บาท ***"; Real_Payment_TBx.Focus(); } /*else if (period_fine > 0 && real_payment_fine > period_fine) * { * Note_Lbl.Text = "*** มียอดค่าปรับค้างชำระจำนวน : " + period_fine.ToString("#,###.00") + " บาท ***"; * * Real_Payment_Fine_TBx.Focus(); * } * else if (period_fine == 0 && real_payment_fine != period_fine) * { * Note_Lbl.Text = "*** ไม่มียอดค่าปรับค้างชำระกรุณาใส่ 0 ในช่องชำระค่าปรับ ***"; * * Real_Payment_Fine_TBx.Focus(); * }*/ else if (discount == 0 && real_discount != 0) { Note_Lbl.Text = "*** ไม่มียอดส่วนลดกรุณาใส่ 0 ในช่องส่วนลด ***"; Real_Payment_Fine_TBx.Focus(); } else { Note_Lbl.Text = ""; if (!string.IsNullOrEmpty(Bill_No_Manual_Ref_TBx.Text)) { past_page = cls_pay_mng.addPayment_Mod_III(cls_pay, 1); } else { past_page = cls_pay_mng.addPayment(cls_pay, 1); } if (past_page) { /// Acticity Logs System /// string message = Messages_Logs._messageLogsNormal(acc_lgn.Account_F_name, " บันทึกข้อมูลการจ่ายเงิน ในสัญญา : " + cls.Leasing_no + " เลขที่ฝาก : " + cls.Deps_no + " จำนวนเงิน [ค่างวด] [ค่าปรับ] [ส่วนลด] : [" + real_payment + "] [" + period_fine + "] [" + real_discount + "] ", 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 _clearRealPayment(); } else { Alert_Danger_Panel.Visible = true; alert_header_danger_Lbl.Text = "แจ้งเตือน!!"; alert_danger_Lbl.Text = "กรุณาตรวจสอบ ข้อมูลอีกครั้ง"; Alert_Danger_Panel.Focus(); } } } _loadLeasingDetails(leasing_id, idcard); } else /* กรณีปิดบัญชี และมีส่วนลด */ { if (real_payment != cal_payment) { Note_Lbl.Text = "*** ไม่สามารถปิดบัญชีได้ เนื่องจาก ยอดชำระไม่ตรงกับที่ระบบคำนวนได้ " + cal_payment.ToString("#,###.00") + " บาท ***"; } /*else if (period_fine > 0 && real_payment_fine != period_fine) * { * Note_Lbl.Text = "*** มียอดค่าปรับค้างชำระจำนวน : " + period_fine.ToString("#,###.00") + " บาท ***"; * * Real_Payment_Fine_TBx.Focus(); * } * else if (period_fine == 0 && real_payment_fine != period_fine) * { * Note_Lbl.Text = "*** ไม่มียอดค่าปรับค้างชำระกรุณาใส่ 0 ในช่องชำระค่าปรับ ***"; * * Real_Payment_Fine_TBx.Focus(); * } * else if (discount == 0 && real_discount != discount) * { * Note_Lbl.Text = "*** ไม่มียอดส่วนลดกรุณาใส่ 0 ในช่องส่วนลด ***"; * * Real_Payment_Fine_TBx.Focus(); * } * else if (discount > 0 && real_discount != discount) * { * Note_Lbl.Text = "*** กรุณมระบุยอดส่วนลดจำนวน : " + discount.ToString("#,###.00") + " บาท ***"; * * Real_Discount_TBx.Focus(); * }*/ else { Note_Lbl.Text = ""; if (!string.IsNullOrEmpty(Bill_No_Manual_Ref_TBx.Text)) { past_page = cls_pay_mng.addPayment_Mod_III(cls_pay, 2); } else { past_page = cls_pay_mng.addPayment(cls_pay, 2); } if (past_page) { /// Acticity Logs System /// string message = Messages_Logs._messageLogsNormal(acc_lgn.Account_F_name, " บันทึกข้อมูลการจ่ายเงินแบบคำนวนการปิดบัญชี ในสัญญา : " + cls.Leasing_no + " เลขที่ฝาก : " + cls.Deps_no + " จำนวนเงิน [ค่างวด] [ค่าปรับ] [ส่วนลด] : [" + real_payment + "] [" + period_fine + "] [" + real_discount + "] ", 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 _clearRealPayment(); _loadLeasingDetails(leasing_id, idcard); } else { Alert_Danger_Panel.Visible = true; alert_header_danger_Lbl.Text = "แจ้งเตือน!!"; alert_danger_Lbl.Text = "กรุณาตรวจสอบ ข้อมูลอีกครั้ง"; Alert_Danger_Panel.Focus(); } } } }