Beispiel #1
0
        /// <summary>
        /// 获得区县集合
        /// </summary>
        /// <param name="UserID"></param>
        /// <param name="provice"></param>
        /// <param name="city"></param>
        /// <param name="CompanyID"></param>
        /// <returns></returns>
        public object GetCountryListByUser(string UserID, string provice, string city, string CompanyID)
        {
            //加载操作表格对象
            AbsFacory      absfact = AbsFacory.CreatInstance();
            IhydStationBLL hsbll   = absfact.CreathydStationBllInstance();
            IWM_CompanyBLL cbll    = absfact.CreatIWM_CompanyBLLInstance();

            if (UserID == ConfigHelper.AppSettings("CurrentUserName"))
            {
                var city_Entity = hsbll.Query(p => p.Province == provice && p.City == city)
                                  .Select(x => new
                {
                    Country = x.County
                }).Distinct().ToList();
                return(city_Entity);
            }
            else
            {
                var pe = cbll.Query(p => p.CompanyId == CompanyID)
                         .Select(x => new ProvinceEntity
                {
                    Province = x.Province,
                    City     = x.City,
                    County   = x.County
                }).FirstOrDefault();
                if ((pe.City == "" || pe.City == null || pe.City == "&nbsp;") && (pe.County == "" || pe.City == null || pe.County == "&nbsp;"))
                {
                    var hs = hsbll.Query(p => p.Province == pe.Province && p.City == city)
                             .Select(x => new { Country = x.County }).Distinct().ToList();
                    return(hs);
                }
                else if ((pe.City != "" || pe.City != null || pe.City != "&nbsp;") && (pe.County == "" || pe.City == null || pe.County == "&nbsp;"))
                {
                    var hs = hsbll.Query(p => p.Province == pe.Province && p.City == city)
                             .Select(x => new { Country = x.County }).Distinct().ToList();
                    return(hs);
                }
                else if ((pe.City != "" || pe.City != null || pe.City != "&nbsp;") && (pe.County != "" || pe.City != null || pe.County != "&nbsp;"))
                {
                    var hs = hsbll.Query(p => p.Province == pe.Province && p.City == city && p.County == pe.County)
                             .Select(x => new { Country = x.County }).Distinct().ToList();
                    return(hs);
                }
            }
            return("");
        }
Beispiel #2
0
        /// <summary>
        /// 站点列表条件查询
        /// </summary>
        /// <param name="Provice">选中省份</param>
        /// <param name="City">选中城市</param>
        /// <param name="Country">选中区县</param>
        /// <param name="Stationid">站点编码</param>
        /// <param name="Stationname">站点名称</param>
        /// <returns></returns>
        public hystationEntity SearchStationListByConditional(string Provice, string City, string Country, int Stationid, string Stationname, int cp, int ps, string UserID, string CompanyID)
        {
            List <hydStation> hs      = new List <hydStation>();
            AbsFacory         absfact = AbsFacory.CreatInstance();
            IhydStationBLL    hsbll   = absfact.CreathydStationBllInstance();

            if ((Provice == "==请选择==" || Provice == "") && (City == "==请选择==" || City == "") && (Country == "==请选择==" || Country == "") && Stationid == 0 && (Stationname == null || Stationname == ""))
            {
                if (UserID == ConfigHelper.AppSettings("CurrentUserName"))
                {
                    hs = hsbll.Query(p => true).ToList();
                }
                else
                {
                    IWM_CompanyBLL cbll = absfact.CreatIWM_CompanyBLLInstance();
                    var            pe   = cbll.Query(p => p.CompanyId == CompanyID)
                                          .Select(x => new ProvinceEntity
                    {
                        Province = x.Province,
                        City     = x.City,
                        County   = x.County
                    }).FirstOrDefault();
                    if ((pe.City == "" || pe.City == null || pe.City == "&nbsp;") && (pe.County == "" || pe.City == null || pe.County == "&nbsp;"))
                    {
                        hs = hsbll.Query(p => p.Province == pe.Province).ToList();
                    }
                    else if ((pe.City != "" || pe.City != null || pe.City != "&nbsp;") && (pe.County == "" || pe.City == null || pe.County == "&nbsp;"))
                    {
                        hs = hsbll.Query(p => p.Province == pe.Province && p.City == pe.City).ToList();
                    }
                    else if ((pe.City != "" || pe.City != null || pe.City != "&nbsp;") && (pe.County != "" || pe.City != null || pe.County != "&nbsp;"))
                    {
                        hs = hsbll.Query(p => p.Province == pe.Province && p.City == pe.City && p.County == pe.County).ToList();
                    }
                }
            }
            else if ((Provice == "==请选择==" || Provice == "") && (City == "==请选择==" || City == "") && (Country == "==请选择==" || Country == "") && Stationid != 0)
            {
                hs = hsbll.Query(p => p.StationID == Stationid).ToList();
            }
            else if ((Provice == "==请选择==" || Provice == "") && (City == "==请选择==" || City == "") && (Country == "==请选择==" || Country == "") && (Stationname != "" && Stationname != null))
            {
                hs = hsbll.Query(p => p.StationName == Stationname).ToList();
            }
            else if ((Provice == "==请选择==" || Provice == "") && (City == "==请选择==" || City == "") && (Country == "==请选择==" || Country == "") && Stationid != 0 && (Stationname != "" && Stationname != null))
            {
                hs = hsbll.Query(p => p.StationID == Stationid && p.StationName == Stationname).ToList();
            }
            else if ((Provice != "==请选择==" || Provice != "") && City == "==请选择==" && Country == "==请选择==" && Stationid == 0 && (Stationname == null || Stationname == ""))
            {
                hs = hsbll.Query(p => p.Province == Provice).ToList();
            }
            else if ((Provice != "==请选择==" || Provice != "") && City == "==请选择==" && Country == "==请选择==" && Stationid != 0)
            {
                hs = hsbll.Query(p => p.Province == Provice && p.StationID == Stationid).ToList();
            }
            else if ((Provice != "==请选择==" || Provice != "") && City == "==请选择==" && Country == "==请选择==" && (Stationname != "" && Stationname != null))
            {
                hs = hsbll.Query(p => p.Province == Provice && p.StationName == Stationname).ToList();
            }
            else if ((Provice != "==请选择==" && Provice != "") && (City != "==请选择==" && City != "") && Country == "==请选择==" && Stationid == 0 && (Stationname == null || Stationname == ""))
            {
                hs = hsbll.Query(p => p.Province == Provice && p.City == City).ToList();
            }
            else if ((Provice != "==请选择==" && Provice != "") && (City != "==请选择==" && City != "") && Country == "==请选择==" && Stationid != 0)
            {
                hs = hsbll.Query(p => p.Province == Provice && p.City == City && p.StationID == Stationid).ToList();
            }
            else if ((Provice != "==请选择==" && Provice != "") && (City != "==请选择==" && City != "") && Country == "==请选择==" && (Stationname != "" && Stationname != null))
            {
                hs = hsbll.Query(p => p.Province == Provice && p.City == City && p.StationName == Stationname).ToList();
            }
            else if ((Provice != "==请选择==" && Provice != "") && (City != "==请选择==" && City != "") && (Country != "==请选择==" && Country != "") && Stationid == 0 && (Stationname == null || Stationname == ""))
            {
                hs = hsbll.Query(p => p.Province == Provice && p.City == City && p.County == Country).ToList();
            }
            else if ((Provice != "==请选择==" && Provice != "") && (City != "==请选择==" && City != "") && (Country != "==请选择==" && Country != "") && Stationid != 0)
            {
                //int StationID=
                hs = hsbll.Query(p => p.Province == Provice && p.City == City && p.County == Country && p.StationID == Stationid).ToList();
            }
            else if ((Provice != "==请选择==" && Provice != "") && (City != "==请选择==" && City != "") && (Country != "==请选择==" && Country != "") && (Stationname != "" && Stationname != null))
            {
                hs = hsbll.Query(p => p.Province == Provice && p.City == City && p.County == Country && p.StationName == Stationname).ToList();
            }
            List <hydStation> hs_ = new List <hydStation>();

            hs_ = hs.Skip(cp).Take(ps).ToList();
            hystationEntity hsentity = new hystationEntity();

            hsentity.rows  = hs_;
            hsentity.total = hs.Count;
            hsentity.page  = hs.Count / 5;
            return(hsentity);
        }
Beispiel #3
0
        /// <summary>
        /// 查询站点列表和省份集合
        /// </summary>
        /// <param name="CompanyID"></param>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public StructuralEntity GetSationList(string CompanyID, string UserID)
        {
            StructuralEntity StEntity = new StructuralEntity();
            //加载操作表格对象
            AbsFacory      absfact = AbsFacory.CreatInstance();
            IhydStationBLL hsbll   = absfact.CreathydStationBllInstance();
            IWM_CompanyBLL cbll    = absfact.CreatIWM_CompanyBLLInstance();

            //超级管理员账户
            if (UserID == ConfigHelper.AppSettings("CurrentUserName"))
            {
                //加载所有站点信息
                //List<hydStation> hs = hsbll.Query(p=>true).ToList();
                //加载所有省份信息
                List <ProvinceEntity> pentity = new List <ProvinceEntity>();
                var pe = cbll.Query(p => true)
                         .Select(x => new
                {
                    x.Province
                }).Distinct().ToList();
                for (int i = 0; i < pe.Count; i++)
                {
                    ProvinceEntity ppe = new ProvinceEntity();
                    ppe.Province = pe[i].Province;
                    pentity.Add(ppe);
                }
                //StEntity.stationEntity = hs;
                StEntity.provinceEntity = pentity;
            }
            else//区域管理员账户
            {
                //加载区域管理员账户管辖的所有站点信息
                //List<hydStation> hs = new List<hydStation>();
                //List<ProvinceEntity> pe = new List<ProvinceEntity>();
                var pe = cbll.Query(p => p.CompanyId == CompanyID)
                         .Select(x => new ProvinceEntity
                {
                    Province = x.Province,
                    City     = x.City,
                    County   = x.County
                }).FirstOrDefault();
                //if ((pe.City==""||pe.City==null||pe.City== "&nbsp;")&&(pe.County==""||pe.City==null||pe.County== "&nbsp;"))
                //{
                //    hs = hsbll.Query(p => p.Province == pe.Province).ToList();
                //}
                //else if((pe.City != "" || pe.City != null || pe.City != "&nbsp;") && (pe.County == "" || pe.City == null || pe.County == "&nbsp;"))
                //{
                //    hs = hsbll.Query(p => p.Province == pe.Province&&p.City==pe.City).ToList();
                //}
                //else if ((pe.City != "" || pe.City != null || pe.City != "&nbsp;") && (pe.County != "" || pe.City != null || pe.County != "&nbsp;"))
                //{
                //    hs = hsbll.Query(p => p.Province == pe.Province && p.City == pe.City&&p.County==pe.County).ToList();
                //}
                List <ProvinceEntity> provice = new List <ProvinceEntity>();
                ProvinceEntity        pentity = new ProvinceEntity();
                pentity.Province = pe.Province;
                provice.Add(pentity);
                //StEntity.stationEntity = hs;
                StEntity.provinceEntity = provice;
            }
            return(StEntity);
        }