Exemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            user_details user_Details = new user_details();

            user_Details.Show();
            this.Hide();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Añado los detalles de un usuario por ID
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="userName"></param>
        /// <param name="userLastName"></param>
        /// <param name="userBitrh"></param>
        /// <param name="userEmail"></param>
        /// <returns></returns>
        public bool AddUserDetails(int userID, string userName, string userLastName, string userBitrh, string userEmail)
        {
            bool status = false;

            users user = GetUserById(userID);

            if(user != null)
            {
                user_details userDetails = new user_details
                {
                    user_id = userID,
                    name = userName,
                    last_name = userLastName,
                    date_of_birth = DateTime.Parse(userBitrh),
                    email = userEmail
                };

                using (EntityFrameworkEntities context = new EntityFrameworkEntities())
                {
                    context.user_details.Add(userDetails);

                    status = SaveChanges(context);
                }
            }

            return status;
        }
Exemplo n.º 3
0
        public int signupsite(JObject param)
        {
            int    status = 0;
            string fname  = "";
            string lname  = "";
            string email  = "";
            string pword  = "";

            try
            {
                fname = (string)param.GetValue("firstname");
                lname = (string)param.GetValue("lastname");
                email = (string)param.GetValue("email");
                pword = (string)param.GetValue("password");

                user_details us = new user_details();
                us.fname        = fname;
                us.lname        = lname;
                us.email        = email;
                us.password     = pword;
                us.user_type    = 1;
                us.user_status  = 1;
                us.created_date = DateTime.Now;
                context.user_details.Add(us);
                context.SaveChanges();
                status = 1;
            }
            catch (Exception e)
            {
                Logdetails.LogError("Post Error", "signuperror signupcontroller (19)", e.Message);
            }

            return(status);
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("user_id,user_name,user_phone_number,user_address,user_email")] user_details user_details)
        {
            if (id != user_details.user_id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(user_details);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!user_detailsExists(user_details.user_id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(user_details));
        }
Exemplo n.º 5
0
        //string userid
        public user_details Get_User_information(string em)
        {
            user_details x = abc.retieve_user(em);

            x.R_Pass = "******";
            return(x);
        }
Exemplo n.º 6
0
        public void GetEmailConfigInfo(user_details u)
        {
            SqlDbDataAccess dr  = new SqlDbDataAccess();
            SqlCommand      cmd = dr.GetCommand("select dbo.user_details.e_from,dbo.user_details.e_password,dbo.user_details.port,dbo.user_details.enablessi,dbo.user_details.usedefaultcredentials from dbo.user_details where dbo.user_details.username='******';");

            try
            {
                cmd.Connection.Open();
                SqlDataReader dx = cmd.ExecuteReader();
                dx.Read();

                u.e_from                = dx.GetString(0);
                u.e_password            = dx.GetString(1);
                u.port                  = dx.GetInt32(2);
                u.enablessi             = dx.GetString(3);
                u.usedefaultcredentials = dx.GetString(4);

                dx.Close();
                cmd.Connection.Close();
            }
            catch (System.Data.SqlTypes.SqlNullValueException)
            {
                u.e_from                = "";
                u.e_password            = "";
                u.port                  = 0;
                u.enablessi             = "";
                u.usedefaultcredentials = "";
            }
        }
Exemplo n.º 7
0
        public async Task <IActionResult> Create([Bind("user_id,user_name,user_phone_number,user_address,user_email")] user_details user_details)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user_details);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(user_details));
        }
Exemplo n.º 8
0
        private void EmailConfiguration_Load(object sender, EventArgs e)
        {
            access_data  d = new access_data();
            user_details u = new user_details();

            d.GetEmailConfigInfo(u);

            metroTextBox1.Text           = u.e_from;
            metroTextBox2.Text           = u.e_password;
            metroTextBox3.Text           = Convert.ToString(u.port);
            metroComboBox1.SelectedIndex = metroComboBox1.FindStringExact(u.enablessi);
            metroComboBox2.SelectedIndex = metroComboBox2.FindStringExact(u.usedefaultcredentials);
            metroGrid1.DataSource        = d.ReturnEmailToCc();
        }
Exemplo n.º 9
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            user_details = await _context.user_details.FirstOrDefaultAsync(m => m.user_id == id);

            if (user_details == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Exemplo n.º 10
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            user_details = await _context.user_details.FindAsync(id);

            if (user_details != null)
            {
                _context.user_details.Remove(user_details);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 11
0
        private void metroButton2_Click(object sender, EventArgs e)
        {
            string EnableSsl             = this.metroComboBox1.GetItemText(this.metroComboBox1.SelectedItem);
            string UseDefaultCredentials = this.metroComboBox2.GetItemText(this.metroComboBox2.SelectedItem);


            if (metroTextBox1.Text == "" || metroTextBox2.Text == "" || metroTextBox3.Text == "" || EnableSsl == "" || UseDefaultCredentials == "" || metroGrid1.Rows.Count < 1)
            {
                MetroMessageBox.Show(this, "You cant place any above field ampty.[Multiple receiving email address acceptable but at least one receiving email address must be given]", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Error);
                metroTextBox1.Text = metroTextBox2.Text = metroTextBox3.Text = EnableSsl = UseDefaultCredentials = "";
            }
            else
            {
                if (IsEmail(metroTextBox1.Text) == false || IsEmail(metroTextBox4.Text) == false)
                {
                    MetroMessageBox.Show(this, "Invalid Email Address!", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    metroTextBox1.Text = metroTextBox2.Text = metroTextBox3.Text = EnableSsl = UseDefaultCredentials = "";
                }
                else
                {
                    SqlDbDataAccess dr = new SqlDbDataAccess();
                    access_data     d  = new access_data();
                    user_details    u  = new user_details();
                    u.e_from                = metroTextBox1.Text;
                    u.e_password            = metroTextBox2.Text;
                    u.port                  = Convert.ToInt32(metroTextBox3.Text);
                    u.enablessi             = EnableSsl;
                    u.usedefaultcredentials = UseDefaultCredentials;
                    d.InsertEmailConfiguration(u);

                    d.InsertNewToCC(metroTextBox4.Text);
                    metroGrid1.DataSource = d.ReturnEmailToCc();

                    d.UpdateNotificationThroughEmail(nofify);
                    MetroMessageBox.Show(this, "Information successfully updated", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    metroTextBox4.Text = "";
                }
            }
        }
Exemplo n.º 12
0
        //Returns User Details
        public user_details Get_user(string uid)
        {
            user_details u_d = new user_details();

            string query = "select * from user WHERE UserId='" + uid + "';";

            if (this.OpenConnection() == true)
            {
                try
                {
                    MySqlCommand cmd = new MySqlCommand(query, connection);

                    MySqlDataReader reader = cmd.ExecuteReader();

                    if (reader.Read())
                    {
                        u_d.UName  = reader.GetValue(0).ToString();
                        u_d.Name   = reader.GetValue(1).ToString();
                        u_d.Email  = reader.GetValue(2).ToString();
                        u_d.R_Pass = reader.GetValue(2).ToString();
                    }
                    else
                    {
                        u_d.Name   = "not found";
                        u_d.Email  = "not found";
                        u_d.R_Pass = "******";
                    }



                    reader.Close();
                }
                catch (Exception e)
                {
                    System.Diagnostics.Debug.WriteLine(e.Message);
                }
            }
            return(u_d);
        }
Exemplo n.º 13
0
        public bool InsertEmailConfiguration(user_details u)
        {
            SqlDbDataAccess dr  = new SqlDbDataAccess();
            SqlCommand      cmd = dr.GetCommand("update dbo.user_details set e_from=@e_from,e_password=@e_password,port=@port,enablessi=@enablessi,usedefaultcredentials=@usedefaultcredentials where dbo.user_details.username='******';");


            SqlParameter p = new SqlParameter("@e_from", SqlDbType.VarChar, 50);

            p.Value = u.e_from;

            SqlParameter p1 = new SqlParameter("@e_password", SqlDbType.VarChar, 20);

            p1.Value = u.e_password;

            SqlParameter p2 = new SqlParameter("@port", SqlDbType.Int);

            p2.Value = u.port;

            SqlParameter p3 = new SqlParameter("@enablessi", SqlDbType.VarChar, 4);

            p3.Value = u.enablessi;

            SqlParameter p4 = new SqlParameter("@usedefaultcredentials", SqlDbType.VarChar, 6);

            p4.Value = u.usedefaultcredentials;

            cmd.Parameters.Add(p);
            cmd.Parameters.Add(p1);
            cmd.Parameters.Add(p2);
            cmd.Parameters.Add(p3);
            cmd.Parameters.Add(p4);

            cmd.Connection.Open();
            cmd.ExecuteNonQuery();
            cmd.Connection.Close();

            return(true);
        }
Exemplo n.º 14
0
        ///// <summary>
        ///// 修改基本资料  账号 手机号码 正式姓名 姓名 生日 证件类型 身份证号
        ///// </summary>
        ///// <param name="username">账号</param>
        ///// <param name="mobile">手机号码</param>
        ///// <param name="realname">真实姓名</param>
        ///// <param name="sexuality">性别</param>
        ///// <param name="birth">生日</param>
        ///// <param name="cardtype">证件类型</param>
        ///// <param name="idnumber">身份证号</param>
        ///// <returns></returns>
        //public string UserModify(string username, string mobile, string realname, string sexuality, string birth , string cardtype , string idnumber )
        //{
        //    string sql = string.Empty;
        //         sql += " update user_details set username=@username where userid=@userid ";
        //         sql += " update user_details set mobile=@mobile where userid=@userid ";
        //         sql += " update user_details set realname=@realname where userid=@userid ";
        //         sql += " update user_details set sexuality=@sexuality where userid=@userid ";
        //         sql += " update user_details set birth=@birth where userid=@userid ";
        //         sql += " update user_details set cardtype=@cardtype where userid=@userid ";
        //         sql += " update user_details set idnumber=@idnumber where userid=@userid ";
        //    using (shhouseEntities db = new shhouseEntities())
        //    {
        //        try
        //        {
        //            var edituser = db.Database.ExecuteSqlCommand(sql,
        //                        new SqlParameter[]{
        //                        new SqlParameter("@userid", User.userid),
        //                        new SqlParameter("@username", username),
        //                        new SqlParameter("@mobile", mobile),
        //                        new SqlParameter("@realname", realname),
        //                        new SqlParameter("@sexuality", sexuality),
        //                        new SqlParameter("@birth", birth),
        //                        new SqlParameter("@cardtype", cardtype),
        //                         new SqlParameter("@idnumber", idnumber)
        //                      });
        //            return JsonConvert.SerializeObject(new repmsg { state = 1, msg = "修改成功" });
        //        }
        //        catch (Exception e)
        //        {
        //            return JsonConvert.SerializeObject(new repmsg { state = 2, msg = "修改失败,请稍后再试!" });
        //        }
        //    }
        //}

        /// <summary>
        /// 修改基本资料  http://192.168.1.223/GR_User/UserModify
        /// </summary>
        /// <param name="realname">真实姓名</param>
        /// <param name="sexuality">性别</param>
        /// <param name="birth">生日</param>
        /// <param name="cardtype">证件类型</param>
        /// <param name="idnumber">身份证号</param>
        /// <returns></returns>
        public string UserModify(string realname = null, int?sexuality = null, string photoname = null, string birthday = null, string cardtype = null, string idnumber = null, string NickName = null)
        {
            using (shhouseEntities db = new shhouseEntities())
            {
                user_details myuser_details = db.user_details.Find(User.userid);
                user_member  myuser_member  = db.user_member.Find(User.userid);
                bool         isModify       = false;

                if (realname != null && myuser_details.realname != realname)
                {
                    myuser_details.realname = realname;
                    isModify = true;
                }
                if (sexuality != null && myuser_details.sexuality != sexuality)
                {
                    myuser_details.sexuality = sexuality;
                    isModify = true;
                }
                if (photoname != null && myuser_details.photoname != photoname)
                {
                    myuser_details.photoname = photoname;
                    isModify = true;
                }
                if (birthday != null && myuser_details.birthday != Convert.ToDateTime(birthday))
                {
                    myuser_details.birthday = Convert.ToDateTime(birthday);
                    isModify = true;
                }
                if (cardtype != null && myuser_details.CardType != cardtype)
                {
                    myuser_details.CardType = cardtype;
                    isModify = true;
                }
                if (idnumber != null && myuser_details.idnumber != idnumber)
                {
                    myuser_details.idnumber = idnumber;
                    isModify = true;
                }

                if (NickName != null && myuser_member.NickName != NickName)
                {
                    myuser_member.NickName = NickName;
                    isModify = true;
                }

                if (isModify == false)
                {
                    return(JsonConvert.SerializeObject(new repmsg
                    {
                        state = 1,
                        msg = "提交成功,您信息未做任何调整",
                        data = null
                    }, timeFormat));
                }
                int isok = db.SaveChanges();
                if (isok > 0)
                {
                    return(JsonConvert.SerializeObject(new repmsg
                    {
                        state = 1,
                        msg = "修改成功",
                        data = null
                    }, timeFormat));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new repmsg
                    {
                        state = 2,
                        msg = "修改失败",
                        data = null
                    }));
                }
            }
        }
Exemplo n.º 15
0
        public string SendMail(string body)
        {
            SqlDbDataAccess dr = new SqlDbDataAccess();
            string          y  = "";
            access_data     d  = new access_data();
            user_details    u  = new user_details();

            d.GetEmailConfigInfo(u);

            using (SqlCommand cmd = dr.GetCommand("select dbo.email_cc.e_to from dbo.email_cc;"))
            {
                cmd.Connection.Open();
                using (var reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        string to = reader["e_to"].ToString();

                        MailMessage mail  = new MailMessage(u.e_from, to, "report from WHN", body);
                        SmtpClient  clint = new SmtpClient();
                        //for determine email smtp...
                        string x          = u.e_from;
                        int    startIndex = x.IndexOf('@');
                        int    endIndex   = x.LastIndexOf('.');
                        int    length     = endIndex - startIndex;
                        string xx         = x.Substring(startIndex + 1, length - 1);

                        if (xx == "gmail" || xx == "Gmail")
                        {
                            clint.Host      = "smtp.gmail.com";
                            clint.Port      = u.port;
                            clint.EnableSsl = Convert.ToBoolean(u.enablessi);
                        }
                        if (xx == "Hotmail" || xx == "hotmail" || xx == "live" || xx == "Live")
                        {
                            clint.Host      = "smtp.live.com";
                            clint.Port      = u.port;
                            clint.EnableSsl = Convert.ToBoolean(u.enablessi);
                        }
                        if (xx == "yahoo" || xx == "Yahoo")
                        {
                            clint.Host      = "smtp.mail.yahoo.com";
                            clint.Port      = u.port;
                            clint.EnableSsl = Convert.ToBoolean(u.enablessi);
                        }
                        clint.Credentials           = new System.Net.NetworkCredential(u.e_from, u.e_password);
                        clint.DeliveryMethod        = SmtpDeliveryMethod.Network;
                        clint.UseDefaultCredentials = Convert.ToBoolean(u.usedefaultcredentials);
                        try
                        {
                            clint.Send(mail);
                        }
                        catch (System.Net.Mail.SmtpException)
                        {
                            y = "Your internet connection is not secure to send email";
                            return(y);
                        }
                    }
                }
            }
            return(string.Empty);
        }