当前位置: 首页>>代码示例>>C#>>正文


C# Model.UserRepository类代码示例

本文整理汇总了C#中SocioBoard.Model.UserRepository的典型用法代码示例。如果您正苦于以下问题:C# UserRepository类的具体用法?C# UserRepository怎么用?C# UserRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UserRepository类属于SocioBoard.Model命名空间,在下文中一共展示了UserRepository类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Login

        public string Login(string EmailId, string Password)
        {
            //
            try
            {
                UserRepository userrepo = new UserRepository();
                Registration regObject = new Registration();
                User user = userrepo.GetUserInfo(EmailId, regObject.MD5Hash(Password));

                if (user != null)
                {
                    return new JavaScriptSerializer().Serialize(user);
                }
                else
                {
                    return "Invalid user name or password";
                }

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return null;
            }
        }
开发者ID:JBNavadiya,项目名称:socioboard,代码行数:25,代码来源:UserService.asmx.cs

示例2: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            UserRepository objUerRepo = new UserRepository();
            if (!IsPostBack)
            {
                try
                {
                   chkUser.DataSource = objUerRepo.getAllUsers();
                    chkUser.DataTextField = "UserName";
                    chkUser.DataValueField = "Id";
                    chkUser.DataBind();
                    if (Request.QueryString["Id"] != null)
                    {
                        NewsLetterRepository objNewsRepo = new NewsLetterRepository();
                        NewsLetter news = objNewsRepo.getNewsLetterDetailsbyId(Guid.Parse(Request.QueryString["Id"].ToString()));
                        txtSubject.Text = news.Subject;
                        Editor.Text = news.NewsLetterDetail;
                        txtSendDate.Text = news.SendDate.ToString();

                      //  datepicker.Text = news.ExpiryDate.ToString();
                      //  ddlStatus.SelectedValue = news.Status.ToString();
                    }
                }
                catch (Exception Err)
                {
                    logger.Error(Err.Message);
                    Response.Write(Err.StackTrace);
                }
            }
        }
开发者ID:utkarshx,项目名称:socioboard,代码行数:30,代码来源:AddNewsLetter.aspx.cs

示例3: btnForgotPwd_Click

        protected void btnForgotPwd_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                bool exist = false;
                UserRepository objUserRepo = new UserRepository();
                Registration regObject = new Registration();

                if (!string.IsNullOrEmpty(txtEmail.Text.Trim()))
                {
                    string strUrl = string.Empty;
                    // c.customer_email = txtEmail.Text.Trim();
                    // exist = custrepo.ExistedCustomerEmail(c);
                    User usr = objUserRepo.getUserInfoByEmail(txtEmail.Text);

                    if (usr != null)
                    {
                        string URL = Request.Url.AbsoluteUri;
                        //strUrl = Server.MapPath("~/ChangePassword.aspx") + "?str=" + txtEmail.Text + "&type=forget";
                        strUrl = URL.Replace("ForgetPassword.aspx", "ChangePassword.aspx" + "?str=" + regObject.MD5Hash(txtEmail.Text) + "&type=forget");
                        strUrl = (strUrl + "?userid=" + usr.Id).ToString();

                        string MailBody = "<body bgcolor=\"#FFFFFF\"><!-- Email Notification from SocioBoard.com-->" +
                    "<table id=\"Table_01\" style=\"margin-top: 50px; margin-left: auto; margin-right: auto;\"" +
                    " align=\"center\" width=\"650px\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" ><tr>" +
                   "<td height=\"20px\" style=\"background-color: rgb(222, 222, 222); text-align: center; font-size: 15px; font-weight: bold; font-family: Arial; color: rgb(51, 51, 51); float: left; width: 100%; margin-top: 7px; padding-top: 10px; border-bottom: 1px solid rgb(204, 204, 204); padding-bottom: 10px;\">" +
                       "SocioBoard</td></tr><!--Email content--><tr>" +
                   "<td style=\"background-color: #dedede; padding-top: 10px; padding-left: 25px; padding-right: 25px; padding-bottom: 30px; font-family: Tahoma; font-size: 14px; color: #181818; min-height: auto;\"><p>Hi , " + usr.UserName + "</p><p>" +
                       "Please click <a href=" + strUrl + " style=\"text-decoration:none;\">here</a> to proceed for password Reset</td></tr><tr>" +
                   "<td style=\"background-color: rgb(222, 222, 222); margin-top: 10px; padding-left: 20px; height: 20px; color: rgb(51, 51, 51); font-size: 15px; font-family: Arial; border-top: 1px solid rgb(204, 204, 204); padding-bottom: 10px; padding-top: 10px;\">Thanks" +
                   "</td></tr></table><!-- End Email Notification From SocioBoard.com --></body>";

                        string username = ConfigurationManager.AppSettings["username"];
                        string host = ConfigurationManager.AppSettings["host"];
                        string port = ConfigurationManager.AppSettings["port"];
                        string pass = ConfigurationManager.AppSettings["password"];
                        string from = ConfigurationManager.AppSettings["fromemail"];

                        //   string Body = mailformat.VerificationMail(MailBody, txtEmail.Text.ToString(), "");
                        string Subject = "Forget Password Socio Board account";
                        //MailHelper.SendMailMessage(host, int.Parse(port.ToString()), username, pass, txtEmail.Text.ToString(), string.Empty, string.Empty, Subject, MailBody);
                        MailHelper.SendSendGridMail(host, Convert.ToInt32(port), from, "", txtEmail.Text.ToString(), string.Empty, string.Empty, Subject, MailBody, username, pass);

                        lblerror.Text = "Please check your mail for the instructions.";
                    }
                    else
                    {
                        lblerror.Text = "Your Email is wrong Please try another one";
                    }
                }
                //else
                //{
                //    lblerror.Text = "Please enter your Email-Id";
                //}
            }
            catch (Exception Err)
            {
                logger.Error(Err.StackTrace);
            }
        }
开发者ID:utkarshx,项目名称:socioboard,代码行数:60,代码来源:ForgotPassword.aspx.cs

示例4: changePassoword

        public void changePassoword(object sender, EventArgs e)
        {
            if (txtPassword.Text != "" && txtConfirmPassword.Text != "")
            {
                if (txtPassword.Text == txtConfirmPassword.Text)
                {
                    User user = (User)Session["LoggedUser"];
                    Registration regpage = new Registration();
                    string changedpassword = regpage.MD5Hash(txtConfirmPassword.Text);
                    UserRepository userrepo = new UserRepository();
                    userrepo.ChangePassword(changedpassword, user.Password, user.EmailId);
                    txtConfirmPassword.Text = string.Empty;
                    txtPassword.Text = string.Empty;
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Message", "alert('Your password has been changed successfully.')", true);
                }
                else
                {

                }
            }
            else
            {

            }
        }
开发者ID:Kiranub313,项目名称:socioboard,代码行数:25,代码来源:PersonalSettings.aspx.cs

示例5: btnLogin_Click

        protected void btnLogin_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(txtEmail.Text) && !string.IsNullOrEmpty(txtPassword.Text))
                {
                    SessionFactory.configfilepath = Server.MapPath("~/hibernate.cfg.xml");
                          UserRepository userrepo = new UserRepository();
                    Registration regObject = new Registration();
                    User user = userrepo.GetUserInfo(txtEmail.Text, regObject.MD5Hash(txtPassword.Text));
                    if (user == null)
                    {
                        Response.Write("user is null");
                    }

                    if (user.PaymentStatus == "unpaid")
                    {
                        if (DateTime.Compare(DateTime.Now, user.ExpiryDate) < 0)
                        {
                            if (user != null)
                            {
                                Session["LoggedUser"] = user;
                                FormsAuthentication.SetAuthCookie(user.UserName, true);
                                Response.Redirect("/Home.aspx", false);
                            }
                            else
                            {
                                //  txterror.Text = "Invalid UserName Or Password";
                            }
                        }
                        else
                        {
                            Response.Redirect("Settings/Billing.aspx");
                        }
                    }
                    else
                    {
                        Session["LoggedUser"] = user;
                        FormsAuthentication.SetAuthCookie(user.UserName, true);
                        Response.Redirect("/Home.aspx", false);

                    }

                }
            }
            catch (Exception ex)
            {

                logger.Error(ex.StackTrace);

                Console.WriteLine(ex.StackTrace);
            }
        }
开发者ID:utkarshx,项目名称:socioboard,代码行数:53,代码来源:Login.aspx.cs

示例6: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {

            try
                {
                        byte[] parameters = Request.BinaryRead(HttpContext.Current.Request.ContentLength);
                        PaymentTransaction paymentTransaction = new PaymentTransaction();
                        PaymentTransactionRepository paymentRepo = new PaymentTransactionRepository();

                        if (parameters.Length > 0)
                        {
                            IPNMessage ipn = new IPNMessage(parameters);
                            bool isIpnValidated = ipn.Validate();
                            string transactionType = ipn.TransactionType;
                            NameValueCollection map = ipn.IpnMap;
                            
                            paymentTransaction.AmountPaid = map["payment_gross"];
                            paymentTransaction.PayPalTransactionId = map["txn_id"];
                            paymentTransaction.UserId = Guid.Parse(map["custom"].ToString());
                            paymentTransaction.Id = Guid.NewGuid();
                            paymentTransaction.IPNTrackId = map["ipn_track_id"];
                            
                            paymentTransaction.PayerEmail = map["payer_email"];
                            paymentTransaction.PayerId = map["payer_id"];
                            paymentTransaction.PaymentStatus = map["payment_status"];

                            
                            
                                logger.Info("Payment Status : " + paymentTransaction.PaymentStatus);
                                logger.Info("User Id : " +paymentTransaction.UserId);
                            

                            paymentTransaction.PaymentDate = DateTime.Now;
                            paymentTransaction.PaypalPaymentDate = map["payment_date"];
                            paymentTransaction.ReceiverId = map["receiver_id"];
                            paymentRepo.SavePayPalTransaction(paymentTransaction);
                            UserRepository userrepo = new UserRepository();
                            if (paymentTransaction.PaymentStatus == "Completed")
                            {
                                userrepo.changePaymentStatus(paymentTransaction.UserId, "paid");
                            }
                        }
                    }
                
                catch (System.Exception ex)
                {
                    logger.Error(ex.StackTrace);
                }
            
            
        }
开发者ID:JBNavadiya,项目名称:socioboard,代码行数:51,代码来源:IPNHandler.aspx.cs

示例7: changePassoword

        public void changePassoword(object sender, EventArgs e)
        {
            try
            {
                Registration regpage = new Registration();
                string OldPassword = regpage.MD5Hash(txtOldPassword.Text);
                if (txtOldPassword.Text != "")
                {
                    if (txtPassword.Text.Trim() != "" && txtConfirmPassword.Text.Trim() != "" && txtOldPassword.Text != "")
                    {
                        if (txtPassword.Text == txtConfirmPassword.Text)
                        {
                            User user = (User)Session["LoggedUser"];
                            if (OldPassword == user.Password)
                            {

                                string changedpassword = regpage.MD5Hash(txtConfirmPassword.Text);
                                UserRepository userrepo = new UserRepository();
                                userrepo.ChangePassword(changedpassword, user.Password, user.EmailId);
                                txtConfirmPassword.Text = string.Empty;
                                txtPassword.Text = string.Empty;
                                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Message", "alert('Your password has been changed successfully.')", true);
                            }
                            else
                            {
                                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Message", "alert('Your password is Incorrect.')", true);
                            }
                        }
                        else
                        {
                            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Message", "alert('Password Mismatch.')", true);
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Message", "alert('Invalid Password.')", true);
                    }
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Message", "alert('Please enter your old password.')", true);
                }
            }
            catch (Exception ex)
            {

                Console.WriteLine(ex.Message);
            }
        }
开发者ID:utkarshx,项目名称:socioboard,代码行数:49,代码来源:PersonalSettings.aspx.cs

示例8: IsUserValid

        /// <summary>
        /// This function check Is User Exist or Not created by Abhay Kr 5-2-2014
        /// </summary>
        /// <param name="UserId"></param>
        /// <returns>bool</returns>
        public bool IsUserValid(string UserId, ref User user)
        {
            bool ret = false;
            try
            {

                UserRepository objUserRepository = new UserRepository();
                user = objUserRepository.getUsersById(Guid.Parse(UserId));
                if (user != null)
                    ret = true;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                logger.Error(ex.Message);
            }
            return ret;
        }
开发者ID:rathika1,项目名称:socioboard,代码行数:23,代码来源:Registration.aspx.cs

示例9: btnForgotPwd_Click

        protected void btnForgotPwd_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                bool exist = false;
                UserRepository objUserRepo = new UserRepository();
                Registration regObject = new Registration();

                if (!string.IsNullOrEmpty(txtEmail.Text.Trim()))
                {
                    string strUrl = string.Empty;
                    User usr = objUserRepo.getUserInfoByEmail(txtEmail.Text);
                    if (usr != null)
                    {
                        string URL = Request.Url.AbsoluteUri;
                        strUrl = URL.Replace("ForgetPassword.aspx", "ChangePassword.aspx" + "?str=" + regObject.MD5Hash(txtEmail.Text) + "&type=forget");
                        strUrl = (strUrl + "?userid=" + usr.Id).ToString();
                        string mailpath = HttpContext.Current.Server.MapPath("~/Layouts/Mails/ResetPassword.htm");
                        string MailBody = File.ReadAllText(mailpath);
                        MailBody = MailBody.Replace("%replink%", strUrl);
                        MailBody = MailBody.Replace("%name%", usr.UserName);
                        string username = ConfigurationManager.AppSettings["username"];
                        string host = ConfigurationManager.AppSettings["host"];
                        string port = ConfigurationManager.AppSettings["port"];
                        string pass = ConfigurationManager.AppSettings["password"];
                        string from = ConfigurationManager.AppSettings["fromemail"];

                        //   string Body = mailformat.VerificationMail(MailBody, txtEmail.Text.ToString(), "");
                        string Subject = "Forget Password SocioBoard account";
                        //MailHelper.SendMailMessage(host, int.Parse(port.ToString()), username, pass, txtEmail.Text.ToString(), string.Empty, string.Empty, Subject, MailBody);
                        MailHelper.SendSendGridMail(host, Convert.ToInt32(port), from, "", txtEmail.Text.ToString(), string.Empty, string.Empty, Subject, MailBody, username, pass);
                        lblerror.Text = "Please check your mail for the instructions.";
                    }
                    else
                    {
                        lblerror.Text = "Your Email is wrong Please try another one";
                    }
                }
            }
            catch (Exception Err)
            {
                logger.Error(Err.StackTrace);
            }
        }
开发者ID:JBNavadiya,项目名称:socioboard,代码行数:44,代码来源:ForgotPassword.aspx.cs

示例10: SetPaymentStatus

        public int SetPaymentStatus(Guid guid)
        {
            int res = 0;
            try
            {
                UserRepository objUserRepository = new UserRepository();
                User user = new Domain.User();
                user.Id = guid;
                user.PaymentStatus = "paid";

                res=objUserRepository.UpdatePaymentStatusByUserId(user);

            }
            catch (Exception ex)
            {
                Console.WriteLine("Error : " + ex.StackTrace);
            }
            return res;
        }
开发者ID:JBNavadiya,项目名称:socioboard,代码行数:19,代码来源:SuccessPaypal.aspx.cs

示例11: Register

        public string Register(string EmailId, string Password, string AccountType, string FirstName, string LastName)
        {

            try
            {
                UserRepository userrepo = new UserRepository();
                if (!userrepo.IsUserExist(EmailId))
                {
                    Registration regObject = new Registration();
                    User user = new User();
                    user.AccountType = AccountType;
                    user.EmailId = EmailId;
                    user.CreateDate = DateTime.Now;
                    user.ExpiryDate = DateTime.Now.AddMonths(1);
                    user.Password = regObject.MD5Hash(Password);
                    user.PaymentStatus = "unpaid";
                    user.ProfileUrl = string.Empty;
                    user.TimeZone = string.Empty;
                    user.UserName = FirstName + " " + LastName;
                    user.UserStatus = 1;
                    user.Id = Guid.NewGuid();
                    UserRepository.Add(user);
                    MailSender.SendEMail(user.UserName,Password, EmailId);
                    return new JavaScriptSerializer().Serialize(user);
                }
                else
                {
                    return "Email Already Exists";
                }

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return "Something Went Wrong";
            }



        }
开发者ID:JBNavadiya,项目名称:socioboard,代码行数:40,代码来源:UserService.asmx.cs

示例12: btnResetPwd_Click

        protected void btnResetPwd_Click(object sender, EventArgs e)
        {
            try
            {
                Registration regpage = new Registration();
                string changedpassword = regpage.MD5Hash(txtpass.Text);
                UserRepository userrepo = new UserRepository();
                if (userrepo.ResetPassword(Guid.Parse(userid.ToString()), changedpassword.ToString()) > 0)
                {
                    lblerror.Text = "Password Reset Successfully";
                }
                else
                {
                    lblerror.Text = "Problem Password Reset";
                }

            }
            catch (Exception Err)
            {
                logger.Error(Err.StackTrace);
            }
        }
开发者ID:utkarshx,项目名称:socioboard,代码行数:22,代码来源:ResetPassword.aspx.cs

示例13: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (Request.QueryString != null)
                {
                    try
                    {
                        string custom = Request.QueryString["custom"];
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Error : " + ex.StackTrace);
                    }
                }

                if (Request.Form != null)
                {

                    //Get O/P >> Request.Form {mc_gross=89.00&protection_eligibility=Eligible&address_status=confirmed&payer_id=HYNG9RCLH48WC&tax=0.00&address_street=1+Main+St&payment_date=04%3a05%3a11+Feb+14%2c+2014+PST&payment_status=Completed&charset=windows-1252&address_zip=95131&first_name=Babita&mc_fee=2.88&address_country_code=US&address_name=Babita+Sinha&notify_version=3.7&custom=256f9c69-6b6a-4409-a309-b1f6d1f8e43b&payer_status=unverified&business=pbpraveen%40globussoft.com&address_country=United+States&address_city=San+Jose&quantity=1&payer_email=babitasinha102%40yahoo.com&verify_sign=AudjwUiCo.wy3HNpdy6W2f1OTj7HAMzUhH.XfOvEQoXh3Jg8DE1dsZLc&txn_id=20X29418LJ642962P&payment_type=instant&last_name=Sinha&address_state=CA&receiver_email=pbpraveen%40globussoft.com&payment_fee=2.88&receiver_id=AF2RVCTNXRVHA&txn_type=web_accept&item_name=Deluxe&mc_currency=USD&item_number=&residence_country=US&test_ipn=1&handling_amount=0.00&transaction_subject=256f9c69-6b6a-4409-a309-b1f6d1f8e43b&payment_gross=89.00&shipping=0.00&merchant_return_link=click+here&auth=AWBkWTCIt.vP.rsV.Pgb3ZpjH10upSH98oRXgsj.ZmWOGUNmMf50qaZ4Jq.rEcQNtFpYp0DJpbStsLJlkXfYxig}

                    Guid custom =Guid.Parse(Request.Form["custom"].ToString());
                    int res = SetPaymentStatus(custom);

                    UserRepository objUserRepository = new UserRepository();

                    Session["LoggedUser"] = objUserRepository.getUsersById(custom);

                    Response.Redirect("Home.aspx");
                }

                
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error : " + ex.StackTrace);
            }
        }
开发者ID:JBNavadiya,项目名称:socioboard,代码行数:38,代码来源:SuccessPaypal.aspx.cs

示例14: ChangePassword

        public string ChangePassword(string EmailId, string Password, string NewPassword)
        {
            try
            {
                User user = new User();
                UserRepository userrepo = new UserRepository();
                int i = userrepo.ChangePassword(NewPassword, Password, EmailId);
                if (i == 1)
                {
                    return "Password Changed Successfully";
                }
                else
                {
                    return "Invalid EmailId";
                }

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return "Please Try Again";
            }
        }
开发者ID:utkarshx,项目名称:socioboard,代码行数:23,代码来源:UserService.asmx.cs

示例15: changePassoword

 public void changePassoword(object sender, EventArgs e)
 {
     try
     {
         if (txtPassword.Text != "" && txtConfirmPassword.Text != "")
         {
             if (txtPassword.Text == txtConfirmPassword.Text)
             {
                 User user = (User)Session["LoggedUser"];
                 Registration regpage = new Registration();
                 string changedpassword = regpage.MD5Hash(txtConfirmPassword.Text);
                 UserRepository userrepo = new UserRepository();
                 userrepo.ChangePassword(changedpassword, user.Password, user.EmailId);
                 txtConfirmPassword.Text = string.Empty;
                 txtPassword.Text = string.Empty;
             }
         }
     }
     catch (Exception Err)
     {
         Console.Write(Err.Message);
     }
 }
开发者ID:utkarshx,项目名称:socioboard,代码行数:23,代码来源:PersonalSettings.aspx.cs


注:本文中的SocioBoard.Model.UserRepository类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。