Esempio n. 1
0
        protected void uiButtonLogin_Click(object sender, EventArgs e)
        {
            SiteUsers user = new SiteUsers();
            uiLabelError.Visible = false;
            uiLabelError.Visible = false;
            user.GetUserByUserNameAndPassword(uiTextBoxUserName.Text, uiTextBoxPassword.Text);
            if (user.RowCount == 0)
            {
                uiLabelError.Visible = true;
            }
            else
            {
                if (user.IsColumnNull("IsApproved") || !user.IsApproved)
                {
                    uiLabelError.Visible = false;
                    uiLabelNotApproved.Visible = true;
                }
                else
                {
                    Session["CurrentUser"] = user;
                    ViewLoginPanel();

                }
            }
        }
 protected void uiGridViewCurrentUsers_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "EditUser")
     {
         SiteUsers objData = new SiteUsers();
         objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         CurrentSiteUsers = objData;
         uiTextBoxFullName.Text = objData.UserFullName;
         uiTextBoxUserName.Text = objData.UserName;
         uiTextBoxTele.Text = objData.Telephone;
         uiFCKeditorPage.Value = Server.HtmlDecode(objData.UserPage);
         uiTextBoxMail.Text = objData.Email;
         uiTextBoxJob.Text = objData.Job;
         uiTextBoxInfo.Text = objData.OtherInfo;
         if(!objData.IsColumnNull("IsApproved"))
             uiCheckBoxApproved.Checked = objData.IsApproved;
         uiPanelViewAllPages.Visible = false;
         uiPanelEdit.Visible = true;
     }
     else if (e.CommandName == "DeleteUser")
     {
         SiteUsers objData = new SiteUsers();
         objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         objData.MarkAsDeleted();
         objData.Save();
         BindData();
         BindDataRequests();
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["CurrentUser"] != null)
            {
                SiteUsers user = new SiteUsers();
                user = (SiteUsers)Session["CurrentUser"];
                uiLiteralContent.Text = Server.HtmlDecode(user.UserPage);

            }
        }
        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;
            }
        }
 private void LoadUserProfile()
 {
     SiteUsers objData = new SiteUsers();
     objData = (SiteUsers)Session["CurrentUser"];
     uiTextBoxFullName.Text = objData.UserFullName;
     uiTextBoxUserName.Text = objData.UserName;
     uiTextBoxTele.Text = objData.Telephone;
     uiTextBoxMail.Text = objData.Email;
     uiTextBoxJob.Text = objData.Job;
     uiTextBoxInfo.Text = objData.OtherInfo;
 }
 protected void uiLinkButtonUpdate_Click(object sender, EventArgs e)
 {
     SiteUsers objData = new SiteUsers();
     objData = (SiteUsers)Session["CurrentUser"];
     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();
     uiLabelSucc.Visible = true;
     LoadUserProfile();
 }
        protected void uiLinkButtonUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                uiLabelError.Visible = false;
                uiLabelMsg.Visible = false;
                SiteUsers user = new SiteUsers();
                uiLabelError.Visible = false;
                user.GetUserByEmail(uiTextBoxEmail.Text);
                if (user.RowCount == 0)
                {
                    uiLabelError.Visible = true;
                }
                else
                {
                    MailMessage msg = new MailMessage();
                    string mail = ConfigurationManager.AppSettings["mail"];
                    msg.To.Add(user.Email);
                    msg.From = new MailAddress(mail);
                    msg.Subject = " User password for YBC";
                    msg.IsBodyHtml = true;
                    msg.BodyEncoding = System.Text.Encoding.Unicode;

                    msg.Body = "username : "******"<br/>password : "******"mailserver"], 25);
                    //SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
                    //client.EnableSsl = true;
                    client.UseDefaultCredentials = false;

                    client.Credentials = new System.Net.NetworkCredential(mail, ConfigurationManager.AppSettings["mailpass"]);
                    client.Send(msg);
                    uiLabelMsg.Visible = true;
                }
            }
            catch (Exception)
            {
                uiLabelError.Visible = true;
            }
        }
Esempio n. 8
0
        protected void uiButtonUpdate_Click(object sender, EventArgs e)
        {
            SiteUsers user = new SiteUsers();
            uiLabelError.Visible = false;
            user.GetUserByUserNameAndPassword(uiTextBoxUserName.Text, uiTextBoxPassword.Text);
            if (user.RowCount == 0)
            {
                uiLabelError.Visible = true;
            }
            else
            {
                if (user.IsColumnNull("IsApproved") || !user.IsApproved)
                {
                    uiLabelError.Visible = false;
                    uiLabelNotApproved.Visible = true;
                }
                else
                {
                    Session["CurrentUser"] = user;
                    Response.Redirect("Default.aspx");

                }
            }
        }
 protected void uiLinkButtonCancel_Click(object sender, EventArgs e)
 {
     uiPanelViewAllPages.Visible = true;
     uiPanelEdit.Visible = false;
     Clearfields();
     CurrentSiteUsers = null;
 }
Esempio n. 10
0
 private void BindDataRequests()
 {
     SiteUsers objData = new SiteUsers();
     objData.LoadAll();
     objData.Filter = "IsApproved <> 1 Or IsApproved is null";
     uiGridViewUserRequests.DataSource = objData.DefaultView;
     uiGridViewUserRequests.DataBind();
 }
Esempio n. 11
0
 private void BindData()
 {
     SiteUsers objData = new SiteUsers();
     objData.LoadAll();
     objData.Filter = "IsApproved = 1";
     uiGridViewCurrentUsers.DataSource = objData.DefaultView;
     uiGridViewCurrentUsers.DataBind();
 }
Esempio n. 12
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();
 }
 private void BindData()
 {
     UserRequests objData = new UserRequests();
     SiteUsers user = new SiteUsers();
     user = (SiteUsers)Session["CurrentUser"];
     objData.GetRequesetsByUserID(user.ID);
     uiGridViewNews.DataSource = objData.DefaultView;
     uiGridViewNews.DataBind();
 }