コード例 #1
0
        public void AddToClose()
        {
            //CustPerm.T_SYS_ENTITYMENU = cbxMenu.SelectedItem as T_SYS_ENTITYMENU;
            CustPerm.T_SYS_PERMISSION = cbxPerm.SelectedItem as T_SYS_PERMISSION;

            //绑定公司
            T_HR_COMPANY company = lkCompany.DataContext as T_HR_COMPANY;

            if (company == null || string.IsNullOrEmpty(company.COMPANYID) || string.IsNullOrEmpty(company.CNAME))
            {
                CustPerm.COMPANYID   = "";
                CustPerm.COMPANYNAME = "";
            }
            else
            {
                CustPerm.COMPANYID   = company.COMPANYID;
                CustPerm.COMPANYNAME = company.CNAME;
            }

            //绑定部门
            T_HR_DEPARTMENT depart = lkDepartment.DataContext as T_HR_DEPARTMENT;

            if (depart == null || depart.T_HR_DEPARTMENTDICTIONARY == null ||
                string.IsNullOrEmpty(depart.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTNAME) ||
                string.IsNullOrEmpty(depart.DEPARTMENTID))
            {
                CustPerm.DEPARTMENTID   = "";
                CustPerm.DEPARTMENTNAME = "";
            }
            else
            {
                CustPerm.DEPARTMENTID   = depart.DEPARTMENTID;
                CustPerm.DEPARTMENTNAME = depart.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTNAME;
            }


            //绑定岗位
            T_HR_POST post = lkPost.DataContext as T_HR_POST;

            if (post == null || post.T_HR_POSTDICTIONARY == null ||
                string.IsNullOrEmpty(post.T_HR_POSTDICTIONARY.POSTNAME) ||
                string.IsNullOrEmpty(post.POSTID))
            {
                CustPerm.POSTID   = "";
                CustPerm.POSTNAME = "";
            }
            else
            {
                CustPerm.POSTID   = post.POSTID;
                CustPerm.POSTNAME = post.T_HR_POSTDICTIONARY.POSTNAME;
            }

            if (FormTypes.New == this.FormType)
            {
                CustPerm.CREATEDATE = System.DateTime.Now;
                ///TODO增加修改人
                //CustPerm.CREATEUSER = Common.CurrentLoginUserInfo.sysuserID;
                ServiceClient.EntityMenuCustomPermAddAsync(this.CustPerm);
            }
            else
            {
                CustPerm.UPDATEDATE = System.DateTime.Now;
                ///TODO增加修改人
                //CustPerm.UPDATEUSER = Common.CurrentLoginUserInfo.sysuserID;
                ServiceClient.EntityMenuCustomPermUpdateAsync(this.CustPerm);
            }
            saveType = "1";
            RefreshUI(RefreshedTypes.All);
        }