Example #1
0
        /// <summary>
        /// toolbar事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void toolbar_MenuItemClick(object sender, MenuEventArgs e)
        {
            long ID = 0;

            switch (e.Item.Value)
            {
            case "Delete":
                if (e.Item.Value == "Delete")
                {
                    for (int i = 0; i < tvOU.CheckedNodes.Count; i++)
                    {
                        Infragistics.WebUI.UltraWebNavigator.Node tn = (Infragistics.WebUI.UltraWebNavigator.Node)tvOU.CheckedNodes[i];
                        if (tn.Nodes.Count > 0)
                        {
                            PageHelper.ShowExceptionMessage("选择删除的部门中不能包含有下级部门!");
                            return;
                        }

                        if (UserQuery.IsHavePerson(NDConvert.ToInt64(tn.DataKey.ToString())))
                        {
                            PageHelper.ShowExceptionMessage("选择删除的部门中有人员,请先删除人员后再删除部门!");
                            return;
                        }
                    }

                    for (int j = 0; j < tvOU.CheckedNodes.Count; j++)
                    {
                        Infragistics.WebUI.UltraWebNavigator.Node tn = (Infragistics.WebUI.UltraWebNavigator.Node)tvOU.CheckedNodes[j];
                        OUEntity entity = new OUEntity(NDConvert.ToInt64(tn.DataKey.ToString()));
                        entity.UpdateDate = DateTime.Now;
                        entity.IsDeleted  = true;
                        new OURule().Update(entity);
                    }
                    BindTreeView();
                    PageHelper.ShowMessage("删除成功!");
                }
                break;

            case "Add":
                if (tvOU.CheckedNodes.Count > 0)
                {
                    int tnLevel = ((Infragistics.WebUI.UltraWebNavigator.Node)tvOU.CheckedNodes[0]).Level;
                    if (tnLevel >= 3)
                    {
                        PageHelper.ShowExceptionMessage("此处部门树视图只支持到4层!");
                        return;
                    }
                    ID = NDConvert.ToInt64(((Infragistics.WebUI.UltraWebNavigator.Node)tvOU.CheckedNodes[0]).DataKey.ToString());
                }
                Page.ClientScript.RegisterStartupScript(this.GetType(), "add", "showModalWindow('OUDetailLY', '添加',600, 450, '../../web/SysManager/OUDetail.aspx?Operation=1&ID=' + " + ID + ");", true);
                break;

            case "Update":
                ID = NDConvert.ToInt64(((Infragistics.WebUI.UltraWebNavigator.Node)tvOU.CheckedNodes[0]).DataKey.ToString());
                Page.ClientScript.RegisterStartupScript(this.GetType(), "update", "showModalWindow('OUDetailLY', '修改',600, 450, '../../web/SysManager/OUDetail.aspx?Operation=2&ID=' + " + ID + ");", true);
                break;
            }
        }
Example #2
0
        /// <summary>
        /// 更新
        /// </summary>
        private void Update()
        {
            OUEntity entity = new OUEntity(this.OUID);

            entity.OUParentID  = NDConvert.ToInt64(drpOUList.SelectedValue);
            entity.OUType      = 1;
            entity.OUName      = txtOUName.Text.Trim();
            entity.Description = txtDescriptipn.Text.Trim();
            if (entity.SortIndex == 0)
            {
                entity.SortIndex = OUQuery.GetMaxSortIndex();
            }
            entity.UpdateDate = DateTime.Now;
            new OURule().Update(entity);
        }
Example #3
0
        public void TransferPage()
        {
            try
            {
                DataTable dt = new UserQuery().GetUserByUserID(NDConvert.ToString(UserID));

                if (dt.Rows.Count > 0)
                {
                    UserEntity entity = new UserEntity(NDConvert.ToInt64(dt.Rows[0]["UserID"].ToString()));

                    if (entity.Status == 2) //锁定
                    {
                        PageHelper.ShowExceptionMessage("此用户已经被锁定,无法登陆,请与管理员联系!");
                        return;
                    }

                    switch (entity.UserType)
                    {
                    case (int)CommonEnum.UserType.Admin:
                        SessionState.UserType = CommonEnum.UserType.Admin;
                        SessionState.IsAdmin  = true;
                        break;

                    case (int)CommonEnum.UserType.InnerUser:
                        SessionState.UserType = CommonEnum.UserType.InnerUser;
                        SessionState.IsAdmin  = false;
                        break;

                    default:
                        SessionState.UserType = CommonEnum.UserType.InnerUser;
                        SessionState.IsAdmin  = false;
                        break;
                    }
                    SessionState.UserID   = entity.UserID;
                    SessionState.UserName = entity.UserName;
                    SessionState.Account  = entity.Account;
                    SessionState.OUID     = entity.OUID;
                    OUEntity OUEntity = new OUEntity(entity.OUID);
                    SessionState.OUType = OUEntity.OUType;
                    SessionState.OUName = OUEntity.OUName;
                    Response.Redirect("Platform/MainWeb/root.aspx");
                }
            }
            catch (Exception ex)
            {
                PageHelper.ShowExceptionMessage(ex);
            }
        }
Example #4
0
        /// <summary>
        /// 加载数据
        /// </summary>
        private void LoadData()
        {
            OUEntity entity       = new OUEntity(this.OUID);
            OUEntity parentEntity = new OUEntity(entity.OUParentID);

            txtOUName.Text = entity.OUName;
            if (this.OUID != -1)
            {
                drpOUList.SelectedValue = NDConvert.ToString(parentEntity.OUID);
            }
            else if (entity.OUParentID == 0)
            {
                drpOUList.Enabled = false;
            }
            txtDescriptipn.Text = entity.Description;
        }
Example #5
0
        /// <summary>
        /// 保存
        /// </summary>
        private void Save()
        {
            OUEntity entity = new OUEntity();

            entity.OUName = txtOUName.Text.Trim();
            entity.OUType = 1;
            if (this.OUID != -1)
            {
                entity.OUParentID = this.OUID;
            }
            else
            {
                entity.OUParentID = 0;
            }
            entity.Description = txtDescriptipn.Text.Trim();
            entity.SortIndex   = OUQuery.GetMaxSortIndex();
            entity.AddDate     = DateTime.Now;
            entity.IsDeleted   = false;
            new OURule().Add(entity);
        }
Example #6
0
        /// <summary>
        /// 获得URL参数
        /// </summary>
        private void GetUrlParameter()
        {
            if (Request.QueryString["Operation"] != null && Request.QueryString["Operation"] != "")
            {
                this.CurOperation = NDConvert.ToInt32(Request.QueryString["Operation"].ToString());
            }

            if (Request.QueryString["ID"] != null && Request.QueryString["ID"] != "")
            {
                this.OUID = NDConvert.ToInt64(Request.QueryString["ID"].ToString());

                if (this.CurOperation == (int)OperationEnum.INSERT)
                {
                    if (this.OUID != 0)
                    {
                        OUEntity entity = new OUEntity(this.OUID);
                        drpOUList.SelectedValue = NDConvert.ToString(entity.OUID);
                    }
                    //else
                    //{
                    //    drpOUList.Text = "无";
                    //}
                }
                else
                {
                    OUEntity entity = new OUEntity(this.OUID);
                    if (entity.OUParentID != 0)
                    {
                        OUEntity entityP = new OUEntity(entity.OUParentID);
                        drpOUList.SelectedValue = NDConvert.ToString(entityP.OUID);
                    }
                    //else
                    //{
                    //    drpOUList.Text = "无";
                    //}
                }
            }
        }
        /// <summary>
        /// 登陆验证事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnOk_Click(object sender, EventArgs e)
        {
            //帐号
            if (txtAccount.Text.Trim() == "")
            {
                PageHelper.ShowExceptionMessage("请输入用户名!");
                return;
            }

            //密码
            if (txtPwd.Text.Trim() == "")
            {
                PageHelper.ShowExceptionMessage("请输入密码!");
                return;
            }

            //验证码
            //if (txtCheckCode.Text.Trim() == "")
            //{
            //    PageHelper.ShowExceptionMessage("请输入验证码!");
            //    return;
            //}

            string CheckCode = "";

            //if (Session["CheckCode"] != null)
            //{
            //    CheckCode = Session["CheckCode"].ToString();
            //    Session.Remove("CheckCode");
            //}
            //else
            //{
            //    PageHelper.ShowExceptionMessage("验证码错误!");
            //    return;
            //}

            //if (CheckCode != "")
            //{
            //    if (CheckCode.ToLower() != txtCheckCode.Text.Trim().ToLower())
            //    {
            //        PageHelper.ShowExceptionMessage("验证码错误!");
            //        return;
            //    }
            //}
            //else
            //{
            //    PageHelper.ShowExceptionMessage("验证码错误!");
            //    return;
            //}


            try
            {
                string    dd = Security.EncryptQueryString("123@abcd");
                DataTable dt = new UserQuery().GetUserByAccount(txtAccount.Text.Trim());
                if (dt.Rows.Count > 0)
                {
                    UserEntity entity = new UserEntity(NDConvert.ToInt64(dt.Rows[0]["UserID"].ToString()));
                    if (entity.Status == 2) //锁定
                    {
                        PageHelper.ShowExceptionMessage("此用户已经被锁定,无法登陆,请与管理员联系!");
                        return;
                    }


                    if (Security.EncryptQueryString(txtPwd.Text.Trim()).ToLower() == entity.Password.ToLower())
                    {
                        switch (entity.UserType)
                        {
                        case (int)CommonEnum.UserType.Admin:
                            SessionState.UserType = CommonEnum.UserType.Admin;
                            SessionState.IsAdmin  = true;
                            break;

                        case (int)CommonEnum.UserType.InnerUser:
                            SessionState.UserType = CommonEnum.UserType.InnerUser;
                            SessionState.IsAdmin  = false;
                            break;

                        default:
                            SessionState.UserType = CommonEnum.UserType.InnerUser;
                            SessionState.IsAdmin  = false;
                            break;
                        }
                        SessionState.UserID   = entity.UserID;
                        SessionState.UserName = entity.UserName;
                        SessionState.Account  = entity.Account;
                        SessionState.OUID     = entity.OUID;
                        OUEntity OUEntity = new OUEntity(entity.OUID);
                        SessionState.OUType = OUEntity.OUType;
                        SessionState.OUName = OUEntity.OUName;
                        Response.Redirect("Platform/MainWeb/root.aspx");
                        return;
                    }
                }

                PageHelper.ShowExceptionMessage("帐号或密码错误!");
                txtAccount.Focus();
            }
            catch (Exception ex)
            {
                PageHelper.ShowExceptionMessage(ex);
            }
        }