Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 17, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.冻结, NFMT.Common.OperateEnum.解除冻结 });

                this.navigation1.Routes.Add("部门管理", string.Format("{0}User/DepartmentList.aspx", NFMT.Common.DefaultValue.NftmSiteName));
                this.navigation1.Routes.Add("部门明细", string.Empty);

                if (!string.IsNullOrEmpty(Request.QueryString["id"]))
                {
                    if (int.TryParse(Request.QueryString["id"], out id))
                    {
                        if (id == 0)
                            Response.Redirect("DepartmentList.aspx");

                        NFMT.User.BLL.DepartmentBLL deptBLL = new NFMT.User.BLL.DepartmentBLL();
                        var result = deptBLL.Get(user, id);
                        if (result.ResultStatus != 0)
                            Response.Redirect("DepartmentList.aspx");

                        NFMT.User.Model.Department dept = result.ReturnValue as NFMT.User.Model.Department;
                        if (dept != null)
                        {
                            this.ddlCorpId.InnerText = dept.CorpName;
                            this.txbDeptCode.InnerText = dept.DeptCode;
                            this.txbDeptName.InnerText = dept.DeptName;
                            this.txbDeptFullName.InnerText = dept.DeptFullName;
                            this.txbDeptShort.InnerText = dept.DeptShort;
                            NFMT.Data.Model.BDStyleDetail bd = NFMT.Data.DetailProvider.Details(NFMT.Data.StyleEnum.DeptType)[dept.DeptType];
                            if (bd != null)
                                this.ddlDeptType.InnerText = bd.DetailName;
                            this.ddlParentDeptName.InnerText = dept.ParentDeptName;
                            //this.ddlDeptLevel.InnerText = dept.DeptLevel.ToString();

                            this.hidId.Value = dept.DeptId.ToString();

                            System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                            string json = serializer.Serialize(dept);
                            this.hidModel.Value = json;
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 80, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.录入 });

                this.navigation1.Routes.Add("员工部门分配-部门列表", string.Format("{0}User/DeptList.aspx", NFMT.Common.DefaultValue.NftmSiteName));
                this.navigation1.Routes.Add("员工分配", string.Empty);

                int deptId = 0;
                if (string.IsNullOrEmpty(Request.QueryString["deptId"]))
                    Response.Redirect("DeptList.aspx");

                if(!int.TryParse(Request.QueryString["deptId"],out deptId))
                    Response.Redirect("DeptList.aspx");

                NFMT.User.BLL.DepartmentBLL bll = new NFMT.User.BLL.DepartmentBLL();
                NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
                NFMT.Common.ResultModel result = bll.Get(user,deptId);
                if(result.ResultStatus!=0)
                    Response.Redirect("DeptList.aspx");
                NFMT.User.Model.Department dept = result.ReturnValue as NFMT.User.Model.Department;

                if(dept == null || dept.DeptId ==0)
                    Response.Redirect("DeptList.aspx");

                NFMT.User.BLL.CorporationBLL corpBll = new NFMT.User.BLL.CorporationBLL();
                result = corpBll.Get(user, dept.CorpId);
                if(result.ResultStatus !=0)
                    Response.Redirect("DeptList.aspx");
                NFMT.User.Model.Corporation corp = result.ReturnValue as NFMT.User.Model.Corporation;
                if (corp == null || corp.CorpId == 0 || !corp.IsSelf)
                    Response.Redirect("DeptList.aspx");

                //设置部门信息
                this.spnDeptCode.InnerHtml = dept.DeptCode;
                this.spnDeptName.InnerHtml = dept.DeptName;
                this.spnCorpName.InnerHtml = corp.CorpName;

                NFMT.Data.StyleEnum style = NFMT.Data.StyleEnum.部门类型;
                NFMT.Data.Model.BDStyleDetail detail = NFMT.Data.DetailProvider.Details(style)[dept.DeptType];
                this.spnDeptType.InnerHtml = detail.DetailName;

                this.hidDeptId.Value = dept.DeptId.ToString();

            }
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 17, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.修改 });

                this.navigation1.Routes.Add("部门管理", string.Format("{0}User/DepartmentList.aspx", NFMT.Common.DefaultValue.NftmSiteName));
                this.navigation1.Routes.Add("部门修改", string.Empty);

                int id = 0;
                if (!string.IsNullOrEmpty(Request.QueryString["id"]))
                {
                    if (int.TryParse(Request.QueryString["id"], out id))
                    {
                        if (id == 0)
                            Response.Redirect("DepartmentList.aspx");

                        NFMT.User.BLL.DepartmentBLL deptBLL = new NFMT.User.BLL.DepartmentBLL();
                        var result = deptBLL.Get(user, id);
                        if (result.ResultStatus != 0)
                            Response.Redirect("DepartmentList.aspx");

                        NFMT.User.Model.Department dept = result.ReturnValue as NFMT.User.Model.Department;
                        if (dept != null)
                        {
                            this.hidCorpId.Value = dept.CorpId.ToString();
                            this.hidDeptType.Value = dept.DeptType.ToString();
                            //this.hidDeptLevel.Value = dept.DeptLevel.ToString();
                            this.hidParentDeptId.Value = dept.ParentLeve.ToString();

                            this.txbDeptCode.Value = dept.DeptCode;
                            this.txbDeptName.Value = dept.DeptName;
                            this.txbDeptFullName.Value = dept.DeptFullName;
                            this.txbDeptShort.Value = dept.DeptShort;
                        }
                    }
                    this.hidStyleId.Value = ((int)NFMT.Data.StyleEnum.部门类型).ToString();
                }
            }
        }
Ejemplo n.º 4
0
        public void ProcessRequest(HttpContext context)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            context.Response.ContentType = "text/plain";

            int corpId = 0;
            string deptCode = context.Request.Form["DeptCode"];
            string deptName = context.Request.Form["DeptName"];
            string deptFullName = context.Request.Form["DeptFullName"];
            string deptShort = context.Request.Form["DeptShort"];
            int deptType = 0;
            int parentLeve = 0;
            int deptLevel = 0;
            int id = 0;

            string resultStr = "修改失败";

            if (string.IsNullOrEmpty(context.Request.Form["id"]))
            {
                resultStr = "id未知";
                context.Response.Write(resultStr);
                context.Response.End();
            }

            if (!int.TryParse(context.Request.Form["id"], out id))
            {
                resultStr = "id未知";
                context.Response.Write(resultStr);
                context.Response.End();
            }

            if (string.IsNullOrEmpty(deptName))
            {
                resultStr = "部门名称不能为空";
                context.Response.Write(resultStr);
                context.Response.End();
            }

            if (!string.IsNullOrEmpty(context.Request.Form["CorpId"]))
            {
                if (!int.TryParse(context.Request.Form["CorpId"], out corpId))
                {
                    resultStr = "所属公司转换错误";
                    context.Response.Write(resultStr);
                    context.Response.End();
                }
            }

            if (!string.IsNullOrEmpty(context.Request.Form["DeptType"]))
            {
                if (!int.TryParse(context.Request.Form["DeptType"], out deptType))
                {
                    resultStr = "部门类型转换错误";
                    context.Response.Write(resultStr);
                    context.Response.End();
                }
            }

            if (!string.IsNullOrEmpty(context.Request.Form["ParentLeve"].Trim()))
            {
                if (!int.TryParse(context.Request.Form["ParentLeve"], out parentLeve))
                {
                    resultStr = "上级部门转换错误";
                    context.Response.Write(resultStr);
                    context.Response.End();
                }
            }
            if (!string.IsNullOrEmpty(context.Request.Form["DeptLevel"]))
            {
                if (!int.TryParse(context.Request.Form["DeptLevel"], out deptLevel))
                {
                    resultStr = "部门级别转换错误";
                    context.Response.Write(resultStr);
                    context.Response.End();
                }
            }

            NFMT.User.BLL.DepartmentBLL deptBLL = new NFMT.User.BLL.DepartmentBLL();
            NFMT.Common.ResultModel result = deptBLL.Get(user, id);
            if (result.ResultStatus != 0)
            {
                resultStr = "获取数据错误";
                context.Response.Write(resultStr);
                context.Response.End();
            }
            NFMT.User.Model.Department dept = result.ReturnValue as NFMT.User.Model.Department;
            if (dept != null)
            {
                dept.CorpId = corpId;
                dept.DeptCode = deptCode;
                dept.DeptName = deptName;
                dept.DeptFullName = deptFullName;
                dept.DeptShort = deptShort;
                dept.DeptType = deptType;
                dept.ParentLeve = parentLeve;
                dept.DeptLevel = deptLevel;

                result = deptBLL.Update(user, dept);
                resultStr = result.Message;
            }

            context.Response.Write(resultStr);
            context.Response.End();
        }