コード例 #1
0
        protected void uiLinkButtonUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                SiteUsers objData = new SiteUsers();
                objData.AddNew();
                objData.UserFullName = uiTextBoxFullName.Text;
                objData.UserName = uiTextBoxUserName.Text;
                objData.Telephone = uiTextBoxTele.Text;
                objData.Email = uiTextBoxMail.Text;
                objData.Job = uiTextBoxJob.Text;
                objData.OtherInfo = uiTextBoxInfo.Text;
                if (!string.IsNullOrEmpty(uiTextBoxPassword.Text))
                    objData.UserPassword = uiTextBoxPassword.Text;
                objData.Save();
                clearFields();

                try
                {

                    MailMessage msg2 = new MailMessage();
                    string mailtouser = uiTextBoxMail.Text;
                    string mail = ConfigurationManager.AppSettings["mail"];
                    msg2.To.Add(mailtouser);
                    msg2.From = new MailAddress(mail);
                    msg2.Subject = " رسالة تأكيد لطلب عضوية";
                    msg2.IsBodyHtml = true;
                    msg2.BodyEncoding = System.Text.Encoding.Unicode;

                    msg2.Body = "<div style='direction:rtl;'>";
                    msg2.Body = "تم إرسال طلبك لنا وسوف يتم الرد عليك قريباً .";
                    msg2.Body += "</div>";

                    SmtpClient client2 = new SmtpClient(ConfigurationManager.AppSettings["mailserver"], 25);
                    //SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
                    //client.EnableSsl = true;
                    client2.UseDefaultCredentials = false;

                    client2.Credentials = new System.Net.NetworkCredential(mail, ConfigurationManager.AppSettings["mailpass"]);
                    client2.Send(msg2);
                    divmsg.Visible = true;
                }
                catch (Exception ex)
                {
                    //uiLabelMessage.Visible = true;
                    //uiLabelMessage.Text = "حدث خطأ . من فضلك حاول مرة أخرى .";
                }

                divmsg.Visible = true;
            }
            catch (Exception)
            {
                uiLabelError.Visible = true;
            }
        }
コード例 #2
0
 protected void uiLinkButtonUpdate_Click(object sender, EventArgs e)
 {
     SiteUsers objData = new SiteUsers();
     if (CurrentSiteUsers != null)
         objData = CurrentSiteUsers;
     else
     {
         objData.AddNew();
     }
     objData.UserFullName = uiTextBoxFullName.Text;
     objData.UserName = uiTextBoxUserName.Text;
     objData.Telephone = uiTextBoxTele.Text;
     objData.UserPage = Server.HtmlEncode(uiFCKeditorPage.Value);
     objData.Email = uiTextBoxMail.Text;
     objData.Job = uiTextBoxJob.Text;
     objData.OtherInfo = uiTextBoxInfo.Text;
     objData.IsApproved = uiCheckBoxApproved.Checked;
     if (!string.IsNullOrEmpty(uiTextBoxPassword.Text))
         objData.UserPassword = uiTextBoxPassword.Text;
     objData.Save();
     CurrentSiteUsers = null;
     uiPanelViewAllPages.Visible = true;
     uiPanelEdit.Visible = false;
     BindData();
     BindDataRequests();
 }