Ejemplo n.º 1
0
 //页面加载
 void UCRoleCheck_Loaded(object sender, RoutedEventArgs e)
 {
     m_facade   = new VendorFacade();
     filter     = new VendorRoleQueryFilter();
     roleListVM = new VendorUserRoleListVM();
     LoadAllActiveRoles();
     LoadSettedRoles(AgentSysNo, UserSysNo);
 }
Ejemplo n.º 2
0
        public UCVendorRoleQuery(int?roleSysNo)
        {
            InitializeComponent();

            BindComboBoxData();

            SeachBuilder.DataContext = m_query = new VendorRoleQueryFilter();

            m_query.RoleSysNo = roleSysNo;
            if (m_query.RoleSysNo != null && m_query.RoleSysNo != 0)
            {
                this.txtRoleSysNo.Text = m_query.RoleSysNo.Value.ToString();
                this.QueryResultGrid.Bind();
            }
        }
Ejemplo n.º 3
0
        public void QueryVendorRoleVM(VendorRoleQueryFilter query, Action <List <RoleMgmtSearchResultVM>, int> callback)
        {
            string relativeUrl = "/ExternalSYSService/ExternalSYS/QueryVendorRole";


            restClient.QueryDynamicData(relativeUrl, query, (sender, e) =>
            {
                if (!e.FaultsHandle())
                {
                    if (e.Result != null && callback != null)
                    {
                        List <RoleMgmtSearchResultVM> dataVMList = DynamicConverter <RoleMgmtSearchResultVM> .ConvertToVMList(e.Result.Rows);
                        callback(dataVMList, e.Result.TotalCount);
                    }
                }
            });
        }
Ejemplo n.º 4
0
        public override void OnPageLoad(object sender, EventArgs e)
        {
            base.OnPageLoad(sender, e);
            SeachBuilder.DataContext = m_query = new VendorRoleQueryFilter();

            m_facade = new VendorFacade();
            vm       = new RoleMgmtVM();

            this.cmbStatus.ItemsSource   = EnumConverter.GetKeyValuePairs <ECCentral.BizEntity.ExternalSYS.ValidStatus>(EnumConverter.EnumAppendItemType.All);
            this.cmbStatus.SelectedIndex = 0;

            this.ResultGrid.DataContext = vm;


            m_facade.GetPrivilegeList((o, rst) =>
            {
                if (!rst.FaultsHandle() && rst.Result != null)
                {
                    privilegeData = TransferToNodes(rst.Result);
                }
            });
        }
Ejemplo n.º 5
0
 public QueryResult QueryVendorRole(VendorRoleQueryFilter filter)
 {
     return(QueryList <VendorRoleQueryFilter>(filter, ObjectFactory <IVendorRoleDA> .Instance.RoleQuery));
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 角色查询
        /// </summary>
        /// <param name="query">过滤条件</param>
        /// <param name="callback">回调函数</param>
        public void QueryVendorRole(VendorRoleQueryFilter query, EventHandler <RestClientEventArgs <dynamic> > callback)
        {
            string relativeUrl = "/ExternalSYSService/ExternalSYS/QueryVendorRole";

            restClient.QueryDynamicData(relativeUrl, query, callback);
        }
Ejemplo n.º 7
0
        public DataTable RoleQuery(VendorRoleQueryFilter filter, out int dataCount)
        {
            if (filter.PagingInfo != null && filter.PagingInfo.SortBy != null)
            {
                string sortCondition = filter.PagingInfo.SortBy.Trim();

                Match match = Regex.Match(sortCondition, @"^(?<SortColumn>[\S]+)(?:\s+(?<SortType>ASC|DESC))?$", RegexOptions.IgnoreCase);
                if (match.Groups["SortColumn"].Success)
                {
                    string sortColumn = match.Groups["SortColumn"].Value;
                    string sortType   = match.Groups["SortType"].Success ?
                                        match.Groups["SortType"].Value : "DESC";
                    #region switch
                    switch (sortColumn)
                    {
                    case "SysNo":
                        filter.PagingInfo.SortBy =
                            String.Format("{0} {1}", "SysNo", sortType);
                        break;

                    case "RoleName":
                        filter.PagingInfo.SortBy =
                            String.Format("{0} {1}", "RoleName", sortType);
                        break;

                    case "Status":
                        filter.PagingInfo.SortBy =
                            String.Format("{0} {1}", "Status", sortType);
                        break;

                    case "InUser":
                        filter.PagingInfo.SortBy =
                            String.Format("{0} {1}", "InUser", sortType);
                        break;

                    case "InDate":
                        filter.PagingInfo.SortBy =
                            String.Format("{0} {1}", "InDate", sortType);
                        break;

                    case "EditUser":
                        filter.PagingInfo.SortBy =
                            String.Format("{0} {1}", "EditUser", sortType);
                        break;

                    case "EditDate":
                        filter.PagingInfo.SortBy =
                            String.Format("{0} {1}", "EditDate", sortType);
                        break;
                    }
                    #endregion
                }
            }
            CustomDataCommand command = DataCommandManager.
                                        CreateCustomDataCommandFromConfig("ExternalSYS_Query_VendorRole");
            using (DynamicQuerySqlBuilder builder = new DynamicQuerySqlBuilder(
                       command.CommandText, command, HelpDA.ToPagingInfo(filter.PagingInfo), "SysNo DESC"))
            {
                builder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                          "SysNo", DbType.Int32,
                                                          "@SysNo", QueryConditionOperatorType.Equal,
                                                          filter.RoleSysNo);

                builder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                          "RoleName", DbType.String,
                                                          "@RoleName", QueryConditionOperatorType.LeftLike,
                                                          filter.RoleName);

                builder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                          "Status", DbType.AnsiStringFixedLength,
                                                          "@Status", QueryConditionOperatorType.Equal,
                                                          filter.Status);
                if (!string.IsNullOrEmpty(filter.PrivilegeName))
                {
                    ConditionConstructor subQueryBuilder = builder.ConditionConstructor.AddSubQueryCondition(QueryConditionRelationType.AND, null, QueryConditionOperatorType.Exist,
                                                                                                             @"SELECT 1 
            FROM (
                    SELECT 
                        [RoleSysNo] 
                    FROM [IPP3].[dbo].[VendorUser_Role_Privilege]  WITH(NOLOCK)
                    WHERE 
                        [PrivilegeSysNo] IN ( 
                                SELECT 
                                    [SysNo]      
                                FROM [IPP3].[dbo].[VendorUser_Privilege]  WITH(NOLOCK)
                                WHERE 
                                    [Memo] LIKE @PrivilegeName
                            )
                 ) AS RESULT 
            WHERE 
                RESULT.[RoleSysNo]=[VendorUser_Role].[SysNo]");
                    command.AddInputParameter("@PrivilegeName", DbType.String,
                                              filter.PrivilegeName + "%");
                }

                command.CommandText = builder.BuildQuerySql();
                var dt = command.ExecuteDataTable("Status", typeof(ValidStatus));

                dataCount = Convert.ToInt32(command.GetParameterValue("@TotalCount"));
                return(dt);
            }
        }