protected void Page_Load(object sender, EventArgs e) { if (IsPostBack == false) { if (Request["id"] != null) { ErmTsPersonalInfoPara p = new ErmTsPersonalInfoPara(); RegisterENG eng = new RegisterENG(); p = eng.GetRegisterInfo(Convert.ToInt64(Request["id"])); eng=null; if (p.ID>0){ if (p.MIDDLE_NAME.Trim() != "") lblName.Text = p.FIRST_NAME + " " + p.MIDDLE_NAME + " " + p.LAST_NAME; else lblName.Text = p.FIRST_NAME + " " + p.LAST_NAME; lblID.Text = "*" + p.ID.ToString().PadLeft(4, '0') + "*"; lblName2.Text = p.FIRST_NAME + " " + p.LAST_NAME; lblPosition.Text =p.POSITION_NAME; lblDivision.Text =p.DIVISION; lblCompany.Text =p.COMPANY_NAME; lblProvince.Text = p.CITY; lblMobileNumber.Text = p.MOBILE_NO; } p = null; } } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack == false) { if (Request["id"] != null) { ErmTsPersonalInfoPara p = new ErmTsPersonalInfoPara(); RegisterENG eng = new RegisterENG(); p = eng.GetRegisterInfo(Convert.ToInt64(Request["id"])); eng=null; if (p.ID>0){ if (p.MIDDLE_NAME.Trim() != "") lblName.Text = p.FIRST_NAME + " " + p.MIDDLE_NAME + " " + p.LAST_NAME; else lblName.Text = p.FIRST_NAME + " " + p.LAST_NAME; lblID.Text = p.ID.ToString().PadLeft(6, '0'); } p = null; } } }
protected bool SaveDetail(CheckBox chk, long id, TransactionDB Trans ,string str,string section) { bool ret =false; if (chk.Checked == true){ string InteresCode = chk.Text.Substring(0,2); string InteresName = chk.Text.Substring(3); ErmTsInterestPara Erm = new ErmTsInterestPara(); Erm.ERM_TS_PERSONAL_INFO_ID = id; Erm.INTEREST_CODE = section + InteresCode; if (str != "") {InteresName=InteresName + "##" + str;} Erm.INTEREST_NAME = InteresName; Engine.Questionnaire.RegisterENG eng = new Engine.Questionnaire.RegisterENG(); ret= eng.SaveInterest(Erm, "Register", Trans); } return ret; }
protected void btnSave_Click(object sender, EventArgs e) { if (validate() == false) return; String strServerName = ConfigurationManager.AppSettings["ServerName"]; String strDbName = ConfigurationManager.AppSettings["DbName"]; String strDbUserID = ConfigurationManager.AppSettings["DbUserID"]; String strDbPwd = ConfigurationManager.AppSettings["DbPwd"]; SqlConnection objConn = new SqlConnection("Data Source=" + strServerName +";Initial Catalog=" + strDbName +";User ID=" +strDbUserID + ";password="******"0") { String strSql = ""; strSql = "Select Count(*) From ERM_TS_Personal_info Where first_name='" + txtFirstName.Text + "' And last_name='" + txtLastName.Text + "'"; SqlCommand objCmd = new SqlCommand(strSql, objConn); String Result = Convert.ToString(objCmd.ExecuteScalar()); if (Result != "0") { Config.SetAlert("ชื่อนี้ได้ทำการลงทะเบียนแล้ว", this); return; } strSql = "Select Count(*) From ERM_TS_Personal_info Where Email='" + txtEmail.Text + "' "; objCmd = new SqlCommand(strSql, objConn); Result = Convert.ToString(objCmd.ExecuteScalar()); if (Result != "0") { Config.SetAlert("อีเมลล์นี้ได้ทำการลงทะเบียนแล้ว", this); return; } strSql = "Select Count(*) From ERM_TS_Personal_info Where Mobile_No='" + txtMobileNo.Text + "' "; objCmd = new SqlCommand(strSql, objConn); Result = Convert.ToString(objCmd.ExecuteScalar()); if (Result != "0") { Config.SetAlert("เบอร์โทรนี้ได้ทำการลงทะเบียนแล้ว", this); return; } } int intChkA = 0; int intChkB = 0; int intChkC = 0; int intChkD = 0; int intChkE = 0; if ((rdPeriod.Items[0].Selected == false) && (rdPeriod.Items[1].Selected == false)) { Config.SetAlert("กรุณาเลือกช่วงเวลาเข้าร่วมงาน", this); return; } if (ChkA01.Checked == true) { intChkA += 1; } if (ChkA02.Checked == true) { intChkA += 1; } if (ChkA03.Checked == true) { intChkA += 1; } if (ChkA04.Checked == true) { intChkA += 1; } if (ChkA05.Checked == true) { intChkA += 1; } if (ChkA06.Checked == true) { intChkA += 1; } if (ChkA07.Checked == true) { intChkA += 1; } if (ChkA08.Checked == true) { intChkA += 1; } if (ChkA09.Checked == true) { intChkA += 1; } if (ChkA10.Checked == true) { intChkA += 1; } if (ChkA11.Checked == true) { intChkA += 1; } if (ChkA12.Checked == true) { intChkA += 1; } if (ChkA13.Checked == true) { intChkA += 1; } if (ChkA14.Checked == true) { intChkA += 1; } if (ChkA15.Checked == true) { intChkA += 1; } if (ChkA16.Checked == true) { intChkA += 1; } if (ChkA17.Checked == true) { intChkA += 1; } if (ChkB01.Checked == true) { intChkB += 1; } if (ChkB02.Checked == true) { intChkB += 1; } if (ChkB03.Checked == true) { intChkB += 1; } if (ChkB04.Checked == true) { intChkB += 1; } if (ChkB05.Checked == true) { intChkB += 1; } if (ChkB06.Checked == true) { intChkB += 1; } if (ChkB07.Checked == true) { intChkB += 1; } if (ChkB08.Checked == true) { intChkB += 1; } if (ChkB09.Checked == true) { intChkB += 1; } if (ChkB10.Checked == true) { intChkB += 1; } if (ChkB11.Checked == true) { intChkB += 1; } if (ChkB12.Checked == true) { intChkB += 1; } if (ChkB13.Checked == true) { intChkB += 1; } if (ChkB14.Checked == true) { intChkB += 1; } if (ChkC01.Checked == true) { intChkC += 1; } if (ChkC02.Checked == true) { intChkC += 1; } if (ChkC03.Checked == true) { intChkC += 1; } if (ChkC04.Checked == true) { intChkC += 1; } if (ChkC05.Checked == true) { intChkC += 1; } if (ChkC06.Checked == true) { intChkC += 1; } if (ChkC07.Checked == true) { intChkC += 1; } if (ChkD01.Checked == true) { intChkD += 1; } if (ChkD02.Checked == true) { intChkD += 1; } if (ChkE01.Checked == true) { intChkE += 1; } if (ChkE02.Checked == true) { intChkE += 1; } if (ChkE03.Checked == true) { intChkE += 1; } if (ChkE04.Checked == true) { intChkE += 1; } if (ChkE05.Checked == true) { intChkE += 1; } if (ChkE06.Checked == true) { intChkE += 1; } if (ChkE07.Checked == true) { intChkE += 1; } if (ChkE08.Checked == true) { intChkE += 1; } if (ChkE09.Checked == true) { intChkE += 1; } if (ChkE10.Checked == true) { intChkE += 1; } if (ChkE11.Checked == true) { intChkE += 1; } if (ChkE12.Checked == true) { intChkE += 1; } if (ChkE13.Checked == true) { intChkE += 1; } if (ChkE14.Checked == true) { intChkE += 1; } if (ChkE15.Checked == true) { intChkE += 1; } if (ChkE16.Checked == true) { intChkE += 1; } if (ChkE17.Checked == true) { intChkE += 1; } if (ChkE18.Checked == true) { intChkE += 1; } if (ChkE19.Checked == true) { intChkE += 1; } if (intChkA == 0) { Config.SetAlert("กรุณาระบุประเภทธุรกิจของท่าน", this); return; } if (intChkB == 0) { Config.SetAlert("กรุณาระบุช่องทางการได้รับข่าวสาร", this); return; } if (intChkC == 0) { Config.SetAlert("กรุณาระบุวัตถุประสงค์ของการเข้าชมงาน", this); return; } if (intChkD == 0) { Config.SetAlert("กรุณาระบุความต้องการการเข้าชม", this); return; } if (intChkE == 0) { Config.SetAlert("กรุณาระบุประเภทสินค้าหรือบริการที่ท่านสนใจ", this); return; } //Page.Form.DefaultFocus = txtFirstName.ClientID; ErmTsPersonalInfoPara Erm = new ErmTsPersonalInfoPara(); if (lblid.Text != "0") { Erm.ID = Convert.ToInt64(lblid.Text); } Erm.IDCARD_NO = "0"; //txtIDCardNo.Text; Erm.TITLE_NAME = rdiTitle.SelectedValue; if (rdiTitle.SelectedValue == "OTHERS") { Erm.TITLE_NAME = txtTitleOthers.Text; } Erm.FIRST_NAME = txtFirstName.Text; Erm.MIDDLE_NAME = "";// txtMiddleName.Text; Erm.LAST_NAME = txtLastName.Text; Erm.POSITION_NAME = txtPosition.Text; Erm.COMPANY_NAME = txtCompany.Text; Erm.ADDRESS = txtAddress.Text; Erm.CITY = txtCity.Text; Erm.STATE = "";//txtState.Text; Erm.COUNTRY = txtCountry.Text; Erm.ZIPCODE = txtZipCode.Text; Erm.TELNO = txtTelNumber.Text; Erm.FAXNO = txtFaxNumber.Text; Erm.EMAIL = txtEmail.Text; Erm.WEBSITE = txtWebSite.Text; Erm.DIVISION = txtDivition.Text; Erm.MOBILE_NO = txtMobileNo.Text; if ((rdPeriod.Items[0].Selected == true) && (rdPeriod.Items[1].Selected == true)) { Erm.REGISPERIOD = "3"; } else { Erm.REGISPERIOD = rdPeriod.SelectedValue; } // if (txtRegisteredCapital.Text != "") Erm.REGISTERED_CAPITAL = 0;//Convert.ToDouble(txtRegisteredCapital.Text); Erm.ANNUAL_SALE_VALUE_YEAR = DateTime.Today.Year; Erm.ANNUAL_SALE_VALUE_VOLUMNS = rdAnnualSale.SelectedValue; TransactionDB Trans = new TransactionDB(); Engine.Questionnaire.RegisterENG eng = new Engine.Questionnaire.RegisterENG(); long id; id = eng.SavePersonalInfo(Erm, "Register", Trans); if (id > 0) { bool IsDel = true; IsDel = eng.DeleteInterest(id, Trans); if (IsDel == false) { Trans.RollbackTransaction(); ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('ไม่สามารถบันทึกข้อมูลได้');", true); return; } SaveDetail(ChkA01, id, Trans,"","A"); SaveDetail(ChkA02, id, Trans, "", "A"); SaveDetail(ChkA03, id, Trans, "", "A"); SaveDetail(ChkA04, id, Trans, "", "A"); SaveDetail(ChkA05, id, Trans, "", "A"); SaveDetail(ChkA06, id, Trans, "", "A"); SaveDetail(ChkA07, id, Trans, "", "A"); SaveDetail(ChkA08, id, Trans, "", "A"); SaveDetail(ChkA09, id, Trans, "", "A"); SaveDetail(ChkA10, id, Trans, txtA10.Text, "A"); SaveDetail(ChkA11, id, Trans, "", "A"); SaveDetail(ChkA12, id, Trans, "", "A"); SaveDetail(ChkA13, id, Trans, "", "A"); SaveDetail(ChkA14, id, Trans, "", "A"); SaveDetail(ChkA15, id, Trans, "", "A"); SaveDetail(ChkA16, id, Trans, "", "A"); SaveDetail(ChkA17, id, Trans, txtA17.Text, "A"); SaveDetail(ChkB01, id, Trans, "", "B"); SaveDetail(ChkB02, id, Trans, "", "B"); SaveDetail(ChkB03, id, Trans, "", "B"); SaveDetail(ChkB04, id, Trans, txtB04.Text, "B"); SaveDetail(ChkB05, id, Trans, txtB05.Text, "B"); SaveDetail(ChkB06, id, Trans, txtB06.Text, "B"); SaveDetail(ChkB07, id, Trans, "", "B"); SaveDetail(ChkB08, id, Trans, "", "B"); SaveDetail(ChkB09, id, Trans, "", "B"); SaveDetail(ChkB10, id, Trans, "", "B"); SaveDetail(ChkB11, id, Trans, "", "B"); SaveDetail(ChkB12, id, Trans, "", "B"); SaveDetail(ChkB13, id, Trans, "", "B"); SaveDetail(ChkB14, id, Trans, txtB14.Text, "B"); SaveDetail(ChkC01, id, Trans, "", "C"); SaveDetail(ChkC02, id, Trans, "", "C"); SaveDetail(ChkC03, id, Trans, "", "C"); SaveDetail(ChkC04, id, Trans, "", "C"); SaveDetail(ChkC05, id, Trans, "", "C"); SaveDetail(ChkC06, id, Trans, "", "C"); SaveDetail(ChkC07, id, Trans, txtC07.Text, "C"); SaveDetail(ChkD01, id, Trans, "", "D"); SaveDetail(ChkD02, id, Trans, txtD02.Text, "D"); SaveDetail(ChkE01, id, Trans, "", "E"); SaveDetail(ChkE02, id, Trans, "", "E"); SaveDetail(ChkE03, id, Trans, "", "E"); SaveDetail(ChkE04, id, Trans, "", "E"); SaveDetail(ChkE05, id, Trans, "", "E"); SaveDetail(ChkE06, id, Trans, "", "E"); SaveDetail(ChkE07, id, Trans, "", "E"); SaveDetail(ChkE08, id, Trans, "", "E"); SaveDetail(ChkE09, id, Trans, "", "E"); SaveDetail(ChkE10, id, Trans, "", "E"); SaveDetail(ChkE11, id, Trans, "", "E"); SaveDetail(ChkE12, id, Trans, "", "E"); SaveDetail(ChkE13, id, Trans, "", "E"); SaveDetail(ChkE14, id, Trans, "", "E"); SaveDetail(ChkE15, id, Trans, "", "E"); SaveDetail(ChkE16, id, Trans, "", "E"); SaveDetail(ChkE17, id, Trans, "", "E"); SaveDetail(ChkE18, id, Trans, "", "E"); SaveDetail(ChkE19, id, Trans, "", "E"); Trans.CommitTransaction(); bool ret = false; ret = clsSendMail.SendEmailMessage(txtEmail.Text, "*****@*****.**", "mail.scoresolutions.co.th", "1qaz@WSX", txtFirstName.Text + " " + txtLastName.Text, id.ToString(), Server.MapPath("~/image/PrintAdsTheretrunofRFIDHERO_Resize.jpg"), 25, false, Server.MapPath("~/image/logo.png")); if (ret == false) { ret = clsSendMail.SendEmailMessage(txtEmail.Text, "*****@*****.**", "smtp.live.com", "1qaz@WSX", txtFirstName.Text + " " + txtLastName.Text, id.ToString(), Server.MapPath("~/image/PrintAdsTheretrunofRFIDHERO_Resize.jpg"), 587, true, Server.MapPath("~/image/logo.png")); } if (ret == true) { Trans = new TransactionDB(); if (eng.UpdateIsSendMail(id, "Register", Trans) == true) { Trans.CommitTransaction(); } else { Trans.RollbackTransaction(); } } eng = null; //Response.Redirect("../WebApp/frmRegisterComplete.aspx?id=" + Convert.ToString(id)); //Config.ShowModalDialog("../WebApp/frmRegisterEmailComplete.aspx?id=" +id, this); Config.RedirecPage("../WebApp/frmRegisterEmailComplete.aspx?id=" + id, this); Clear(); } else { Trans.RollbackTransaction(); Config.SetAlert("ไม่สามารถบันทึกข้อมูลได้",this); } }