public IActionResult CalculateWins(int id)
        {
            List <MatchupWinner> matchupWinnerList = new List <MatchupWinner>();
            string week       = HttpDataHelper.Get_Current_Week();
            int    scoreCount = 0;
            var    player     = _context.Players.Where(p => p.Id == id).FirstOrDefault();

            List <string> winners = ScoresDataHelper.Get_Matchup_Winners("1");
            var           picks   = _context.PlayerPicks.Where(p => p.PlayerId == id && p.Week == "1").FirstOrDefault();

            string[] playerPicks = new string[] { picks.Pick1, picks.Pick2, picks.Pick3, picks.Pick4, picks.Pick5, picks.Pick6, picks.Pick7, picks.Pick8,
                                                  picks.Pick9, picks.Pick10, picks.Pick11, picks.Pick12, picks.Pick13, picks.Pick14, picks.Pick15, picks.Pick16 };
            int index = 0;

            foreach (var pick in playerPicks)
            {
                string winner = winners[index].Trim();
                if (winner.Equals(pick.Trim()))
                {
                    matchupWinnerList.Add(new MatchupWinner(player.Username, winner, pick, true, week));
                    scoreCount++;
                }
                else
                {
                    matchupWinnerList.Add(new MatchupWinner(player.Username, winner, pick, false, week));
                }

                index++;
            }
            ViewBag.scorecount = scoreCount;
            return(View(matchupWinnerList));
        }
Пример #2
0
        private void bbiSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            // 保存修改数据
            BDictParameter para = this.gvParameterList.GetFocusedRow() as BDictParameter;

            if (string.IsNullOrEmpty(this.teValue.Text))
            {
                MessageHelper.ShowWarning("参数值不可为空!");
                return;
            }
            para.Value    = this.teValue.Text;
            para.NameChn  = string.IsNullOrEmpty(this.teNameChn.Text) ? "" : this.teNameChn.Text;
            para.Describe = string.IsNullOrEmpty(this.meDescribe.Text) ? "" : this.meDescribe.Text;

            string          json = StringHelper.SerializeObject <BDictParameter>(para);
            CustomException ce   = null;

            HttpDataHelper.HttpPostWithInfo("BASE", "/setup/paramset", out ce, json);
            if (ce == null)
            {
                this.gvParameterList.SetFocusedRowCellValue("Value", this.teValue.Text);
                this.gvParameterList.SetFocusedRowCellValue("NameChn", this.teNameChn.Text);
                this.gvParameterList.SetFocusedRowCellValue("Describe", this.meDescribe.Text);
                this.SetStatus(false);
            }
            else
            {
                MessageHelper.ShowError("保存参数失败!\r\n" + ce.Info);
            }
        }
Пример #3
0
        public IActionResult Matchup()
        {
            List <Matchup> matchups = HttpDataHelper.Load_Matchups(week);

            ViewBag.week = week;
            return(View(matchups));
        }
Пример #4
0
        public FrmMenuDefault()
        {
            InitializeComponent();
            // 设置默认菜单
            var parmList = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("systemId", EnvInfo.SystemId.ToString()),
                new KeyValuePair <string, string>("empId", EmpInfo.Id.ToString()),
                new KeyValuePair <string, string>("roles", EmpInfo.Roles),
            };
            CustomException ce       = null;
            List <DataMenu> menulist = HttpDataHelper.GetWithInfo <List <DataMenu> >(
                "BASE", "/sys/menu", out ce, parmList);

            parmList = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("empId", EmpInfo.Id.ToString()),
                new KeyValuePair <string, string>("parmName", "DEF_MENU_" + EnvInfo.SystemCode)
            };
            String defmenu = HttpDataHelper.GetStringWithInfo("BASE", "/sys/parameteremp", out ce, parmList);

            tlSysMenu.BeginUpdate();
            CreateTreeView(menulist, defmenu);
            tlSysMenu.EndUpdate();
        }
        public async Task <ForumPostItem> GetTroubleshootingAsync()
        {
            var urlParams = $"?action=getPost&hash={Constants.ForumsApiKey}&value=" + TroubleshootingPostId;
            var forumPost = await HttpDataHelper.GetDataFromUrl <ForumPostItem>(Constants.ForumsApiUrl + urlParams);

            return(await Task.FromResult(forumPost));
        }
Пример #6
0
        private void tlSysObject_AfterExpand(object sender, NodeEventArgs e)
        {
            if (e.Node.Level == 0)
            {
                this.tlSysObject.FocusedNodeChanged -= tlSysObject_FocusedNodeChanged;
                this.tlSysObject.BeginUpdate();    //  停止控件刷新

                //  在模块展开时再检查功能的对应的功能点是否加载

                foreach (TreeListNode node in e.Node.Nodes)
                {
                    if (!node.HasChildren)
                    {
                        string objectCode = node.GetValue(this.tlcCode).ToString();
                        var    parmList   = new List <KeyValuePair <string, string> >
                        {
                            new KeyValuePair <string, string>("objectCode", objectCode)
                        };
                        CustomException ce = null;
                        //  获取功能对应的功能点
                        List <CDictFunctionPoint> fps = HttpDataHelper.GetWithInfo <List <CDictFunctionPoint> >("BASE", "/setup/fplist", out ce, parmList);

                        foreach (CDictFunctionPoint fp in fps)
                        {
                            TreeListNode cnode = node.Nodes.Add(new object[] { fp.Code, fp.Name });
                            cnode.Tag = fp;
                        }
                    }
                }
                this.tlSysObject.FocusedNodeChanged += tlSysObject_FocusedNodeChanged;
                this.tlSysObject.EndUpdate();       //  控件刷新从BeginUpdate开始的改变
            }
        }
Пример #7
0
        private void tlSysObject_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
        {
            if (e.Node == null)
            {
                this.ucSysModule1.Visible     = false;
                this.ucSysObject1.Visible     = false;
                this.bbiEditModule.Visibility = BarItemVisibility.Never;
                this.bbiEditObject.Visibility = BarItemVisibility.Never;
                this.bbiAddObject.Visibility  = BarItemVisibility.Never;
                return;
            }

            string code       = e.Node.GetValue(this.tlcCode).ToString();
            string moduleCode = e.Node.GetValue(tlcParentCode).ToString();

            if (string.IsNullOrEmpty(moduleCode))
            {
                CDictModule module = e.Node.Tag as CDictModule;
                this.FreshModule(module);
            }
            else
            {
                CDictObject obj        = e.Node.Tag as CDictObject;
                string      objectCode = obj.Code;
                var         parmList   = new List <KeyValuePair <string, string> >
                {
                    new KeyValuePair <string, string>("objectCode", objectCode)
                };
                CustomException ce = null;
                //  获取功能对应的功能点
                List <CDictFunctionPoint> fps = HttpDataHelper.GetWithInfo <List <CDictFunctionPoint> >("BASE", "/setup/fplist", out ce, parmList);
                obj.FunctionPointList = fps;
                this.FreshObject(obj);
            }
        }
Пример #8
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            //  获取数据
            BDictSystem       system       = this.ucSystem1.GetData();
            List <BDictRole>  roles        = this.ucSystem1.GetRoles();
            List <DataEmpDir> emps         = this.ucSystem1.GetEmps();
            SystemWithRight   systemToSave = new SystemWithRight();

            systemToSave.RoleList = roles;
            systemToSave.EmpList  = emps;


            if (_IsNew)
            {
                bool common = false;
                if (EmpInfo.IsCenterAdmin)
                {
                    if (MessageHelper.ShowYesNoAndQuestion("是否加入到公共系统?") == DialogResult.Yes)
                    {
                        common = true;
                    }
                }
                int             new_id = 0;
                CustomException ce     = null;
                //  获取下一个系统ID,common为true时在10000以内找,否则在 机构ID + [0001-9999] 找
                if (common)
                {
                    new_id = HttpDataHelper.GetWithInfo <int>("BASE", "/setup/newsysidcenter", out ce);
                }
                else
                {
                    var parmList = new List <KeyValuePair <string, string> >
                    {
                        new KeyValuePair <string, string>("branchId", EnvInfo.BranchId.ToString())
                    };
                    new_id = HttpDataHelper.GetWithInfo <int>("BASE", "/setup/newsysid", out ce, parmList);
                }
                if (new_id == -1)
                {
                    MessageHelper.ShowError("可用的机构ID已满!");
                    return;
                }
                systemToSave.SystemInfo = system;
                system.Id = new_id;
                String str = StringHelper.SerializeObject <SystemWithRight>(systemToSave);

                // 加入数据
                HttpDataHelper.HttpPostWithInfo("BASE", "/setup/systemadd", out ce, str);
            }
            else
            {
                systemToSave.SystemInfo = system;
                String str = StringHelper.SerializeObject <SystemWithRight>(systemToSave);
                // 保存数据
                CustomException ce = null;
                HttpDataHelper.HttpPostWithInfo("BASE", "/setup/systemset", out ce, str);
            }

            this.DialogResult = DialogResult.OK;
        }
Пример #9
0
        /// <summary>
        /// 初始化子系统
        /// </summary>
        /// <returns>子系统自动打开的菜单代码</returns>
        private string InitSubSystem()
        {
            DisplayHelper.Show("获取子系统相关数据", "正在装载系统,请等待...");

            BDictSystem system = EmpInfo.CanUseSystemList.Find(sys => sys.Code == EnvInfo.SystemCode);

            this.Text = this.Title + " --- " + EnvInfo.SystemName;
            Image img = BmpHelper.GetBmp(system.Ico);

            if (img != null)
            {
                Bitmap map  = new Bitmap(img);
                Icon   icon = Icon.FromHandle(map.GetHicon());
                if (icon != null)
                {
                    this.Icon = icon;
                }
            }

            //  获取参数(ParamHelper) 根据系统和人员获取默认菜单
            String pname = "DEF_MENU_" + EnvInfo.SystemCode;

            var parmList = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("empId", EmpInfo.Id.ToString()),
                new KeyValuePair <string, string>("parmName", pname)
            };
            CustomException ce       = null;
            String          menuCode = HttpDataHelper.GetStringWithInfo("BASE", "/sys/parameteremp", out ce, parmList);

            return(menuCode);
        }
        //Get
        public IActionResult Scores()
        {
            List <Matchup> scores = HttpDataHelper.Get_Week_Scores(week);

            ViewBag.week = week;
            return(View(scores));
        }
        public IActionResult Scores(string search)
        {
            List <Matchup> scores = HttpDataHelper.Get_Week_Scores(search);

            ViewBag.week = search;
            return(View(scores));
        }
Пример #12
0
        public IActionResult ViewPicks(int id)
        {
            var week  = HttpDataHelper.Get_Current_Week();
            var picks = _context.PlayerPicks.Where(p => p.PlayerId == id && p.Week == week).FirstOrDefault();

            var player = "";

            try
            {
                player = _context.Players.Where(n => n.Id == picks.PlayerId).Select(n => n.Username).FirstOrDefault();
            }
            catch (Exception ex)
            {
                player = "";
            }


            if (player != null)
            {
                ViewBag.player = player;
            }

            if (picks != null)
            {
                ViewBag.week   = picks.Week;
                ViewBag.player = player;
                return(View(picks));
            }
            else
            {
                return(View());
            }
        }
Пример #13
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            //  获取数据
            BDictMenu         menu       = this.ucMenu1.GetData();
            List <BDictRole>  roles      = this.ucMenu1.GetRoles();
            List <DataEmpDir> emps       = this.ucMenu1.GetEmps();
            MenuWithRight     menuToSave = new MenuWithRight();

            menuToSave.MenuInfo = menu;
            menuToSave.RoleList = roles;
            menuToSave.EmpList  = emps;

            //  保存数据
            String          str = StringHelper.SerializeObject <MenuWithRight>(menuToSave);
            CustomException ce  = null;

            if (_IsNew)
            {
                HttpDataHelper.HttpPostWithInfo("BASE", "/setup/menuadd", out ce, str);
            }
            else
            {
                HttpDataHelper.HttpPostWithInfo("BASE", "/setup/menuset", out ce, str);
            }


            this.DialogResult = DialogResult.OK;
        }
Пример #14
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            // 保存修改数据
            BDictParameterEmp para = new BDictParameterEmp();

            if (string.IsNullOrEmpty(this.teValue.Text))
            {
                MessageHelper.ShowWarning("参数值不可为空!");
                return;
            }
            para.EmpId    = m_EmpId;
            para.Name     = this.teName.Text;
            para.Value    = this.teValue.Text;
            para.NameChn  = string.IsNullOrEmpty(this.teNameChn.Text) ? "" : this.teNameChn.Text;
            para.Describe = string.IsNullOrEmpty(this.meDescribe.Text) ? "" : this.meDescribe.Text;

            string          json = StringHelper.SerializeObject <BDictParameterEmp>(para);
            CustomException ce   = null;

            HttpDataHelper.HttpPostWithInfo("BASE", "/setup/paramempset", out ce, json);
            if (ce == null)
            {
                MessageHelper.ShowInfo("人员参数设置完成!");
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                MessageHelper.ShowWarning("人员参数设置不成功!\r\n" + ce.InnerMessage);
                return;
            }
        }
Пример #15
0
        /// <summary>
        ///  获取全部对象信息
        /// </summary>
        /// <returns></returns>
        private List <CDictObject> getObjectAll()
        {
            CustomException ce = null;
            // 获取对象信息
            List <CDictObject> objects = HttpDataHelper.GetWithInfo <List <CDictObject> >("BASE", "/setup/object", out ce);

            return(objects);
        }
Пример #16
0
        /// <summary>
        ///  获取全部模块信息
        /// </summary>
        /// <returns></returns>
        private List <CDictModule> getModuleAll()
        {
            CustomException ce = null;
            // 获取模块信息
            List <CDictModule> modules = HttpDataHelper.GetWithInfo <List <CDictModule> >("BASE", "/setup/module", out ce);

            return(modules);
        }
Пример #17
0
        public override bool Init()
        {
            String header = _MonitorString + ":" + EnvInfo.ComputerCode;

            this._InfoCodeList.Add(header);
            HttpDataHelper.SetMonitorNode(header);
            return(base.Init());
        }
Пример #18
0
        public IActionResult Matchup(string search)
        {
            //List<Matchup> scores = HttpDataHelper.Get_Week_Scores(week);
            List <Matchup> matchups = HttpDataHelper.Load_Matchups(search);

            ViewBag.week = search;
            return(View(matchups));
        }
        public IActionResult ViewPicks(int id)
        {
            var week   = HttpDataHelper.Get_Current_Week();
            var picks  = _context.PlayerPicks.Where(p => p.PlayerId == id && p.Week == week).FirstOrDefault();
            var player = _context.Players.Where(p => p.Id == id).FirstOrDefault();

            ViewBag.player = player;
            return(View(picks));
        }
Пример #20
0
        /// <summary>
        ///  获取系统选择的人员
        /// </summary>
        /// <param name="system"></param>
        /// <returns></returns>
        private List <DataEmpDir> getSystemEmp(BDictSystem system)
        {
            var parmList = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("systemId", system.Id.ToString())
            };
            CustomException ce = null;
            //  获取系统选择的人员
            List <DataEmpDir> emps = HttpDataHelper.GetWithInfo <List <DataEmpDir> >("BASE", "/setup/sysemp", out ce, parmList);

            return(emps);
        }
Пример #21
0
        /// <summary>
        ///  获取菜单选择的角色
        /// </summary>
        /// <param name="menu"></param>
        /// <returns></returns>
        private List <BDictRole> getMenuRole(BDictMenu menu)
        {
            var parmList = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("menuCode", menu.Code)
            };
            CustomException ce = null;
            //  获取菜单选择的角色
            List <BDictRole> roles = HttpDataHelper.GetWithInfo <List <BDictRole> >("BASE", "/setup/menurole", out ce, parmList);

            return(roles);
        }
Пример #22
0
        /// <summary>
        ///  获取系统选择的角色
        /// </summary>
        /// <param name="system"></param>
        /// <returns></returns>
        private List <BDictRole> getSystemRole(BDictSystem system)
        {
            var parmList = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("systemId", system.Id.ToString())
            };
            CustomException ce = null;
            //  TODO: 获取系统选择的角色
            List <BDictRole> roles = HttpDataHelper.GetWithInfo <List <BDictRole> >("BASE", "/setup/sysrole", out ce, parmList);

            return(roles);
        }
Пример #23
0
        /// <summary>
        ///  获取菜单选择的人员
        /// </summary>
        /// <param name="menu"></param>
        /// <returns></returns>
        private List <DataEmpDir> getMenuEmp(BDictMenu menu)
        {
            var parmList = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("menuCode", menu.Code)
            };
            CustomException ce = null;
            //  获取菜单选择的人员
            List <DataEmpDir> emps = HttpDataHelper.GetWithInfo <List <DataEmpDir> >("BASE", "/setup/menuemp", out ce, parmList);

            return(emps);
        }
Пример #24
0
        public IActionResult SavePicks(string[] teams, int id)
        {
            var         week  = HttpDataHelper.Get_Current_Week();
            PlayerPicks picks = new PlayerPicks(id, teams[0], teams[1], teams[2], teams[3], teams[4],
                                                teams[5], teams[6], teams[7], teams[8], teams[9], teams[10],
                                                teams[11], teams[12], teams[13], teams[14], teams[15], "2019", week);

            _context.Add(picks);
            _context.SaveChanges();

            return(View());
        }
Пример #25
0
        /// <summary>
        ///  获取全部可用员工
        /// </summary>
        /// <returns></returns>
        public static List <DataEmpDir> GetEmpAll()
        {
            var parmList = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("branchId", EnvInfo.BranchId.ToString())
            };
            CustomException ce = null;
            // 获取全部可用员工(本机构在用员工)
            // TODO 中心人员?
            List <DataEmpDir> emps = HttpDataHelper.GetWithInfo <List <DataEmpDir> >("BASE", "/setup/emp", out ce, parmList);

            return(emps);
        }
Пример #26
0
        /// <summary>
        ///  获取全部可用角色
        /// </summary>
        /// <returns></returns>
        public static List <BDictRole> GetRoleAll()
        {
            var parmList = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("branchId", EnvInfo.BranchId.ToString())
            };
            CustomException ce = null;
            // 查询获取全部可用角色列表(本机构及公共角色)
            // TODO 中心角色?
            List <BDictRole> roles = HttpDataHelper.GetWithInfo <List <BDictRole> >("BASE", "/setup/role", out ce, parmList);

            return(roles);
        }
Пример #27
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            this.DataObjectList = gcObject.DataSource as List <CDictObject>;
            if (this.DataObjectList != null || this.DataObjectList.Count > 0)
            {
                CustomException ce = null;
                // 加入数据处理
                String json = StringHelper.SerializeObject <List <CDictObject> >(this.DataObjectList);
                HttpDataHelper.HttpPostWithInfo("BASE", "/setup/objectadd", out ce, json);

                this.DialogResult = DialogResult.OK;
            }
        }
Пример #28
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            //  保存数据
            this.DataModule = this.ucSysModule1.GetData();
            if (this.DataModule != null)
            {
                String          str = StringHelper.SerializeObject <CDictModule>(this.DataModule);
                CustomException ce  = null;
                HttpDataHelper.HttpPostWithInfo("BASE", "/setup/moduleset", out ce, str);

                this.DialogResult = DialogResult.OK;
            }
        }
Пример #29
0
        /// <summary>
        /// 换肤Gallery
        /// </summary>
        private void rgbiSkins_Gallery_ItemClick(object sender, DevExpress.XtraBars.Ribbon.GalleryItemClickEventArgs e)
        {
            //  记录员工个人皮肤选项
            String newSkin = Convert.ToString(e.Item.Tag);
            List <KeyValuePair <string, string> > parms = new List <KeyValuePair <string, string> >();

            parms.Add(new KeyValuePair <string, string>("empId", EmpInfo.Id.ToString()));
            parms.Add(new KeyValuePair <string, string>("parmName", "DEF_SKIN"));
            parms.Add(new KeyValuePair <string, string>("value", newSkin));
            CustomException ce = null;

            HttpDataHelper.HttpPostFormUrlParamWithInfo("BASE", "/sys/parameteremp", out ce, parms);
            MessageHelper.ShowInfo("已设置新皮肤: " + newSkin);
        }
Пример #30
0
        private void bbiDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (tlSysMenu.FocusedNode != null)
            {
                if (tlSysMenu.FocusedNode.HasChildren)
                {
                    MessageHelper.ShowWarning("还有子项不能删除!");
                    return;
                }

                string mess = (tlSysMenu.FocusedNode.Level == 0) ? "系统:" : "菜单:";
                mess = mess + "(" + tlSysMenu.FocusedNode.GetDisplayText(tlcCode) + ")" + tlSysMenu.FocusedNode.GetDisplayText(tlcName);

                if (MessageHelper.ShowYesNoAndInfo("是否真的删除 " + mess + "?") == DialogResult.Yes)
                {
                    CustomException ce = null;

                    if (tlSysMenu.FocusedNode.Level == 0)
                    {
                        BDictSystem system   = tlSysMenu.FocusedNode.Tag as BDictSystem;
                        var         parmList = new List <KeyValuePair <string, string> >
                        {
                            new KeyValuePair <string, string>("systemId", system.Id.ToString())
                        };
                        //  删除子系统
                        HttpDataHelper.HttpPostFormUrlParamWithInfo("BASE", "/setup/systemdelete", out ce, parmList);
                    }
                    else
                    {
                        BDictMenu menu     = tlSysMenu.FocusedNode.Tag as BDictMenu;
                        var       parmList = new List <KeyValuePair <string, string> >
                        {
                            new KeyValuePair <string, string>("systemId", menu.SystemId.ToString()),
                            new KeyValuePair <string, string>("menuCode", menu.Code),
                        };
                        //  删除菜单
                        HttpDataHelper.HttpPostFormUrlParamWithInfo("BASE", "/setup/menudelete", out ce, parmList);
                    }
                    // 处理异常ce
                    if (ce != null)
                    {
                        MessageHelper.ShowError("删除操作失败!\r\n" + ce.Info);
                    }
                    tlSysMenu.FocusedNode.Remove();
                }
            }
        }