예제 #1
0
        protected void BindLog(int pageSize,int pageIndex)
        {   
            string username = txtLoginName.Text.Trim();
            string userId = "";

            if (!string.IsNullOrEmpty(username))
            {
               
                MemberShipManager msm = new MemberShipManager();

                if (msm.IsUserExist(username))
                {
                    User _user = msm.GetUser(username);

                    if (_user != null)
                    {
                        userId = _user.UserId.ToString();
                    }
                }
                else
                {
                    GridView1.EmptyDataText = "没有该用户";
                    this.AspNetPager1.RecordCount = 0;
                    GridView1.DataSource = null;//ds;
                    GridView1.DataBind();
                    return;
                }
            }

            if (t_Date.Text != string.Empty
                && e_Date.Text != string.Empty)
            {
                DateTime begin = Convert.ToDateTime(t_Date.Text);
                DateTime end = Convert.ToDateTime(e_Date.Text).AddDays(1);

                DataSet ds;
                
                Resource obj = new Resource();
                ds = obj.GetResourcesUploadLog(begin, end, pageSize, pageIndex, userId);

                if (ds != null && ds.Tables[1].Rows.Count > 0)
                {
                    this.AspNetPager1.RecordCount = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString());
                    GridView1.DataSource = ds.Tables[1];
                    GridView1.DataBind();
                }
                else
                {
                    this.AspNetPager1.RecordCount = 0;
                    GridView1.DataSource = null;//ds;
                    GridView1.DataBind();
                }
            }
        }
예제 #2
0
        protected void EditUserInfo(bool isCreated)
        {
            string loginName = UserInfo.LoginName;
            string userName = UserInfo.UserName;
            string pwd = UserInfo.Password;

            if (pwd == string.Empty) pwd = "abcd1234";

            string email = UserInfo.Email;
            string tel = UserInfo.Tel;
            bool islocked = UserInfo.IsLocked;
            bool isIPValidate = UserInfo.IsIPValidate;
            string isdownload = UserInfo.IsDownLoad;




            //新建用户
            if (isCreated)
            {
                //
                try
                {
                    MemberShipManager msm = new MemberShipManager();
                    if (msm.IsUserExist(loginName))
                    {
                        ShowMessage("此用户名已存在");
                    }
                    else
                    {

                        IUser user = msm.CreateUser(pwd, loginName, userName, SelDeptId, email, tel, islocked, isdownload, isIPValidate);

                        if (user == null) throw new Exception("Error");

                        ShowMessage("新建用户成功");

                        this.ShowUserManager();

                    }
                }
                catch (Exception ex)
                {
                    QJVRMS.Common.LogWriter.WriteExceptionLog(ex, true);
                    ShowMessage("新建用户失败");
                }
            }
            else
            {
                MemberShipManager msm = new MemberShipManager();

                if (msm.ModifyUserInfo(new Guid(this.hiUserId.Value), SelDeptId, userName, email, tel, islocked, isdownload, isIPValidate))
                {
                    ShowMessage("修改用户信息成功");
                    this.ShowUserManager();
                }
                else
                {
                    ShowMessage("修改用户信息失败");
                }


            }
        }