Esempio n. 1
0
        /// <summary>
        /// 获取连锁端用户信息
        /// </summary>
        /// <param name="dicPar"></param>
        private void Detail(Dictionary <string, object> dicPar)
        {
            //要检测的参数信息
            List <string> pra = new List <string>()
            {
                "GUID", "USER_ID", "userid"
            };

            //检测方法需要的参数
            if (!CheckActionParameters(dicPar, pra))
            {
                return;
            }
            StringBuilder postStr = new StringBuilder();
            //获取参数信息
            string GUID    = dicPar["GUID"].ToString();
            string USER_ID = dicPar["USER_ID"].ToString();
            string userid  = dicPar["userid"].ToString();
            string BusCode = string.Empty;

            if (dicPar.ContainsKey("BusCode"))
            {
                BusCode = dicPar["BusCode"].ToString();
            }
            int currentPage = StringHelper.StringToInt(dicPar["page"].ToString());
            int recordCount = 0;
            int totalPage   = 0;

            dt = new bllAdmins().GetPagingListInfo(GUID, USER_ID, 1, 1, "where t.userid=" + userid, "", out recordCount, out totalPage);

            #region 信息
            DataTable dtUserRole = new bllTB_UserRole().GetRoleListUser(userid, "");
            #endregion

            DataTable dtLocalUserRoleName = new bllTB_UserRole().GetUserRoleNameList(BusCode);
            if (dt != null && dt.Rows.Count > 0 && dtLocalUserRoleName != null && dtLocalUserRoleName.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    dr["rolename"] = "";
                    string    auserid = dr["userid"].ToString();
                    DataRow[] rdrs    = dtLocalUserRoleName.Select("UserId='" + auserid + "'");
                    foreach (DataRow rdr in rdrs)
                    {
                        dr["rolename"] += rdr["RoleName"].ToString() + "、";
                    }
                    dr["rolename"] = dr["rolename"].ToString().TrimEnd('、');
                }
            }
            dt.AcceptChanges();
            ArrayList arrData   = new ArrayList();
            string[]  arrTBName = new string[2] {
                "data1", "data2"
            };
            arrData.Add(dt);
            arrData.Add(dtUserRole);
            ReturnManyListJson("0", "", arrData, arrTBName, null, null, null, null);
        }
Esempio n. 2
0
        /// <summary>
        /// 获取连锁端用户信息-不分门店
        /// </summary>
        /// <param name="dicPar"></param>
        private void GetListAll(Dictionary <string, object> dicPar)
        {
            //要检测的参数信息
            List <string> pra = new List <string>()
            {
                "GUID", "USER_ID", "userid", "page", "limit", "filters", "orders"
            };

            //检测方法需要的参数
            if (!CheckActionParameters(dicPar, pra))
            {
                return;
            }
            StringBuilder postStr = new StringBuilder();
            //获取参数信息
            string    GUID        = dicPar["GUID"].ToString();
            string    userid      = dicPar["userid"].ToString();
            string    USER_ID     = dicPar["USER_ID"].ToString();
            int       pageSize    = StringHelper.StringToInt(dicPar["limit"].ToString());
            int       currentPage = StringHelper.StringToInt(dicPar["page"].ToString());
            string    filter      = JsonHelper.ObjectToJSON(dicPar["filters"]);
            DataTable dtFilter    = new DataTable();

            if (filter.Length > 0 && filter != "[]")
            {
                filter = JsonHelper.JsonToFilterByString(filter, out dtFilter);
                if (dtFilter != null)
                {
                    DataRow[] drArr = dtFilter.Select("cus<>''");
                    foreach (DataRow dr in drArr)
                    {
                        string col = dr["col"].ToString();
                        switch (col)
                        {
                        case "":
                            filter += "";
                            break;
                        }
                    }
                }
            }
            else
            {
                filter = string.Empty;
            }
            string BusCode = string.Empty;

            if (dicPar.ContainsKey("BusCode"))
            {
                BusCode = dicPar["BusCode"].ToString();
            }

            string order = JsonHelper.ObjectToJSON(dicPar["orders"]);

            if (order.Length > 0)
            {
                order = JsonHelper.JsonToOrderByString(order);
            }
            int recordCount = 0;
            int totalPage   = 0;

            dt = new bllAdmins().GetPagingListInfo(GUID, USER_ID, pageSize, currentPage, filter, order, out recordCount, out totalPage);
            DataTable dtLocalUserRoleName = new bllTB_UserRole().GetUserRoleNameList(BusCode);

            if (dt != null && dt.Rows.Count > 0 && dtLocalUserRoleName != null && dtLocalUserRoleName.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    dr["rolename"] = "";
                    string    auserid = dr["userid"].ToString();
                    DataRow[] rdrs    = dtLocalUserRoleName.Select("UserId='" + auserid + "'");
                    foreach (DataRow rdr in rdrs)
                    {
                        dr["rolename"] += rdr["RoleName"].ToString() + "、";
                    }
                    dr["rolename"] = dr["rolename"].ToString().TrimEnd('、');
                }
            }
            dt.AcceptChanges();
            ReturnListJson(dt, pageSize, recordCount, currentPage, totalPage);
        }