Exemplo n.º 1
0
        private XmlDocument getXmlDocument()
        {
            BLL.tb_SYS_Account bllAccount = new BLL.tb_SYS_Account();
            DataTable          dtAccount  = bllAccount.GetList("ID='" + Session["AccountID"] + "'").Tables[0];

            BLL.tb_SYS_RoleXML bllRoleXML  = new BLL.tb_SYS_RoleXML();
            DataTable          dtRoleXML   = bllRoleXML.GetList("RoleID='" + dtAccount.Rows[0]["RoleID"].ToString() + "'").Tables[0];
            XmlDocument        xmlDocument = new XmlDocument();

            xmlDocument.LoadXml(dtRoleXML.Rows[0]["XML"].ToString());
            return(xmlDocument);
        }
Exemplo n.º 2
0
        //删除选中记录集
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            string id = gridAccount.DataKeys[gridAccount.SelectedRowIndex][0].ToString();

            BLL.tb_SYS_Account bllAccount = new BLL.tb_SYS_Account();
            bool result = bllAccount.Delete(id);

            if (result)
            {
                Alert.ShowInTop("删除成功", "提示信息", MessageBoxIcon.Information);
                BindGrid();
            }
            else
            {
                Alert.ShowInTop("删除失败", "提示信息", MessageBoxIcon.Error);
            }
        }
Exemplo n.º 3
0
        //登录事件
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            //检测账户信息是否正确
            BLL.vw_SYS_Account bllAccount_vw = new BLL.vw_SYS_Account();
            string             strWhere      = "AccountName='" + txbUserName.Text + "' and Password='******'";
            DataSet            dsAccount     = bllAccount_vw.GetList(strWhere);

            if (dsAccount.Tables[0].Rows.Count > 0)
            {
                Session["AccountName"] = txbUserName.Text;
                Session["AccountID"]   = dsAccount.Tables[0].Rows[0]["ID"].ToString();
                Session["RoleName"]    = dsAccount.Tables[0].Rows[0]["RoleName"].ToString();
                Alert.ShowInTop("登陆成功!", "提示信息", MessageBoxIcon.Information, "location.href='Default.aspx';");
                return;
            }
            else
            {
                Alert.ShowInTop("用户名不存在 或 密码错误!", "提示信息", MessageBoxIcon.Warning);
            }

            #region 是否为系统初始账户
            if (txbUserName.Text == "YJQ" && txbPassword.Text == "1111")
            {
                Model.tb_SYS_Account modelAccount = new Model.tb_SYS_Account();

                modelAccount.ID          = Guid.NewGuid().ToString();
                modelAccount.AccountName = txbUserName.Text;
                modelAccount.Password    = txbPassword.Text;
                modelAccount.AccountType = "0";
                modelAccount.CreateID    = modelAccount.ID;
                modelAccount.CreateTime  = DateTime.Now;
                modelAccount.State       = "1";

                BLL.tb_SYS_Account bllAccount = new BLL.tb_SYS_Account();
                bool result = bllAccount.Add(modelAccount);
                if (!result)
                {
                    Alert.ShowInTop("初始账户添加失败!", "提示信息", MessageBoxIcon.Error);
                }
                else
                {
                    Alert.ShowInTop("成功添加初始账户!", "提示信息", MessageBoxIcon.Information, "location.href='Default.aspx';");
                }
            }
            #endregion
        }
Exemplo n.º 4
0
        //Grid绑定数据源
        private void BindGrid()
        {
            string sortField     = gridAccount.SortField;
            string sortDirection = gridAccount.SortDirection;

            BLL.tb_SYS_Account bllAccount = new BLL.tb_SYS_Account();
            DataSet            dsAccount  = bllAccount.GetList(condition.ToString());
            DataView           dvAccount  = dsAccount.Tables[0].DefaultView;

            dvAccount.Sort = String.Format("{0} {1}", sortField, sortDirection);

            DataTable dtSource = dvAccount.ToTable();

            gridAccount.RecordCount = dtSource.Rows.Count;
            DataTable dtCurrent = PublicMethod.getPageTable(dtSource, gridAccount.PageIndex, gridAccount.PageSize);

            gridAccount.DataSource = dtCurrent;
            gridAccount.DataBind();
        }
Exemplo n.º 5
0
        //保存修改
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Model.tb_SYS_Account modelAccount = new Model.tb_SYS_Account();
            modelAccount.ID          = Request.QueryString["ID"].ToString();
            modelAccount.AccountName = txbAccountName.Text;
            modelAccount.Password    = txbPassword.Text;
            modelAccount.RoleID      = hdfRoleID.Text;
            modelAccount.UpdateID    = Session["AccountID"].ToString();
            modelAccount.UpdateTime  = DateTime.Now;

            BLL.tb_SYS_Account bllAccount = new BLL.tb_SYS_Account();
            bool result = bllAccount.Update(modelAccount);

            if (!result)
            {
                Alert.ShowInTop("更新失败", "提示信息", MessageBoxIcon.Error, ActiveWindow.GetHideRefreshReference());
            }
            else
            {
                Alert.ShowInTop("更新成功", "提示信息", MessageBoxIcon.Information, ActiveWindow.GetHideRefreshReference());
            }
        }