/// <summary>
        /// 获取客户端列表
        /// </summary>
        public static List<Clients> GetClients(string keyWords, string orderBy,int pageSize, int pageIndex, ref int totalCount, ref int pageCount)
        {
            string sqlWhere = "a.Status<>9";
            if (!string.IsNullOrEmpty(keyWords))
                sqlWhere += " and ( a.CompanyName like '%" + keyWords + "%'  or  a.MobilePhone like '%" + keyWords + "%' )";
            bool isAsc = false;
            if (string.IsNullOrEmpty(orderBy))
            {
                orderBy = "a.AutoID";
            }
            else
            {
                isAsc = orderBy.IndexOf(" asc") > -1 ? true : false;
                orderBy = orderBy.Replace(" desc", "").Replace(" asc", "");
            }
            string sqlColumn = @" a.AutoID,a.ClientID, a.CompanyName,a.Logo,a.Industry,
                                    a.CityCode,a.Address,a.PostalCode,a.ContactName,a.MobilePhone,a.OfficePhone,
                                    a.Status,b.EndTime,b.UserQuantity,a.TotalIn,a.TotalOut,a.FreezeMoney,
                                    a.Description,a.AuthorizeType,a.IsDefault,a.AgentID,a.CreateTime,a.CreateUserID ";
            DataTable dt = CommonBusiness.GetPagerData("Clients a  join Agents b on a.ClientID=b.ClientID", sqlColumn, sqlWhere, orderBy, pageSize, pageIndex, out totalCount, out pageCount, isAsc);
            List<Clients> list = new List<Clients>();
            Clients model; 
            foreach (DataRow item in dt.Rows)
            {
                model = new Clients();
                model.FillData(item);

                model.City = CommonBusiness.Citys.Where(c => c.CityCode == model.CityCode).FirstOrDefault();
                model.IndustryEntity =Manage.IndustryBusiness.GetIndustrys().Where(i => i.IndustryID.ToLower() == model.Industry.ToLower()).FirstOrDefault();
                list.Add(model);
            }

            return list;
        }
Beispiel #2
0
        public static Clients GetClientDetail(string clientID)
        {
            DataTable dt = ClientDAL.BaseProvider.GetClientDetail(clientID);
            Clients model = new Clients();
            if (dt.Rows.Count==1)
            {
                DataRow row=dt.Rows[0];
                model.FillData(row);
                model.City = CommonBusiness.Citys.Where(c => c.CityCode == model.CityCode).FirstOrDefault();
                model.IndustryEntity =Manage.IndustryBusiness.GetIndustrys().Where(i => i.IndustryID.ToLower() == model.Industry.ToLower()).FirstOrDefault();
                model.Modules = ModulesBusiness.GetModulesByClientID(clientID);
            }

            return model;
        }
Beispiel #3
0
        /// <summary>
        /// 获取客户端列表
        /// </summary>
        /// <param name="keyWords"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <param name="totalCount"></param>
        /// <param name="pageCount"></param>
        /// <returns></returns>
        public static List<Clients> GetClients(string keyWords, int pageSize, int pageIndex, ref int totalCount, ref int pageCount)
        {
            string whereSql = "Status<>9";
            if (!string.IsNullOrEmpty(keyWords))
                whereSql += " and ( CompanyName like '%" + keyWords + "%'  or  MobilePhone like '%" + keyWords + "%')";
            DataTable dt = CommonBusiness.GetPagerData("Clients", "*", whereSql, "AutoID", pageSize, pageIndex, out totalCount, out pageCount);
            List<Clients> list = new List<Clients>();
            Clients model;
            foreach (DataRow item in dt.Rows)
            {
                model = new Clients();
                model.FillData(item);
                model.City = CommonBusiness.Citys.Where(c => c.CityCode == model.CityCode).FirstOrDefault();
                model.IndustryEntity =Manage.IndustryBusiness.GetIndustrys().Where(i => i.IndustryID.ToLower() == model.Industry.ToLower()).FirstOrDefault();
                list.Add(model);
            }

            return list;
        }
Beispiel #4
0
        /// <summary>
        /// 获取客户端详情
        /// </summary>
        public static Clients GetClientDetail(string clientID)
        {
            if (!Clients.ContainsKey(clientID))
            {
                DataTable dt = ClientDAL.BaseProvider.GetClientDetail(clientID);
                Clients model = new Clients();
                if (dt.Rows.Count == 1)
                {
                    DataRow row = dt.Rows[0];
                    model.FillData(row);

                    model.City = CommonBusiness.Citys.Where(c => c.CityCode == model.CityCode).FirstOrDefault();
                    model.IndustryEntity = Manage.IndustryBusiness.GetIndustrys().Where(i => i.IndustryID.ToLower() == model.Industry.ToLower()).FirstOrDefault();

                    Clients.Add(model.ClientID, model);
                }
                else
                    return null;
            }

            return Clients[clientID];
        }