public static void SendMail(PS_PERSON ps) { var fromAddress = new MailAddress("*****@*****.**", "From Name"); var toAddress = new MailAddress(ps.PS_EMAIL, "To Name"); string fromPassword = "******"; string subject = "Your registered successful for this site personnel.rmutto.ac.th"; string body = "<div>ชื่อผู้ใช้ : " + ps.PS_CITIZEN_ID + "</div>" + "<div>รหัสผ่าน : " + ps.PS_PASSWORD + "</div>" + "<div style='border-bottom: 1px solid #c0c0c0' margin: 10px 0;></div>" + "<div><a href='http://localhost:65308/Access.aspx?ID=" + ps.PS_CITIZEN_ID + "&Password="******"&Action=1'>เปลี่ยนรหัสผ่านได้ที่นี่</a></div>"; var smtp = new SmtpClient { Host = "smtp.live.com", Port = 587, EnableSsl = true, DeliveryMethod = SmtpDeliveryMethod.Network, UseDefaultCredentials = false, Credentials = new NetworkCredential(fromAddress.Address, fromPassword) }; MailMessage ms = new MailMessage(fromAddress, toAddress); ms.IsBodyHtml = true; ms.Subject = subject; ms.Body = body; smtp.Send(ms); /*using (var message = new MailMessage(fromAddress, toAddress) { * message.IsBodyHtml = true, * Subject = subject, * Body = body * }) { * smtp.Send(message); * }*/ }
protected void lbuUpdatePerson_Click(object sender, EventArgs e) { if (tbZipcode.Text.Length != 5) { MultiView1.ActiveViewIndex = 0; ScriptManager.GetCurrent(this.Page).SetFocus(this.tbZipcode); ChangeNotification("danger", "กรุณากรอกรหัสไปรษณีย์ให้ครบ 5 หลัก"); return; } PersonnelSystem ps = PersonnelSystem.GetPersonnelSystem(this); UOC_STAFF loginPerson = ps.LoginPerson; PS_PERSON person = new PS_PERSON(); person.HOMEADD = tbHomeAdd.Text; person.MOO = tbMoo.Text; person.STREET = tbStreet.Text; person.SUB_DISTRICT_ID = ddlSubDistrict.SelectedValue; person.DISTRICT_ID = ddlDistrict.SelectedValue; person.PROVINCE_ID = ddlProvince.SelectedValue; person.TELEPHONE = tbTelephone.Text; person.ZIPCODE = tbZipcode.Text; person.NATION_ID = ddlNation.SelectedValue; person.UOC_ID = loginPerson.UOC_ID; person.UPDATE_PERSON_USER(); INSERT_REQUEST(); MultiView1.ActiveViewIndex = 3; btnSelectView0.Visible = false; btnSelectView1.Visible = false; btnSelectView2.Visible = false; btnUpdatePerson.Visible = false; }
protected void btnSave6_Click(object sender, EventArgs e) { PS_POSI_AND_SALARY PosiSalary = new PS_POSI_AND_SALARY(); PosiSalary.UOC_ID = Int32.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())); PosiSalary.START_DATE = DateTime.Parse(tbStartDate14.Text); PosiSalary.PAS_NAME = tbName14.Text; PosiSalary.NO_POSITION = tbNoPosition14.Text; PosiSalary.POSITION_TYPE = tbPosiType14.Text; PosiSalary.POSITION_DEGREE = tbPosiDegree14.Text; PosiSalary.SALARY = Convert.ToInt32(tbSalary14.Text); PosiSalary.POSITION_SALARY = Convert.ToInt32(tbPosiSalary14.Text); PosiSalary.REF_DOC = tbRefDoc14.Text; PosiSalary.INSERT_PS_POSI_AND_SALARY(); PS_PERSON P0 = new PS_PERSON(); int salary = DatabaseManager.ExecuteInt("SELECT * FROM (SELECT salary FROM PS_POSI_AND_SALARY ORDER BY START_DATE DESC) WHERE ROWNUM = 1"); int posisalary = DatabaseManager.ExecuteInt("SELECT * FROM (SELECT position_salary FROM PS_POSI_AND_SALARY ORDER BY START_DATE DESC) WHERE ROWNUM = 1"); P0.SALARY = salary.ToString(); P0.POSITION_SALARY = posisalary.ToString(); P0.UOC_ID = Int32.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())); P0.UPDATE_CURRENT_SALARY_PERSON(); ClearPositionAndSalary(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('เพิ่มข้อมูลเรียบร้อย')", true); BindData(); }
protected void btnSave1_Click(object sender, EventArgs e) { PS_PERSON Pson = new PS_PERSON(); Pson.UOC_ID = Int32.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())); Pson.FATHER_NAME = tbFatherName.Text; Pson.FATHER_LNAME = tbFatherLastName.Text; Pson.MOTHER_NAME = tbMotherName.Text; Pson.MOTHER_LNAME = tbMotherLastName.Text; Pson.MOTHER_ONAME = tbMotherOldLastName.Text; Pson.COUPLE_NAME = tbCoupleName.Text; Pson.COUPLE_LNAME = tbCoupleLastName.Text; Pson.COUPLE_ONAME = tbCoupleOldLastName.Text; Pson.UPDATE_GP7(); ClearGP7(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('เพิ่มข้อมูลเรียบร้อย')", true); BindDataBase(); }
protected void modDeleteCommand5(Object sender, GridViewDeleteEventArgs e) { int id = Convert.ToInt32(GridViewPosiSalary.DataKeys[e.RowIndex].Value); PS_POSI_AND_SALARY PStudy = new PS_POSI_AND_SALARY(); PStudy.PAS_ID = id; PStudy.DELETE_PS_POSI_AND_SALARY(); PS_PERSON P0 = new PS_PERSON(); int salary = DatabaseManager.ExecuteInt("SELECT * FROM (SELECT salary FROM PS_POSI_AND_SALARY ORDER BY START_DATE DESC) WHERE ROWNUM = 1"); int posisalary = DatabaseManager.ExecuteInt("SELECT * FROM (SELECT position_salary FROM PS_POSI_AND_SALARY ORDER BY START_DATE DESC) WHERE ROWNUM = 1"); P0.SALARY = salary.ToString(); P0.POSITION_SALARY = posisalary.ToString(); P0.UOC_ID = Int32.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())); P0.UPDATE_CURRENT_SALARY_PERSON(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ลบข้อมูลเรียบร้อย')", true); GridViewPosiSalary.EditIndex = -1; BindData(); }