示例#1
0
        protected override void ImplementBusinessLogic()
        {
            var info = Info;


            Data.Token = this.PostData.Token;
            Data.Items = new List <AuthItem>();
            Data.Token = this.PostData.Token;


            var user = new Soway.Model.SqlServer.ObjectContext <SOWAY.ORM.AUTH.User>(new bean.ConHelper().GetSysCon(), this).GetDetail(info.User.UserId);

            if (user != null)
            {
                var authuser = new SOWAY.ORM.AUTH.AuthoriezedFactory(new Model.App.Application()
                {
                    SysCon = info.AppSqlCon
                }, this).GetAuthrizedUser(user);
                List <SOWAY.ORM.AUTH.MenuItem> auths = new List <SOWAY.ORM.AUTH.MenuItem>();
                if (String.IsNullOrEmpty(this.Option.ParentAuthCode))
                {
                    auths = new SOWAY.ORM.AUTH.MenuItemFactory(info.CurrentSqlCon, this).GetTopMenus(authuser);
                }
                else
                {
                    auths = new SOWAY.ORM.AUTH.MenuItemFactory(info.CurrentSqlCon, this).GetMenus(authuser, System.Convert.ToInt64(this.Option.ParentAuthCode));
                }
                foreach (var menu in auths.OrderBy(p => p.Index))
                {
                    var item = new Login.V2.AuthItem()
                    {
                        Text     = menu.Text,
                        AuthType = AuthType.ListView,
                        ImageUrl = menu.Image,
                        Note     = menu.Text,
                        ViewId   = menu.ViewID,
                        ViewType = Soway.Service.Login.V1.ViewType.List,
                        Index    = menu.Index,

                        AuthNo = menu.ID.ToString()
                    };
                    Data.Items.Add(item);
                }
            }
            else
            {
                this.Result.Error = new ErrorInfo()
                {
                    Code    = ErrorDescription.TOKEN_INVALIDAT,
                    Message = ErrorDescription.TOKEN_INVALIDAT_MSG
                }
                ;
            }
        }
示例#2
0
        protected override void ImplementBusinessLogic()
        {
            var info = new CacheStore().Get(this.PostData.Token);

            if (info != null && info.User != null)
            {
                var user = new Soway.Model.SqlServer.ObjectContext <SOWAY.ORM.AUTH.User>(new bean.ConHelper().GetSysCon(), this).GetDetail(info.User.UserId);
                if (user != null)
                {
                    var authuser = new SOWAY.ORM.AUTH.AuthoriezedFactory(new Model.App.Application()
                    {
                        SysCon = info.AppSqlCon
                    }, this).GetAuthrizedUser(user);
                    List <SOWAY.ORM.AUTH.MenuItem> auths = new List <SOWAY.ORM.AUTH.MenuItem>();

                    auths = new SOWAY.ORM.AUTH.MenuItemFactory(info.CurrentSqlCon, this).GetTopMenus(authuser);
                    foreach (var menu in auths)
                    {
                        var item = new Login.V2.AuthItem()
                        {
                            Text     = menu.Text,
                            AuthType = AuthType.ListView,
                            ImageUrl = menu.Image,
                            Note     = menu.Text,
                            ViewId   = menu.ViewID,
                            ViewType = Login.V1.ViewType.List,
                            Index    = 0,

                            AuthNo = menu.ID.ToString()
                        };
                        Data.Items.Add(item);
                    }
                    //Data.UserID = user.ID;
                    //Data.UserShowName = user.Name;
                    //Data.UserAvtar = user.Str5;
                    //Data.IsLogin = true;


                    info.User.UserId       = user.UserID;
                    info.User.UserName     = user.FirstName + user.LastName;
                    info.User.UserAvtarUrl = user.Avtar;
                }
                else
                {
                    //Data.IsLogin = false;
                    Data.Error = new ErrorInfo(ErrorDescription.CODE_AUTHENTICATE_FAIL,
                                               ErrorDescription.MESSAGE_AUTHENTICATE_FAIL);
                }
            }
        }
示例#3
0
        protected override void ImplementBusinessLogic()
        {
            var info = this.Info;

            result.User    = info.User;
            result.Token   = this.PostData.Token;
            result.App     = info.App;
            result.TopMenu = new List <Login.V2.AuthItem>();


            var user = new Soway.Model.SqlServer.SqlContext <SOWAY.ORM.AUTH.User>(new bean.ConHelper().GetSysCon(), this).GetDetail(info.User.UserId);

            if (user != null)
            {
                var authuser = new SOWAY.ORM.AUTH.AuthoriezedFactory(new Model.App.Application()
                {
                    SysCon = info.AppSqlCon
                }, this).GetAuthrizedUser(user);
                List <SOWAY.ORM.AUTH.MenuItem> auths = new SOWAY.ORM.AUTH.MenuItemFactory(info.CurrentSqlCon, this).GetTopMenus(authuser);
                foreach (var menu in auths)
                {
                    var item = new Login.V2.AuthItem()
                    {
                        Text     = menu.Text,
                        AuthType = AuthType.ListView,
                        ImageUrl = menu.Image,
                        Note     = menu.Text,
                        ViewId   = menu.ViewID,
                        ViewType = Soway.Service.Login.V1.ViewType.List,
                        Index    = 1,
                        AuthNo   = menu.ID.ToString()
                    };
                    result.TopMenu.Add(item);
                }
            }
        }