Ejemplo n.º 1
0
        private void MemberPage_Load(object sender, EventArgs e)
        {
            // on form load accessing all the contact info

            adRegister.FillByEmail(tblRegister, Program.UserID);

            if (tblRegister.Count == 1)
            {
                var row = tblRegister[0];

                txtFname.Text      = row.Fname.ToString();
                txtLname.Text      = row.Lname.ToString();
                txtPhone.Text      = row.Phone.ToString();
                txtEmail.Text      = row.Email;
                PbProfilePic.Image = new Bitmap(Application.StartupPath.Substring(0, (Application.StartupPath.Length - 10)) + row.Photo);
            }
            else
            {
                lblProfile.Text      = "Something went wrong.. Please try again!!";
                lblProfile.ForeColor = Color.Red;
            }
            txtFname.Enabled       = false;
            txtLname.Enabled       = false;
            txtPhone.Enabled       = false;
            txtEmail.Enabled       = false;
            btnCloseEdit.Visible   = false;
            btnUpdatePhone.Visible = false;
            txtPass.Visible        = false;
            btnPass.Visible        = false;
        }
        private void btnSendEmail_Click(object sender, EventArgs e)
        {
            if (validateMe())
            {
                SmtpClient client = new SmtpClient();

                client.Host        = "smtp.gmail.com";
                client.Port        = 587;
                client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "Zxcvbnm@1");
                client.EnableSsl   = true;

                try
                {
                    adRegister.FillByEmail(tblRegister, txtEmail.Text);
                    if (tblRegister.Count == 1)
                    {
                        var         row     = tblRegister[0];
                        MailMessage message = new MailMessage("*****@*****.**", txtEmail.Text, "Password Recovery for Library Management System", "Your Password is :  " + row.Password);
                        client.Send(message);
                        MessageBox.Show("Email sent succesfully..!!");
                    }
                    else
                    {
                        MessageBox.Show("Sorry.. We can't find EmailId !!");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Information");
                    MessageBox.Show(ex.StackTrace);
                }
            }
        }
Ejemplo n.º 3
0
        private void MemberPage_Load(object sender, EventArgs e)
        {
            adRegister.FillByEmail(tblRegister, Program.UserID);

            if (tblRegister.Count == 1)
            {
                var row = tblRegister[0];

                txtFname.Text      = row.Fname.ToString();
                txtLname.Text      = row.Lname.ToString();
                txtPhone.Text      = row.Phone.ToString();
                txtEmail.Text      = row.Email;
                PbProfilePic.Image = LMS.Properties.Resources.Profile;
            }
            else
            {
                label1.Text      = "Something went wrong.. Please try again!!";
                label1.ForeColor = Color.Red;
            }
        }
        private void AdminProfile_Load(object sender, EventArgs e)
        {
            //int id = int.Parse(txtProductId.Text);


            adRegister.FillByEmail(tblRegister, Program.UserID);

            if (tblRegister.Count == 1)
            {
                var row = tblRegister[0];

                lblFname.Text     = row.Fname.ToString();
                lblLname.Text     = row.Lname.ToString();
                lblPhone.Text     = row.Phone.ToString();
                lblEmail.Text     = row.Email;
                pictureBox1.Image = new Bitmap(Application.StartupPath.Substring(0, (Application.StartupPath.Length - 10)) + row.Photo);
            }
            else
            {
                label1.Text      = "Something went wrong.. Please try again!!";
                label1.ForeColor = Color.Red;
            }
        }