protected void BindData()
    {
        //List<bdoUser> lst = objUserManagement.GetList(CurrentPage * gv.PageSize, gv.PageSize, ViewState["SortExpression"].ToString(), "ASC");

        //DataTable dtNew = objUserManagement.GetList(CurrentPage * gv.PageSize, gv.PageSize, ViewState["SortExpression"].ToString(), "ASC");
        DataTable lst = new DataTable();

        if (!User.IsInRole("SuperAdmin"))
        {
            DataTable CommonDt = new bllCommon().GetSystemUserByUserName(User.Identity.Name);

            if (CommonDt.Rows.Count > 0)
            {
                string userId = CommonDt.Rows[0]["UserId"].ToString();
                string unit   = CommonDt.Rows[0]["CdoUnitId"].ToString();
                UnitId = Convert.ToInt32(unit);
            }

            lst = new bllUser().GetList(UnitId);
        }
        else
        {
            lst = new bllUser().GetListForSupperAdmin();
        }

        gv.DataSource = lst;
        gv.DataBind();
    }
예제 #2
0
        public frmUser()
        {
            InitializeComponent();
            this.Load += frm_Load;
            //实例化必须,bllBusinessBase必须替换为bll层自己继承的子类(指定正确的dal.DBCode),建议封装重写到项目bll层

            _bll = bll = new bllUser();
        }
예제 #3
0
        protected override XtraReport DoPrepareReport()
        {
            rptUserList mReport = new rptUserList(); //报表实例

            DataSet data = new bllUser().GetUserReportData(txtDateFrom.DateTime, txtDateTo.DateTime);

            mReport.SetReportDataSource(data);//绑定报表的数据源

            return(mReport);
        }
예제 #4
0
        private void InitializeReport()
        {
            //打印单表数据
            string file = Application.StartupPath + @"\Reports\rptUser.frx";

            rptUser.Load(file);                                                             //加载报表模板文件

            DataSet ds = new bllUser().GetUserReportData(txtFrom.DateTime, txtTo.DateTime); //取报表数据

            rptUser.RegisterData(ds.Tables[0], "tb_MyUser");                                //注册数据源,单表

            //给DataBand(明细数据)绑定数据源
            DataBand       band       = rptUser.FindObject("Data1") as DataBand;
            DataSourceBase dataSource = rptUser.GetDataSource("tb_MyUser");

            band.DataSource = dataSource;

            //自定义处理
            band.BeforePrint += new EventHandler(band_BeforePrint);

            (rptUser.FindObject("Text16") as RichObject).Text = Loginer.CurrentUser.AccountName;
        }
예제 #5
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (txtAccount.Text.Trim() == string.Empty)
            {
                Msg.Warning("请输入登录帐号!");
                txtAccount.Focus();
                return;
            }

            if (txtOldPwd.EditValue == null || txtOldPwd.EditValue.ToString().Trim() == string.Empty)
            {
                Msg.Warning("请输入旧密码!");
                txtOldPwd.Focus();
                return;
            }

            //取修改密码用户的资料
            DataTable dt = new bllUser().GetUserDirect(txtAccount.Text, _user.DataSetDBName);

            if (dt.Rows.Count > 0)
            {
                //管理员修改用户密码不需要验证旧密码
                if (false == Loginer.CurrentUser.IsAdmin())
                {
                    string pwd = CEncoder.Decode(dt.Rows[0][TUser.Password].ToString());
                    if (pwd != txtOldPwd.Text.Trim())
                    {
                        Msg.Warning("所输入旧密码不正确!");
                        txtOldPwd.Focus();
                        return;
                    }
                }
            }
            else
            {
                Msg.Warning("登录帐号'" + txtAccount.Text + "'不存在!");
                return;
            }

            if (txtPwdF.EditValue == null || txtPwdF.EditValue.ToString().Trim() == string.Empty)
            {
                Msg.Warning("请输入新密码!");
                txtPwdF.Focus();
                return;
            }

            if (txtPwdF.Text.Trim().Length < 3)
            {
                Msg.Warning("密码长度必须大于2位!");
                txtPwdF.Focus();
                return;
            }

            if (txtPwdS.EditValue == null || txtPwdS.EditValue.ToString().Trim() == string.Empty)
            {
                Msg.Warning("请确认新密码!");
                txtPwdS.Focus();
                return;
            }

            if (txtPwdF.EditValue.ToString() != txtPwdS.EditValue.ToString())
            {
                Msg.Warning("两次新密码不相同!");
                txtPwdF.Focus();
                return;
            }

            if (Msg.AskQuestion("要修改密码?"))
            {
                bool success = new bllUser().ModifyPasswordDirect(txtAccount.Text, CEncoder.Encode(txtPwdF.Text), _user.DataSetDBName);
                if (success)
                {
                    _user.Password = txtPwdF.Text;
                    Msg.ShowInformation("修改成功!");
                    this.Close();
                }
                else
                {
                    Msg.Warning("修改出错!");
                }
            }
        }
예제 #6
0
    protected void BindData()
    {
        // if (Application["user"] == null) return;

        //DataTable objAllUsers = objUserManagement.GetList(0, 0, "", "");
        //List<bdoUser> objLoggedInUsers = new List<bdoUser>();
        //List<String> users = Application["user"] as List<String>;


        //List<bdoUser> objAllUsers2 = GetMappedObject(objAllUsers);

        //foreach (DataRow objUser in objAllUsers.Rows)
        //{
        //    for (int i = 0; i < users.Count; i++)
        //    {
        //        if (users[i].ToLower() == objUser[""].ToString().ToLower())
        //        {
        //            objLoggedInUsers.Add(objAllUsers2);
        //            break;
        //        }
        //    }
        //}

        //gv.DataSource = objLoggedInUsers;
        //gv.DataBind();

        //DataTable CommonDt = new bllCommon().GetSystemUserByUserName(User.Identity.Name);

        //if (CommonDt.Rows.Count > 0)
        //{
        //    string userId = CommonDt.Rows[0]["UserId"].ToString();
        //    string unit = CommonDt.Rows[0]["CdoUnitId"].ToString();
        //    UnitId = Convert.ToInt32(unit);
        //}
        if (Application["user"] == null)
        {
            return;
        }

        //List<bdoUser> objAllUsers = objUserManagement.GetList(0, 0, "", "");
        DataTable dt = new bllUser().GetListForSupperAdmin();

        //List<bdoUser> objAllUsers = new List<bdoUser>();
        //foreach (DataRow dr in dt.Rows)
        //{   dr.
        //    objAllUsers.Add(dr);
        //}
        List <bdoUser> objLoggedInUsers = new List <bdoUser>();

        List <String> users = Application["user"] as List <String>;

        foreach (DataRow dr in dt.Rows)
        {
            for (int i = 0; i < users.Count; i++)
            {
                if (users[i].ToLower() == dr[0].ToString().ToLower())
                {
                    bdoUser obUser = new bdoUser();
                    obUser.UserName = dr[0].ToString();
                    obUser.Email    = dr[2].ToString();
                    obUser.RoleName = dr[5].ToString();
                    obUser.UnitName = dr[7].ToString();
                    objLoggedInUsers.Add(obUser);

                    break;
                }
            }
        }

        gv.DataSource = objLoggedInUsers;
        gv.DataBind();
    }