コード例 #1
0
        public override async void Del <TModel>(TModel CurrentUser)
        {
            if (!this.GetButtonAuth(Authority.DELETE))
            {
                return;
            }

            if (CurrentUser != null)
            {
                var model = CurrentUser as tb_User;

                bool result = await Msg.Question(string.Format(Configuration.USER_DELETE_TITLE, model.UserName));

                try
                {
                    if (result)
                    {
                        ZFSInterface.User.IUser userSerivce = ZFSBridge.BridgeFactory.BridgeManager.GetUserManager();
                        var req = await userSerivce.DeleteEntity(model);

                        if (req.Success)
                        {
                            var mod = GridModelList.FirstOrDefault(t => t.isid.Equals(model.isid));
                            GridModelList.Remove(mod);
                            Msg.Info(Configuration.DELETE_MSG);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Msg.Error(ex.Message, false);
                }
            }
        }
コード例 #2
0
        public void Add(string _filename)
        {
            PlayListModel _PlayLists = new PlayListModel();

            _PlayLists.Title = _filename;
            GridModelList.Add(_PlayLists);
        }
コード例 #3
0
ファイル: DictionaryViewModel.cs プロジェクト: LimGoSky/ZFS
        public override async void Del <TModel>(TModel model)
        {
            if (!this.GetButtonAuth(Authority.DELETE))
            {
                return;
            }

            if (model != null)
            {
                var dic = model as tb_Dictionary;

                bool result = await Msg.Question(string.Format(Configuration.DIC_EDIT_TITLE, dic.NativeName));

                try
                {
                    if (result)
                    {
                        var DicSerivce = ZFSBridge.BridgeFactory.BridgeManager.GetDictionaryManager();
                        var req        = await DicSerivce.DeleteEntity(dic);

                        if (req.Success)
                        {
                            var mod = GridModelList.FirstOrDefault(t => t.isid.Equals(dic.isid));
                            GridModelList.Remove(mod);
                            Msg.Info(Configuration.DELETE_MSG);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Msg.Error(ex.Message, false);
                }
            }
        }
コード例 #4
0
 /// <summary>
 /// 确定
 /// </summary>
 private void AllDel()
 {
     try
     {
         if (GridModelList.Count != 0)
         {
             ////判断界面绑定数据源 是否有勾选的数据
             //var notDelModel = GridModelList.Where(s => !s.IsCheck).ToList();
             //GridModelList.Clear();
             //if (notDelModel.Any())
             //{
             //    notDelModel.ForEach((ary => GridModelList.Add(ary)));
             //}
             var notDelModel = GridModelList.Where(
                 s => s.DateTime.DayOfWeek == DayOfWeek.Saturday || s.DateTime.DayOfWeek == DayOfWeek.Sunday).ToList();
             if (notDelModel.Any())
             {
                 notDelModel.ForEach((ary) =>
                 {
                     ary.CheckBack = ary.IsCheck ? "#CCCCCC" : "#FC3E36";
                     ary.IsCheck   = !ary.IsCheck;
                 });
             }
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
コード例 #5
0
ファイル: DictionaryViewModel.cs プロジェクト: LimGoSky/ZFS
        public override async void Add <TModel>(TModel model)
        {
            try
            {
                DictionaryDialogViewModel view = new DictionaryDialogViewModel();
                view.Title    = Configuration.DIC_ADD_TITLE;
                view.TypeList = (await ZFSBridge.BridgeFactory.BridgeManager.GetDictionaryTypeManager().GetDictionaryTypes()).Results;
                var dialog = ServiceProvider.Instance.Get <IModelDialog>("DictionaryViewDlg");
                dialog.BindViewModel(view);
                var taskResult = await dialog.ShowDialog(
                    null,
                    view.ExtendedClosingEventHandler);

                if (taskResult)
                {
                    view.Dictionary.CreatedBy    = Loginer.LoginerUser.UserName;
                    view.Dictionary.CreationDate = DateTime.Now;
                    var req = await ZFSBridge.BridgeFactory.BridgeManager.GetDictionaryManager().AddEntity(view.Dictionary);

                    if (req.Success)
                    {
                        GridModelList.Add(view.Dictionary);
                        Msg.Info(Configuration.ADD_MSG);
                    }
                }
            }
            catch (Exception ex)
            {
                Msg.Error(ex.Message, false);
            }
        }
コード例 #6
0
        /// <summary>
        /// 新增
        /// </summary>
        public async void AddViewModel()
        {
            try
            {
                DisplayMetro = System.Windows.Visibility.Visible;
                base.InitViewModel();
                IUser user     = BridgeFactory.BridgeManager.GetUserManager();
                var   genrator = await user.GetUserGames(SearchText, 1, 100000);

                if (genrator.code.Equals("000"))
                {
                    var Results = JsonConvert.DeserializeObject <List <UserGamesEntity> >(genrator.result.ToString());
                    PageCount = Convert.ToInt32(Math.Ceiling(Results.Count / (double)4));
                    //var curShowmodel = Results.Skip(0).Take(8);
                    Results.OrderBy(s => s.id).ToList().ForEach((ary) => GridModelList.Add(ary));
                }
            }
            catch (Exception ex)
            {
                Msg.Error(ex);
            }
            finally
            {
                DisplayMetro = System.Windows.Visibility.Collapsed;
            }
        }
コード例 #7
0
        public override async void Del <TModel>(TModel CurrentGroup)
        {
            if (!this.GetButtonAuth(Authority.DELETE))
            {
                return;
            }

            if (CurrentGroup != null)
            {
                try
                {
                    tb_Group group = CurrentGroup as tb_Group;
                    if (await Msg.Question(string.Format(Configuration.GROUP_DELETE_TITLE, group.GroupName)))
                    {
                        var req = await ZFSBridge.BridgeFactory.BridgeManager.GetGroupManager().Remove(group.isid);

                        if (req.Success)
                        {
                            var gp = GridModelList.FirstOrDefault(t => t.isid.Equals(group.isid));
                            GridModelList.Remove(gp);
                            Msg.Info(Configuration.DELETE_MSG);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Msg.Error(ex.Message, false);
                }
            }
        }
コード例 #8
0
        /// <summary>
        /// 初始化
        /// </summary>
        public override async void InitViewModel()
        {
            base.InitViewModel();
            Store        = "999.00";
            PayModelList = new ObservableCollection <PayModel>();

            List <string> listPayList = new List <string> {
                "今日充值", "今日耗卡", "今日赠送", "储值金额"
            };

            listPayList.ForEach((ary) =>
            {
                PayModel model = new PayModel()
                {
                    Type  = ary,
                    Money = Convert.ToDecimal(Common.GetRandomSeed())
                };
                PayModelList.Add(model);
            });

            //Get Zcgllist
            var assstEntity = await RequestConver.DataRequest <UcZcglEntity> .GetModelList();

            if (assstEntity != null && assstEntity.Count != 0)
            {
                assstEntity.ForEach((ary) => GridModelList.Add(ary));
            }
        }
コード例 #9
0
        public override async void Save()
        {
            if (!this.IsValid)
            {
                return;
            }

            if (Mode == ActionMode.Add)
            {
                var addResult = await service.AddUserAsync(Model);

                if (addResult)
                {
                    this.GetPageData(this.PageIndex);
                }
            }
            else
            {
                var updateResult = await service.UpdateUserAsync(Model);

                if (updateResult)
                {
                    var model = GridModelList.FirstOrDefault(t => t.Id == Model.Id);
                    if (model != null)
                    {
                        GridModelList.Remove(model);
                        GridModelList.Add(Model);
                    }
                }
            }
            base.Save();
        }
コード例 #10
0
ファイル: MineViewModel.cs プロジェクト: shibc-heart/HY_hub
        public async void InitHotRecomenAsync()
        {
            try
            {
                //viptype类型 0:普通用户  1:月费用户  2:年费用户
                //  string vipType = string.Empty;
                //  switch (Loginer.LoginerUser.vipType)
                //  {
                //      case "0":
                //          {
                //              vipType = "普通用户";
                //              break;
                //          }
                //      case "1":
                //          {
                //              vipType = "月费用户";
                //              break;
                //          }
                //      case "2":
                //          {
                //              vipType = "年费用户";
                //              break;
                //          }
                //  }
                //CommonsCall.ShowUser = Loginer.LoginerUser.UserName + "余额:" + Loginer.LoginerUser.balance + "鹰币   " + vipType + ":    " + "剩余下载次数" + Loginer.LoginerUser.freeCount + "次,会员有效期至" + Loginer.LoginerUser.vipValidTo;
                DisplayMetro = Visibility.Visible;
                GridModelList.Clear();
                IUser user     = BridgeFactory.BridgeManager.GetUserManager();
                var   genrator = await user.GetUserGames(SearchText, 1, 100000);

                if (genrator.code.Equals("000"))
                {
                    var Results = JsonConvert.DeserializeObject <List <UserGamesEntity> >(genrator.result.ToString());
                    foreach (var item in Results)
                    {
                        var GameRoute = CommonsCall.ReadUserGameInfo(item.gameId.ToString());
                        if (!string.IsNullOrEmpty(GameRoute.Key))
                        {
                            item.StrupPath = GameRoute.Key;
                            item.gameName  = GameRoute.remarks;
                        }
                    }
                    Loginer.LoginerUser.UserGameList = Results;
                    PageCount = Convert.ToInt32(Math.Ceiling(Results.Count / (double)4));
                    var curShowmodel = Results.Skip(0).Take(4);
                    curShowmodel.OrderBy(s => s.id).ToList().ForEach((ary) => GridModelList.Add(ary));
                }
            }
            catch (Exception ex)
            {
                Msg.Error(ex);
            }
            finally
            {
                DisplayMetro = Visibility.Collapsed;
            }
        }
コード例 #11
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="model"></param>
 private void Del(MainModel model)
 {
     try
     {
         GridModelList.Remove(model);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
コード例 #12
0
        public override async void Add <TModel>(TModel model)
        {
            try
            {
                GroupDialogViewModel view = new GroupDialogViewModel();
                view.Title           = Configuration.GROUP_ADD_TITLE;
                view.IsReadOnly      = false;
                view.Group           = new tb_Group();
                view.MenuGroupModels = MenuManager.ModuleGroups;
                //var funcList = ZFSBridge.BridgeFactory.GetGroupBridge().
                //    GetGroupFuncs(view.Group.GroupCode); //获取组权限数据
                view.CaCheUser = new List <View_GroupUser>();
                var dialog = ServiceProvider.Instance.Get <IModelDialog>("GroupViewDlg");
                dialog.BindViewModel(view);
                var taskResult = await dialog.ShowDialog(
                    null,
                    view.ExtendedClosingEventHandler);

                if (taskResult)
                {
                    List <tb_GroupFunc> FuncList = new List <tb_GroupFunc>();
                    view.MenuGroupModels.ForEach(t =>
                    {
                        var node = t.Nodes.Where(q => q.IsChecked.Equals(true)).ToList();
                        if (node.Count > 0)
                        {
                            node.ForEach(s =>
                            {
                                FuncList.Add(new tb_GroupFunc()
                                {
                                    GroupCode   = view.Group.GroupCode,
                                    MenuCode    = s.MenuCode,
                                    Authorities = s.Nodes.Where(q => q.IsChecked.Equals(true)).Sum(w => w.AuthValue)
                                });
                            });
                        }
                    });
                    IGroup groupSerivce = ZFSBridge.BridgeFactory.BridgeManager.GetGroupManager();
                    var    reqUpdate    = await groupSerivce.UpdateGroupFunc(view.Group, view.CaCheUser, FuncList);

                    if (reqUpdate.Success)
                    {
                        GridModelList.Add(view.Group);
                    }
                    view.Reset(view.MenuGroupModels);
                }
            }
            catch (Exception ex)
            {
                Msg.Error(ex.Message, false);
            }
        }
コード例 #13
0
ファイル: MainViewModel.cs プロジェクト: jaywhen/Pmer
        public void Add()
        {
            Student  student = new Student();
            UserView view    = new UserView(student);
            var      r       = view.ShowDialog();

            if (r.Value)
            {
                student.Id = GridModelList.Max(t => t.Id) + 1;
                fakedb.AddStudent(student);
                this.Query();
            }
        }
コード例 #14
0
        /// <param name="pageIndex"></param>
        public override async void GetPageData(int pageIndex)
        {
            try
            {
                var response = await ZFSBridge.BridgeFactory.BridgeManager.GetGroupManager().GetGroups(SearchText);

                GridModelList.Clear();
                var GroupList = response.Results as List <tb_Group>;
                GroupList.ForEach((arg) => GridModelList.Add(arg));
            }
            catch (Exception ex)
            {
                Msg.Error(ex.Message, false);
            }
        }
コード例 #15
0
ファイル: MainViewModel.cs プロジェクト: jaywhen/Pmer
        public void Edit(int id)
        {
            var model = fakedb.GetStudentById(id);

            if (model != null)
            {
                UserView view = new UserView(model);
                var      r    = view.ShowDialog();
                if (r.Value)
                {
                    var newModel = GridModelList.FirstOrDefault(t => t.Id == model.Id);
                    if (newModel != null)
                    {
                        newModel.Name = model.Name;
                    }
                }
            }
        }
コード例 #16
0
        public override async void Edit <T>(T CurrentUser)
        {
            if (!this.GetButtonAuth(Authority.EDIT))
            {
                return;
            }

            if (CurrentUser != null)
            {
                try
                {
                    UserDialogViewModel view = new UserDialogViewModel();
                    view.Title = Configuration.USER_EDIT_TITLE;
                    var request = await ZFSBridge.BridgeFactory.BridgeManager.GetUserManager().GetModelByAccount((CurrentUser as tb_User).Account);

                    view.User          = request.Results;
                    view.User.Password = CEncoder.Decode(view.User.Password);/*解密*/
                    var dialog = ServiceProvider.Instance.Get <IModelDialog>("UserViewDlg");
                    dialog.BindViewModel(view);
                    var taskResult = await dialog.ShowDialog(
                        null,
                        view.ExtendedClosingEventHandler);

                    if (taskResult)
                    {
                        ZFSInterface.User.IUser userSerivce = await Task.Run(() => ZFSBridge.BridgeFactory.BridgeManager.GetUserManager());

                        view.User.Password = CEncoder.Encode(view.User.Password);/*加密*/
                        var req = await userSerivce.UpdateEntity(view.User);

                        if (req.Success)
                        {
                            var mod = GridModelList.FirstOrDefault(t => t.isid.Equals(view.User.isid));
                            GridModelList.Remove(mod);
                            GridModelList.Add(view.User);
                            Msg.Info(Configuration.ADD_MSG);
                        }
                    }
                }
                catch (Exception ex)
                { Msg.Error(ex.Message, false); }
            }
        }
コード例 #17
0
 /// <summary>
 /// 批量删除
 /// </summary>
 private void AllDel()
 {
     try
     {
         if (GridModelList.Count != 0)
         {
             //判断界面绑定数据源 是否有勾选的数据
             var notDelModel = GridModelList.Where(s => !s.IsCheck).ToList();
             GridModelList.Clear();
             if (notDelModel.Any())
             {
                 notDelModel.ForEach((ary => GridModelList.Add(ary)));
             }
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
コード例 #18
0
ファイル: MineViewModel.cs プロジェクト: shibc-heart/HY_hub
        public override async void Query()
        {
            try
            {
                DisplayMetro = Visibility.Visible;
                GridModelList.Clear();
                IUser user     = BridgeFactory.BridgeManager.GetUserManager();
                var   genrator = await user.GetUserGames(SearchText, 1, 100000);

                if (genrator.code.Equals("000"))
                {
                    var Results = JsonConvert.DeserializeObject <List <UserGamesEntity> >(genrator.result.ToString());
                    if (Results.Count == 0)
                    {
                        PageCount = 0;
                        Msg.Info("暂未查询出数据,请您重新查询");
                        return;
                    }
                    foreach (var item in Results)
                    {
                        var GameRoute = CommonsCall.ReadUserGameInfo(item.gameId.ToString());
                        if (!string.IsNullOrEmpty(GameRoute.Key))
                        {
                            item.StrupPath = GameRoute.Key;
                            item.gameName  = GameRoute.remarks;
                        }
                    }
                    PageCount = Convert.ToInt32(Math.Ceiling(Results.Count / (double)4));
                    var curShowmodel = Results.Skip(0).Take(4);
                    curShowmodel.OrderBy(s => s.id).ToList().ForEach((ary) => GridModelList.Add(ary));
                }
            }
            catch (Exception ex)
            {
                Msg.Error(ex);
            }
            finally
            {
                DisplayMetro = Visibility.Collapsed;
            }
        }
コード例 #19
0
ファイル: DictionaryViewModel.cs プロジェクト: LimGoSky/ZFS
        public override async void Edit <TModel>(TModel model)
        {
            if (!this.GetButtonAuth(Authority.EDIT))
            {
                return;
            }

            if (model != null)
            {
                try
                {
                    DictionaryDialogViewModel view = new DictionaryDialogViewModel();
                    view.Title      = Configuration.DIC_EDIT_TITLE;
                    view.Dictionary = model as tb_Dictionary;
                    view.TypeList   = (await ZFSBridge.BridgeFactory.BridgeManager.GetDictionaryTypeManager().GetDictionaryTypes()).Results;
                    var dialog = ServiceProvider.Instance.Get <IModelDialog>("DictionaryViewDlg");
                    dialog.BindViewModel(view);
                    var taskResult = await dialog.ShowDialog(
                        null,
                        view.ExtendedClosingEventHandler);

                    if (taskResult)
                    {
                        view.Dictionary.LastUpdatedBy  = Loginer.LoginerUser.UserName;
                        view.Dictionary.LastUpdateDate = DateTime.Now;
                        var dicSerivce = ZFSBridge.BridgeFactory.BridgeManager.GetDictionaryManager();
                        var req        = await dicSerivce.UpdateEntity(view.Dictionary);

                        if (req.Success)
                        {
                            var mod = GridModelList.FirstOrDefault(t => t.isid.Equals(view.Dictionary.isid));
                            GridModelList.Remove(mod);
                            GridModelList.Add(view.Dictionary);
                            Msg.Info(Configuration.UPDATE_MSG);
                        }
                    }
                }
                catch (Exception ex)
                { Msg.Error(ex.Message, false); }
            }
        }
コード例 #20
0
        public override void InitViewModel()
        {
            try
            {
                base.InitViewModel();

                var systemModel = Common.GetGnglEntityByFjd("0124c130f5e64e4b9c04eda4e31b0008");
                systemModel.ForEach((ary) =>
                {
                    SettingModel model = new SettingModel();
                    model.HeaderName   = ary.JDMC;
                    model.Body         = Common.GetUserControl(ary.JDSX);
                    GridModelList.Add(model);
                    ContentList.Add(model);
                });
            }
            catch (Exception ex)
            {
                throw;
            }
        }
コード例 #21
0
ファイル: DictionaryViewModel.cs プロジェクト: LimGoSky/ZFS
        public override async void GetPageData(int pageIndex)
        {
            try
            {
                IDictionary user = ZFSBridge.BridgeFactory.BridgeManager.GetDictionaryManager();
                var         req  = await user.GetPagingModels(pageIndex, PageSize, new tb_Dictionary()
                {
                    DataCode = SearchText, NativeName = SearchText
                });

                TotalCount = req.TotalCount;
                GridModelList.Clear();
                var UserList = req.Results as List <tb_Dictionary>;
                UserList.ForEach((arg) => GridModelList.Add(arg));
                base.SetPageCount();
            }
            catch (Exception ex)
            {
                Msg.Error(ex.Message, false);
            }
        }
コード例 #22
0
 public override void InitViewModel()
 {
     base.InitViewModel();
     try
     {
         //取出营销应用的功能节点
         var applyModel = Common.GetGnglEntityByFjd("0124c130f5e64e4b9c04eda4e31b0004");
         if (applyModel.Any())
         {
             applyModel.ForEach((ary) =>
             {
                 AdhibitionModel model = new AdhibitionModel
                 {
                     Title       = ary.JDMC,
                     TitleDepict = ary.JDSX
                 };
                 var toolEntity = Common.GetGnglEntityByFjd(ary.ZJ);
                 if (toolEntity.Any())
                 {
                     toolEntity.ForEach((aty) =>
                     {
                         AdhibitionToolModel toolModel = new AdhibitionToolModel
                         {
                             FunName    = aty.JDMC,
                             Depict     = aty.JDSX,
                             BrushsPath = aty.GNLX
                         };
                         model.ToolModesList.Add(toolModel);
                     });
                 }
                 GridModelList.Add(model);
             });
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
コード例 #23
0
        public override async void Add <T>(T obj)
        {
            UserDialogViewModel viewModel = new UserDialogViewModel();

            viewModel.Title = Configuration.USER_ADD_TITLE;
            var dialog = ServiceProvider.Instance.Get <IModelDialog>("UserViewDlg");

            dialog.BindViewModel(viewModel);
            var taskResult = await dialog.ShowDialog(
                null,
                viewModel.ExtendedClosingEventHandler);

            if (taskResult)
            {
                try
                {
                    ZFSInterface.User.IUser userSerivce = ZFSBridge.BridgeFactory.BridgeManager.GetUserManager();
                    viewModel.User.Password     = CEncoder.Encode(viewModel.User.Password);/*加密*/
                    viewModel.User.IsLocked     = 0;
                    viewModel.User.FlagAdmin    = "0";
                    viewModel.User.FlagOnline   = "0";
                    viewModel.User.LoginCounter = 0;
                    viewModel.User.CreateTime   = DateTime.Now;

                    var req = await userSerivce.AddEntity(viewModel.User);

                    if (req.Success)
                    {
                        GridModelList.Add(viewModel.User);
                        Msg.Info(Configuration.ADD_MSG);
                    }
                }
                catch (Exception ex)
                {
                    Msg.Error(ex.Message, false);
                }
            }
        }
コード例 #24
0
 /// <summary>
 /// 查询
 /// </summary>
 private void Query()
 {
     try
     {
         if (!string.IsNullOrWhiteSpace(SearchText))
         {
             var queryList = GridModelList.Where(s => s.FunName.Contains(SearchText)).ToList();
             if (queryList.Any())
             {
                 GridModelList.Clear();
                 queryList.ForEach((ary => GridModelList.Add(ary)));
             }
         }
         else
         {
             InitUi();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #25
0
        public override async void GetPageData(int pageIndex)
        {
            try
            {
                IMenu user    = ZFSBridge.BridgeFactory.BridgeManager.GetMenuManager();
                var   request = await user.GetPagingModels(
                    pageIndex,
                    PageSize,
                    new tb_Menu()
                {
                    MenuCode = SearchText, MenuName = SearchText
                });

                TotalCount = request.TotalCount;
                GridModelList.Clear();
                var GirdList = request.Results as List <tb_Menu>;
                GirdList.ForEach((arg) => GridModelList.Add(arg));
                base.SetPageCount();
            }
            catch (Exception ex)
            {
                Msg.Error(ex.Message, false);
            }
        }
コード例 #26
0
        public override async void GetPageData(int pageIndex)
        {
            try
            {
                var r = await service.GetUsersAsync(new UserParameters()
                {
                    PageIndex = pageIndex,
                    PageSize  = PageSize,
                    Search    = SearchText,
                });

                if (r.success)
                {
                    TotalCount = r.TotalRecord;
                    GridModelList.Clear();
                    r.users.ForEach((arg) => GridModelList.Add(arg));
                    base.SetPageCount();
                }
            }
            catch (Exception ex)
            {
                Msg.Error(ex.Message);
            }
        }
コード例 #27
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <typeparam name="TModel"></typeparam>
        /// <param name="model"></param>
        public override async void Add <TModel>(TModel model)
        {
            try
            {
                DisplayMetro = System.Windows.Visibility.Visible;
                var selectModel = GridModelList.Where(s => s.IsSelected).ToList();
                if (selectModel.Any())
                {
                    List <int> gameIds = new List <int>();
                    selectModel.ForEach((ary) => gameIds.Add(ary.id));
                    IHome user     = BridgeFactory.BridgeManager.GetHomeManager();
                    var   genrator = await user.UpdateCommomUseGames(gameIds, "1");

                    if (genrator.code.Equals("000"))
                    {
                        ShowList?.Invoke();
                    }
                    else
                    {
                        Msg.Info(genrator.Message);
                    }
                }
                else
                {
                    Msg.Info("请勾选您需要的游戏");
                }
            }
            catch (Exception ex)
            {
                Msg.Error(ex);
            }
            finally
            {
                DisplayMetro = System.Windows.Visibility.Collapsed;
            }
        }
コード例 #28
0
        /// <summary>
        /// 初始化工作台
        /// </summary>
        public override void InitViewModel()
        {
            try
            {
                base.InitViewModel();
                Task.Factory.StartNew(() =>
                {
                    WorkbenchModel model = new WorkbenchModel();



                    //工作台数据
                    var gztModel = Common.GetGnglEntityByFjd("0124c130f5e64e4b9c04eda4e31b0002");


                    #region 客户数据

                    foreach (var item in _dicKdData)
                    {
                        KhDataModel khData = new KhDataModel
                        {
                            Title      = item.Key,
                            TodeCount  = item.Value.ToString("N2"),
                            YestAmount = Common.GetRandomSeed().ToString(),
                        };
                        model.ListKhData.Add(khData);
                    }

                    #endregion

                    //常用功能
                    var cygnModel = Common.GetGnglEntityByFjd(gztModel.Find(s => s.JDPX == 2).ZJ);
                    if (cygnModel.Any())
                    {
                        cygnModel.ForEach((ary) =>
                        {
                            PageModule pageModel = new PageModule(ary.JDMC, ary.JDSX, ary.JDPX);
                            model.ListFun.Add(pageModel);
                        });
                    }

                    #region 最新宣传 最新功能 有赞神厨

                    var broadcastModel = gztModel.Where(s => s.JDPX == 4).ToList();
                    if (broadcastModel.Any())
                    {
                        broadcastModel.ForEach((ary) =>
                        {
                            FuntionsModel broadc = new FuntionsModel()
                            {
                                FunName = ary.JDMC,
                            };
                            var dapiModel = Common.GetGnglEntityByFjd(ary.ZJ);

                            dapiModel.ForEach((aty) =>
                            {
                                depictModel dapi = new depictModel()
                                {
                                    Depict = aty.JDSX,
                                };
                                broadc.ListFuntions.Add(dapi);
                            });
                            model.Listbroadcast.Add(broadc);
                        });
                    }

                    #endregion

                    //待办事项
                    foreach (KeyValuePair <string, string> t in _dicTodo)
                    {
                        TodoModel model1 = new TodoModel()
                        {
                            Items      = t.Key,
                            TodeCount  = new Random().Next(10, 500),
                            Todedepict = t.Value
                        };
                        Thread.Sleep(100);
                        model.ListTodo.Add(model1);
                    }
                    Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        InitChar(model);

                        GridModelList.Add(model);
                    }));
                });
            }
            catch (Exception ex)
            {
                throw;
            }
        }
コード例 #29
0
        public override async void Edit <TModel>(TModel CurrentGroup)
        {
            if (!this.GetButtonAuth(Authority.EDIT))
            {
                return;
            }

            if (CurrentGroup != null)
            {
                try
                {
                    GroupDialogViewModel view = new GroupDialogViewModel();
                    view.Title           = Configuration.GROUP_EDIT_TITLE;
                    view.IsReadOnly      = true;
                    view.Group           = ClassOperation.CopyByReflect(CurrentGroup as tb_Group);
                    view.MenuGroupModels = new List <MenuGroupModel>(MenuManager.ModuleGroups.ToArray());

                    var req = await ZFSBridge.BridgeFactory.BridgeManager.GetGroupManager().GetGroupFuncs(view.Group.GroupCode);

                    if (req.Success)
                    {
                        var funcList = req.Results as List <tb_GroupFunc>;
                        funcList.ForEach(t =>
                        {
                            view.MenuGroupModels.ForEach(q =>
                            {
                                q.Nodes.ForEach(w =>
                                {
                                    if (w.MenuCode.Equals(t.MenuCode))
                                    {
                                        w.IsChecked = true;
                                        w.Nodes.ForEach(s =>
                                        {
                                            if ((t.Authorities & s.AuthValue) == s.AuthValue)
                                            {
                                                s.IsChecked = true;
                                            }
                                        });
                                    }
                                });
                                if (q.Nodes.Where(x => x.IsChecked.Equals(true)).Count() == q.Nodes.Count)
                                {
                                    q.IsChecked = true;
                                }
                            });
                        });
                    }

                    var req_userGroup = await ZFSBridge.BridgeFactory.BridgeManager.GetGroupManager().GetGroupUsers(view.Group.GroupCode); //获取用户组

                    if (req_userGroup.Success)
                    {
                        view.CaCheUser = req_userGroup.Results as List <View_GroupUser>;
                    }
                    var dialog = ServiceProvider.Instance.Get <IModelDialog>("GroupViewDlg");
                    dialog.BindViewModel(view);
                    var taskResult = await dialog.ShowDialog(null, view.ExtendedClosingEventHandler);

                    if (taskResult)
                    {
                        List <tb_GroupFunc> FuncList = new List <tb_GroupFunc>();
                        view.MenuGroupModels.ForEach(t =>
                        {
                            var node = t.Nodes.Where(q => q.IsChecked.Equals(true)).ToList();
                            if (node.Count > 0)
                            {
                                node.ForEach(s =>
                                {
                                    FuncList.Add(new tb_GroupFunc()
                                    {
                                        GroupCode   = view.Group.GroupCode,
                                        MenuCode    = s.MenuCode,
                                        Authorities = s.Nodes.Where(q => q.IsChecked.Equals(true)).Sum(w => w.AuthValue)
                                    });
                                });
                            }
                        });
                        IGroup groupSerivce = ZFSBridge.BridgeFactory.BridgeManager.GetGroupManager();
                        var    reqUpdate    = await groupSerivce.UpdateGroupFunc(view.Group, view.CaCheUser, FuncList);

                        if (reqUpdate.Success)
                        {
                            var EditGroup = GridModelList.FirstOrDefault(t => t.isid.Equals(view.Group.isid));
                            EditGroup.GroupName = view.Group.GroupName;
                        }
                        Msg.Info(Configuration.UPDATE_MSG);
                    }
                    view.Reset(view.MenuGroupModels);
                }
                catch (Exception ex)
                {
                    Msg.Error(ex.Message, false);
                }
            }
        }