예제 #1
0
        /// <summary>
        /// 登录验证
        /// </summary>
        /// <param name="UserID"></param>
        /// <param name="PassWord"></param>
        /// <returns></returns>
        public bool GetUserObjCheck(string UserID, string PassWord, out string backMsg)
        {
            backMsg = "";
            //加载操作表格对象
            AbsFacory absfact = AbsFacory.CreatInstance();
            //加载用户表
            IWM_UserBLL iusbll = absfact.CreatIWM_UserBllInstance();
            //根据登录账号得到用户对象
            var obj = iusbll.Query(p => p.Account == UserID).FirstOrDefault();

            //判断是不是超级管理员系统账户
            if (UserID == ConfigHelper.AppSettings("CurrentUserName"))
            {
                if (Md5Helper.MD5(DESEncrypt.Encrypt(PassWord.ToLower(), Md5Helper.GetMD5Code()).ToLower(), 32).ToLower() == ConfigHelper.AppSettings("CurrentPassword"))
                {
                    backMsg = "";
                    return(true);
                }
                else
                {
                    backMsg = "密码错误!";
                }
            }
            else
            {
                if (obj != null)
                {
                    //验证用户填写密码是否与数据库密码一致
                    string passWord = obj.Password;
                    if (Md5Helper.MD5(DESEncrypt.Encrypt(PassWord.ToLower(), Md5Helper.GetMD5Code()).ToLower(), 32).ToLower() == passWord)
                    {
                        backMsg = obj.CompanyID;
                        return(true);
                    }
                    else
                    {
                        backMsg = "密码错误!";
                    }
                }
                else
                {
                    backMsg = "用户或密码错误!";
                }
            }
            return(false);
        }
예제 #2
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("");
        }
예제 #3
0
        public NSY_RTRUNEntity GetWaterDataByConditional(string StationId, DateTime?Sdate, DateTime?Edate, string StationName, int cp, int ps, string transType)
        {
            var _sdate               = Sdate == null ? new DateTime(1999, 1, 1) : Sdate.Value;
            var _edate               = Edate == null ? new DateTime(2999, 1, 1) : Edate.Value;
            List <NSY_RTRUN> nsy     = new List <NSY_RTRUN>();
            AbsFacory        absfact = AbsFacory.CreatInstance();
            INSY_RTRUNBLL    nsybll  = absfact.CreatINSY_RTRUNBLLInstance();

            if (transType == "" || transType == null || transType == "全部报")
            {
                nsy = nsybll.Query(p => p.STCD == StationId && p.DATATYPE == "39" && p.INSERTTM >= _sdate && p.INSERTTM <= _edate)
                      .OrderByDescending(s => s.TM)
                      .ToList();
            }
            else
            {
                var transType_ = 0;
                if (transType == "加报报")
                {
                    transType_ = 5;
                }
                else if (transType == "定时报")
                {
                    transType_ = 60;
                }
                nsy = nsybll.Query(p => p.STCD == StationId &&
                                   p.DATATYPE == "39" && p.INSERTTM >= _sdate &&
                                   p.INSERTTM <= _edate && p.PDR == transType_)
                      .OrderByDescending(s => s.TM)
                      .ToList();
            }
            List <NSY_RTRUN> nsyShow = new List <NSY_RTRUN>();

            nsyShow = nsy.Skip(cp).Take(ps)
                      .ToList();
            NSY_RTRUNEntity nsyEntity = new NSY_RTRUNEntity();

            nsyEntity.rows  = nsyShow;
            nsyEntity.total = nsy.Count;
            nsyEntity.page  = nsy.Count / 5;
            return(nsyEntity);
        }
예제 #4
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);
        }
예제 #5
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);
        }