Ejemplo n.º 1
0
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            try
            {
                this.SetCityIdFromUrl();

                if (CityAliasFromUrl.Equals(Const.URL_REGION_RESET))
                {
                    filterContext.Result
                        = GetRedirectToRouteResult(Const.ALL_CITIES);
                }

                if (CityId == 0 && GetCityIdFromCookie() > 0 && !CityAliasFromUrl.Equals(Const.URL_REGION_RESET))
                {
                    filterContext.Result
                        = GetRedirectToRouteResult(GetCityById(GetCityIdFromCookie())?.Alias);
                }

                //Set region cookies
                Response.Cookies.Add(new HttpCookie(Const.COOKIE_NAME_CURRENTCITYID, CityId.ToString()));

                // Set culture globally
                _SetInitialCurrentCultureFromUrl();
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 2
0
 private void SaveAction(object obj)
 {
     try
     {
         SettingConfiguration.UpdateKey("Company", Company);
         SettingConfiguration.UpdateKey("PortId", PortId.ToString());
         SettingConfiguration.UpdateKey("CityId", CityId.ToString());
         WindowClose();
     }
     catch (Exception ex)
     {
         Helpers.ShowMessage(ex.Message);
     }
 }
 protected override void GetAttributes()
 {
     attrs.Clear();
     attrs.Add("CityId", CityId.ToString());
     attrs.Add("ProvinceId", ProvinceId.ToString());
     attrs.Add("IndoorTemperature", IndoorTemperature.ToString());
     attrs.Add("GraphScale", GraphScale.ToString());
     attrs.Add("ActiveTab", ActiveTab.ToString());
     attrs.Add("buildingwidth", BuildingOutlineWidth.ToString());
     attrs.Add("blockscale", BlockScale.ToString());
     attrs.Add("pipeLineScale", PipeLineScale.ToString());
     attrs.Add("elecprice", ElecPrice.ToString());
     attrs.Add("gasprice", GasPrice.ToString());
     if (rasterImageID.IsNull == false)
     {
         attrs.Add("rasterImage", rasterImageID.Handle.ToString());
     }
 }
Ejemplo n.º 4
0
 public override string ToString()
 {
     return(CityId.ToString().PadRight(6) + Name.PadRight(30) + District.PadRight(30) + Population.ToString("N0").PadRight(10));
 }
Ejemplo n.º 5
0
        protected override void OnPreInit(EventArgs e)
        {
            base.OnPreInit(e);
            imageServerUrl = ImageManage.GetImagerServerUrl(1);

            //初始化当前MQ用户
            _MQLoginId = Utils.GetInt(Request.QueryString[Utils.MQLoginIdKey]);
            _password  = Utils.GetQueryStringValue(Utils.MQPwKey);
            if (_MQLoginId > 0 && !String.IsNullOrEmpty(_password))
            {
                _userInfo = new UserProvider().MQLogin(_MQLoginId, _password);
                UserProvider.GenerateIMFrameUserLoginCookies(UserProvider.GenerateSSOToken(_MQLoginId.ToString()), _MQLoginId.ToString());
            }
            else
            {
                _userInfo = new UserProvider().GetMQUser();
            }

            isLogin = _userInfo != null ? true : false;

            if (!isLogin)
            {
                Response.Clear();
                Response.Write("用户名或者密码失效,请重新点击右边的菜单按钮!");
                Response.End();
            }

            _MQLoginId = Convert.ToInt32(_userInfo.ContactInfo.MQ);
            _password  = _userInfo.PassWordInfo.MD5Password;


            _IsCompanyCheck = EyouSoft.BLL.CompanyStructure.CompanyInfo.CreateInstance().GetCompanyState(_userInfo.CompanyID).IsCheck;

            //_password = "******";
            //_MQLoginId = 6709;
            //UserInfo userInfo = null;
            ////isLogin = EyouSoft.Security.Membership.UserProvider.IsUserLogin(out userInfo);
            //isLogin = true;
            ///* UserId:tongye114 */
            //string UserId = "751ae431-8117-4fc3-b9c9-6c4977b57d45";
            ///* UserId :liuyl_test */
            /////UserId = "3f11ad31-4596-403b-b4a8-05f8fdd9dd31";
            ///*test */
            ////UserId = "BC2BAF09-694D-45E0-A5E3-3DDF1E4E2398";
            //Model.CompanyStructure.CompanyUser user = EyouSoft.BLL.CompanyStructure.CompanyUser.CreateInstance().GetModel(UserId);
            //_userInfo = new UserInfo()
            //{
            //    CityId = 1,
            //    CompanyID = user.CompanyID,
            //    UserName = user.UserName,
            //    DepartId = "1",
            //    ProvinceId = 1,
            //    DepartName = "432fds",
            //    IsAdmin = true,
            //    ID = UserId,
            //};
            ////_userInfo.ContactInfo = user.ContactInfo;
            //_userInfo.ContactInfo.ContactName = user.ContactInfo.ContactName;
            //_userInfo.ContactInfo.Email = user.ContactInfo.Email;
            //_userInfo.ContactInfo.MQ = user.ContactInfo.MQ;
            //_userInfo.ContactInfo.QQ = user.ContactInfo.QQ;

            //_IsCompanyCheck = true;
            ////if (userInfo != null)
            ////{
            ////    _userInfo = userInfo;
            ////    _IsCompanyCheck = EyouSoft.BLL.CompanyStructure.CompanyInfo.CreateInstance().GetCompanyState(_userInfo.CompanyID).IsCheck;
            ////    if (userInfo.CompanyRole.HasRole(EyouSoft.Model.CompanyStructure.CompanyType.车队)
            ////        || userInfo.CompanyRole.HasRole(EyouSoft.Model.CompanyStructure.CompanyType.购物店)
            ////        || userInfo.CompanyRole.HasRole(EyouSoft.Model.CompanyStructure.CompanyType.景区)
            ////        || userInfo.CompanyRole.HasRole(EyouSoft.Model.CompanyStructure.CompanyType.酒店)
            ////        || userInfo.CompanyRole.HasRole(EyouSoft.Model.CompanyStructure.CompanyType.旅游用品店))
            ////    {
            ////        _IsSupplyUser = true;
            ////    }
            ////    else
            ////    {
            ////        _IsSupplyUser = false;
            ////    }
            ////}
            ////Model.CompanyStructure.CompanyRole r = new EyouSoft.Model.CompanyStructure.CompanyRole();
            ////r.SetRole(EyouSoft.Model.CompanyStructure.CompanyType.专线);
            ////r.SetRole(EyouSoft.Model.CompanyStructure.CompanyType.组团);
            //_userInfo.CompanyRole.SetRole(EyouSoft.Model.CompanyStructure.CompanyType.专线);
            //_userInfo.CompanyRole.SetRole(EyouSoft.Model.CompanyStructure.CompanyType.组团);
            //_userInfo.CompanyRole.SetRole(EyouSoft.Model.CompanyStructure.CompanyType.地接);
            //_userInfo.AreaId = new int[6] { 1, 2, 3,4,5,241 };
            ////,7,8,9,1,2,3,4,5,6,10,11,12,13,14,15,16,17,18,19,20,21,22,23,2
            //_userInfo.PermissionList = new int[24] { 7, 8, 9, 1, 2, 3, 4, 5, 6, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 };
            ////_userInfo.AreaId = new int[user.Area.Count] { };
            ////string[] arr = user.are.Split(',');
            ////for (int i = 0; i < user.Area.Count; i++)
            ////{
            ////    _userInfo.AreaId[i] = user.Area[i].AreaId;
            ////}

            #region 更新cookie  修改人: 杜桂云
            CityId = Utils.GetInt(Request.QueryString["CityId"]);
            if (CityId > 0 && !string.IsNullOrEmpty(Request.QueryString["isCut"]))
            {
                //存cookie
                if (Response.Cookies["MQCityId"] == null)
                {
                    System.Web.HttpCookie cookie = new System.Web.HttpCookie("MQCityId");
                    cookie.Value   = CityId.ToString();
                    cookie.Expires = DateTime.Now.AddDays(10);
                    Response.Cookies.Add(cookie);
                }
                else //修改
                {
                    Response.Cookies["MQCityId"].Value   = CityId.ToString();
                    Response.Cookies["MQCityId"].Expires = DateTime.Now.AddDays(10);
                }
            }
            else
            {
                if (CityId <= 0)
                {
                    //取cookie
                    if (Utils.GetInt(Response.Cookies["MQCityId"].Value) > 0)
                    {
                        CityId = Utils.GetInt(Response.Cookies["MQCityId"].Value);
                    }
                    else  //
                    {
                        if (SiteUserInfo.CityId > 0)
                        {
                            CityId = SiteUserInfo.CityId;
                        }
                        else//默认值(杭州)
                        {
                            CityId = 362;
                        }
                    }
                }
            }
            #endregion

            #region 城市Model

            EyouSoft.Model.SystemStructure.SysCity thisCityModel = EyouSoft.BLL.SystemStructure.SysCity.CreateInstance().GetSysCityModel(CityId);
            if (thisCityModel != null)
            {
                CityModel              = new EyouSoft.Model.SystemStructure.SysCity();
                CityModel.CityId       = CityId;
                CityModel.CityName     = thisCityModel.CityName;
                CityModel.ProvinceId   = thisCityModel.ProvinceId;
                CityModel.ProvinceName = thisCityModel.ProvinceName;
            }
            else
            {
                CityId = 362;
                EyouSoft.Model.SystemStructure.SysCity hzCityModel = EyouSoft.BLL.SystemStructure.SysCity.CreateInstance().GetSysCityModel(CityId);
                CityModel              = new EyouSoft.Model.SystemStructure.SysCity();
                CityModel.CityId       = CityId;
                CityModel.CityName     = hzCityModel.CityName;
                CityModel.ProvinceId   = hzCityModel.ProvinceId;
                CityModel.ProvinceName = hzCityModel.ProvinceName;
                hzCityModel            = null;
            }
            thisCityModel = null;
            #endregion
        }