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


C# Users类代码示例

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


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

示例1: imgBtnSave_Click

    protected void imgBtnSave_Click(object sender, ImageClickEventArgs e)
    {
        if (Page.IsValid)
        {
            Users user = new Users();       //����Users����
            user.UserID = txtUserID.Text.Trim();
            if (!user.CheckUser(user.UserID))//ʹ��CheckUser������֤�û��Ƿ����
            {
                user.UserName = txtUserName.Text;
                user.UserPwd = FormsAuthentication.HashPasswordForStoringInConfigFile(txtUserPwd.Text, "MD5");
                user.RoleId = Convert.ToInt16(ddlRole.SelectedValue);

                    if (user.InsertByProc())
                    {
                        lblMessage.Text = "�ɹ�������û���Ϣ��";
                        Server.Transfer("UserManage.aspx");
                    }
              else
               {
                   lblMessage.Text = "����û�ʧ�ܣ�";
               }
            }
            else//�û����ڣ�������ʾ
            {
                lblMessage.Text = "���ݿ��д��ھ��иñ�ŵ��û������������룡";
            }
        }
    }
开发者ID:zhouhao,项目名称:OnlineExamSystem,代码行数:28,代码来源:UserAdd.aspx.cs

示例2: GetUserInfoByName

    public string GetUserInfoByName(string UserName)
    {
        if (string.IsNullOrEmpty(UserName))
        {
            return "";
        }

        Users u = new Users(1);

        u.Name = UserName;

        string ReturnDescption = "";

        int Result = u.GetUserInformationByName(ref ReturnDescption);

        if (Result < 0 || ReturnDescption != "")
        {
            return "获取会员信息错误!";
        }

        if (ReturnDescption != "")
        {
            return ReturnDescption;
        }

        return u.ID.ToString();
    }
开发者ID:ichari,项目名称:ichari,代码行数:27,代码来源:BodyCharge.aspx.cs

示例3: getUserByUserID

        public static Users getUserByUserID(string userID)
        {
            Users user = new Users();

            Database db = DatabaseFactory.CreateDatabase();

            string sqlCommand = "UI_GetUserByUserID";
            DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "userID", DbType.String, userID);

            // DataSet that will hold the returned results
            DataSet userDataset = null;

            userDataset = db.ExecuteDataSet(dbCommand);

            // Note: connection was closed by ExecuteDataSet method call

            if(userDataset.Tables[0].Rows.Count==1)
            {

                DataRow dr = userDataset.Tables[0].Rows[0];
                user.UserId = dr["UserId"].ToString();
                user.FirstName = dr["FirstName"].ToString();
                user.LastName = dr["LastName"].ToString();
                user.SubscriptionEndDate =DateTime.Parse(dr["SubscriptionEndDate"].ToString());
                user.SubscriptionStartDate = DateTime.Parse(dr["SubscriptionStartDate"].ToString());
                user.IsPaidSubscriber = (bool)dr["IsPaidSubscriber"];

             }
            return user ;
        }
开发者ID:karthikxx,项目名称:USAdvisory,代码行数:32,代码来源:UsersDAL.cs

示例4: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["userID"] == null)
        {
            Page.RegisterStartupScript("", "<script>location='../default.aspx';</script>");
        }
        if (Convert.ToInt32(Session["roleID"]) == 5)
        {
            Page.RegisterStartupScript("", "<script>alert('你登录的用户权限不够!');location='../default.aspx'</script>");
        }

        else
        {
            if (!Page.IsPostBack)
            {
                try
                {
                    string loginName = Session["userID"].ToString();
                    Users user = new Users();
                    user.LoadData(loginName);
                    labUser.Text = user.UserName;
                }
                catch
                {
                    Page.RegisterStartupScript("", "<script>location='../default.aspx'</script>");
                }

            }
        }
    }
开发者ID:zhouhao,项目名称:OnlineExamSystem,代码行数:30,代码来源:MasterPage.master.cs

示例5: getAddDoctorQuery

 public static string getAddDoctorQuery(Users.Doctor doctor)
 {
     StringBuilder query = new StringBuilder();
     query.Append("Insert into patients values(").Append(doctor.ID).Append(", ");
     query.Append(doctor.DepartmentID).Append(", \'").Append(doctor.Qualification).Append("\')");
     return query.ToString();
 }
开发者ID:nuces-acm,项目名称:DevFest-12-Team-8,代码行数:7,代码来源:QueryBuilder.cs

示例6: Index

        //[Route("~/")]
        //[Route("")]
        public ActionResult Index()
        {
            List<ArticleModel> articles = new List<ArticleModel>();
            user = (Users)Session["User"];
            // if (ModelState.IsValid)
            // {
            ConnManager connManager = new ConnManager();
            if(user!= null && user.UserId == 1)
                articles = connManager.GetArticles("Select * from VwArticles order by articleId desc");
            else
                articles = connManager.GetArticles("Select * from VwArticles where IsDisplay =1 order by articleId desc");

            // }

            PagingInfo info = new PagingInfo();
            info.SortField = " ";
            info.SortDirection = " ";
            info.PageSize = 7;
            info.PageCount = Convert.ToInt32(Math.Ceiling((double)(articles.Count/info.PageSize)));
            info.CurrentPageIndex = 0;

            // var query = articles.OrderByDescending(c => c.ArticleID).Take(info.PageSize);

            var query = articles.AsQueryable();
            query = query.Skip(info.CurrentPageIndex * info.PageSize).Take(info.PageSize);
            ViewBag.PagingInfo = info;

            return View(query.ToList());
        }
开发者ID:joinpramod,项目名称:MyBlogWebsiteMVC2015,代码行数:31,代码来源:ArticlesController.cs

示例7: LibraryForm

 /// <summary>
 /// Constructor with 2 parameters
 /// </summary>
 /// <param name="loginForm"></param>
 /// <param name="student"></param>
 public LibraryForm(LoginForm loginForm, Users.Student student)
 {
     InitializeComponent();
     this.loginForm = loginForm;
     this.student = student;
     InitializeGUI();
 }
开发者ID:zarifj,项目名称:Projects,代码行数:12,代码来源:LibraryForm.cs

示例8: UpdatePwd

    private void UpdatePwd(ref string errMsg)
    {
        string lotteryUserId = Request.Form["lotUserId"];
        string pwd = Request.Form["pwd"];
        
        var userId = 0L;
        long.TryParse(lotteryUserId,out userId);

        if (userId <= 0)
        {
            errMsg = string.Format("请求参数不正确lotUserId={0}",userId);
            return ;
        }

        var _User = new Users(1);
        _User.ID = userId;
        var rs = string.Empty;
        _User.GetUserInformationByID(ref rs);

        
        _User.Password = pwd;

        string ReturnDescription = "";

        if (_User.EditByID(ref ReturnDescription) < 0)
        {
            new Log("Users").Write("同步修改密码失败:" + ReturnDescription);
            errMsg = "同步修改密码失败:" + ReturnDescription;

        }

    }
开发者ID:ichari,项目名称:ichari,代码行数:32,代码来源:updatepwd.aspx.cs

示例9: GetID

    private void GetID()
    {
        LotteryID = Shove._Convert.StrToInt(tbLotteryID.Value, -1);
        PlayTypeID = Shove._Convert.StrToInt(tbPlayTypeID.Value, -1);
        UserID = Shove._Convert.StrToInt(tbUserID.Value, -1);

        SLS.Lottery lottery = new SLS.Lottery();

        if (!lottery.ValidID(LotteryID))
        {
            PF.GoError(ErrorNumber.Unknow, "参数错误,系统异常。", this.GetType().FullName);

            return;
        }

        if (!lottery[LotteryID].CheckPlayType(PlayTypeID))
        {
            PF.GoError(ErrorNumber.Unknow, "参数错误,系统异常。", this.GetType().FullName);

            return;
        }

        LotteryName = lottery[LotteryID].name;
        PlayTypeName = lottery.GetPlayTypeName(PlayTypeID);

        Name = new Users(1)[1, UserID].Name;
    }
开发者ID:ichari,项目名称:ichari,代码行数:27,代码来源:UserListFollowScheme.aspx.cs

示例10: Cps

 public Cps(Users user)
 {
     this.User = user;
     this.ID = -1L;
     this.SiteID = user.SiteID;
     this.OwnerUserID = user.ID;
     this.Name = "";
     this.Url = "";
     this.LogoUrl = "";
     this.BonusScale = 0.0;
     this.ON = false;
     this.IsShow = true;
     this.Company = "";
     this.Address = "";
     this.PostCode = "";
     this.ResponsiblePerson = "";
     this.ContactPerson = "";
     this.Telephone = "";
     this.Fax = "";
     this.Mobile = "";
     this.Email = "";
     this.QQ = "";
     this.ServiceTelephone = "";
     this.MD5Key = "";
     this.Type = -1;
     this.DomainName = "";
     this.ParentID = -1L;
     this.OperatorID = 1L;
     this.CommendID = -1L;
     this.DateTime = System.DateTime.Now;
     this.Content = null;
 }
开发者ID:NoobSkie,项目名称:taobao-shop-helper,代码行数:32,代码来源:Cps.cs

示例11: loadGridView

    /// <summary>
    /// Method which loads the gridview with all the Users.
    /// </summary>
    protected void loadGridView()
    {
        Users user = new Users();

        GridView1.DataSource = user.getAllUsers();
        GridView1.DataBind();
    }
开发者ID:efigarolam,项目名称:Snackthat,代码行数:10,代码来源:viewallusers.aspx.cs

示例12: Rate

 public ReturnMessage Rate(string userName, uint place, uint rating)
 {
     if (rating > 10)
     {
         throw new FormatException("Rating was beyond acceptable value (10)");
     }
     AspNetUser user = new Users().FindByUserName(userName);
     if (user == null)
     {
         return new ReturnMessage { Success = false, Message = "User does not exist" };
     }
     if (DB.Ratings.FirstOrDefault(x => x.AspNetUser.UserName == userName && x.LugarId == (int)place) != null)
     {
         return new ReturnMessage { Success = false, Message = "Rating already exists for this user/place combination" };
     }
     try
     {
         DB.Ratings.Add(new Rating
         {
             UserId = user.Id,
             Date = DateTime.Now,
             LugarId = (int)place,
             Rating1 = (int)rating
         });
     #if Release
         DB.SaveChanges();
     #endif
     }
     catch (Exception e)
     {
         return new ReturnMessage { Success = false, Message = e.Message };
     }
     return new ReturnMessage { Success = true, Message = "Rating saved successfully" };
 }
开发者ID:mrdude38,项目名称:EM2015,代码行数:34,代码来源:Places.cs

示例13: ImageButton1_Click

    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        Users user = new Users();//创建Users对象user
        string uid = TxtUserName.Text.Trim();

        string pwd = FormsAuthentication.HashPasswordForStoringInConfigFile(TxtUserPwd.Text.Trim(), "MD5");
        if (user.CheckPassword(uid))//根据用户编号查询用户密码
        {
            if (user.UserPwd == pwd)//输入密码与用户密码相同
            {
                CreateCookie();
                Session["userID"] = uid;//存储用户编号
                user.LoadData(uid);
                Session["UserName"] = user.UserName;
                Session["roleID"] = user.RoleId;
                RedirectPage(user.RoleName);

            }
            else//密码错误,给出提示
            {
                lblMessage.Text = "您输入的密码错误!";
            }
        }
        else//用户不存在,给出提示
        {
            lblMessage.Text = "该用户不存在!";
        }
        Page.RegisterStartupScript("", "<script>alert('" + lblMessage.Text + "');</script>");
    }
开发者ID:zhouhao,项目名称:OnlineExamSystem,代码行数:29,代码来源:Default.aspx.cs

示例14: AddNewUser

    /// <summary>
    /// Add new user id field will be ignored
    /// </summary>
    private static void AddNewUser(string name, string pass, int admin, string desc, string uOptions, string aOptions)
    {
        try
        {
            db_config_users dcu = new db_config_users();
            dcu.Open(); // open connection

            // user with name or pass empty
            if (name == string.Empty || pass == string.Empty) { Generic.JavaScriptInjector("NewUserError", "alert('name or pass are empty');"); return; }

            Users user = new Users
            {
                Name = name,
                Pass = pass,
                AdMIn = admin,
                Description = desc,
                UserOptions = uOptions,
                AdMInOptions = aOptions
            };

            dcu.AddUser(user);

            dcu.Close(); // close connection

            Generic.JavaScriptInjector("alert('New user added'); window.location.reload();");
        }
        catch (Exception ex)
        {
            Generic.JavaScriptInjector("alert('" + ex.Message + "');");
        }
    }
开发者ID:nelsonjma,项目名称:ntec,代码行数:34,代码来源:cfg_users.aspx.cs

示例15: Index

        public ActionResult Index(string tbLogin, string tbPassword, string tbPassword2, string tbEmail, string tbFirstName, string tbLastName)
        {
            StringBuilder sb = new StringBuilder();

            if (tbPassword != tbPassword2)
            {
                sb.Append("Паролі не співпадають!");
            }

            if (_usersRepository.GetUserByLogin(tbLogin) != null)
            {
                sb.Append("Користувач з таким логіном вже існує!");
            }

            string message = sb.ToString();
            if (!string.IsNullOrWhiteSpace(message))
            {
                ViewBag.Message = message;
                return View();
            }

            var user = new Users()
            {
                Email = tbEmail,
                Firstname = tbFirstName,
                Lastname = tbLastName,
                Login = tbLogin,
                Password = tbPassword
            };
            _usersRepository.AddUser(user);

            return Redirect("/");
        }
开发者ID:trofimchuk-t,项目名称:ASP.NET-MVC-yandex-translator,代码行数:33,代码来源:RegistrationController.cs


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