public void filterapply(GridEX grid, string filtername, CreateFilterForm hiddeninstanceinitialized)
        {
            foreach (string item in hiddeninstanceinitialized.comboBox7.Items)
            {
                if (item == filtername)
                {
                    hiddeninstanceinitialized.comboBox7.SelectedItem = filtername;
                    hiddeninstanceinitialized.comboBox7_SelectedIndexChanged(this, new EventArgs());

                    List <string> stacknames = new List <string>();
                    hiddeninstanceinitialized.processList(ref grid, false, 1, stacknames);
                }
            }
            foreach (string item in hiddeninstanceinitialized.comboBox1.Items)
            {
                if (item == filtername)
                {
                    hiddeninstanceinitialized.comboBox1.SelectedItem = filtername;
                    //hiddeninstanceinitialized.comboBox1_SelectedIndexChanged(this, new EventArgs());
                    GridEXColumn column = grid.RootTable.Columns[hiddeninstanceinitialized.comboBox5.SelectedValue.ToString()];


                    GridEXFilterCondition singlefiltercondtion = hiddenInstance.CreateSinglefilter(hiddenInstance.textBox6.Text, hiddenInstance.textBox7.Text, hiddenInstance.comboBox6.SelectedValue.ToString(), column);


                    grid.RootTable.FilterCondition = singlefiltercondtion;
                    grid.RootTable.ApplyFilter(singlefiltercondtion);
                    break;
                }
            }
            grid.Refetch();
            grid.Select();
        }
Exemple #2
0
        private void Recalc()
        {
            DbContext.GameSet.Where(f => f.StageId == Stage.Id).Load();
            DbContext.GameResultSet.Where(f => f.Game.StageId == Stage.Id).Load();
            DbContext.GameResultValueSet.Where(f => f.GameResult.Game.StageId == Stage.Id).Load();

            var result = new BindingList <TeamScore>();

            foreach (var game in DbContext.GameSet.Local)
            {
                var gameValues = ScaleResult(GameService.GetGameResultValues(game));



                var score = GameService.GetGameScore(game, gameValues, new StringBuilder());
                if (!score.HasValue)
                {
                    continue;
                }
                var item = new TeamScore()
                {
                    Team = game.Team, Score = score.Value
                };
                result.Add(item);
            }

            GridEX.DataSource = result;
            GridEX.Refetch();
        }
Exemple #3
0
        public void SetDataSource(object dataSource, bool retrieveStructure)
        {
            grdData.DataSource = dataSource;
            grdData.Refetch();

            if (retrieveStructure)
            {
                grdData.RetrieveStructure();

                RebindGridToolbox();
            }
        }
Exemple #4
0
        private void GridEX_RowDoubleClick(object sender, RowActionEventArgs e)
        {
            var game = e.Row.DataRow as Game;

            using (var form = new GameEditForm(game, DbContext))
            {
                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    GameService.UpdateGame(game);
                    GridEX.Refetch();
                }
            }
        }
Exemple #5
0
        public void SetDataSource(object dataSource, bool retrieveStructure)
        {
            grdData.DataSource = dataSource;
            grdData.Refetch();

            if (retrieveStructure)
            {
                grdData.RetrieveStructure();
            }
            ////<BugFix>
            ////TODO: esto es para salvar el error de la Janus que no hace la asignación de los campos al objeto cuando el DataSource está vacio
            if ((grdData.RecordCount == 0) && (grdData.DataSource is IList))
            {
                bugFix = true;
                (grdData.DataSource as IList).Add(RequireCreatePersistent());
            }
            ////</BugFix>
        }
        private void btRandom_Click(object sender, Janus.Windows.Ribbon.CommandEventArgs e)
        {
            var r       = new Random();
            var numbers = new List <int>();

            foreach (var tc in DbContext.TeamCompetitionSet.Local.Where(f => f.Competition.Id == Competition.Id))
            {
                tc.Order = null;
                if (!tc.IsPastWinner)
                {
                    var order = 1 + r.Next(100);
                    while (numbers.Contains(order = 1 + r.Next(100)))
                    {
                    }
                    tc.Order = (short)order;
                    numbers.Add(order);
                }
            }
            GridEX.Refetch();
        }
Exemple #7
0
        public void SetDataSource(object dataSource, bool retrieveStructure)
        {
            if (dataSource is IList)
            {
                this.dataSource = dataSource as IList;
                Rebind();
            }
            else
            {
                grdItems.DataSource = dataSource;
            }

            grdItems.Refetch();

            if (retrieveStructure)
            {
                grdItems.RetrieveStructure();
                if (ResetLayout != null)
                {
                    ResetLayout(grdItems, ItemType);
                }
            }
        }
 /// <summary>
 /// HAM THUC HIEN XOA NHIEU LUA CHON
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmdDeleteALL_Click(object sender, EventArgs e)
 {
     try
     {
         if (_currentGRd == null)
         {
             return;
         }
         SqlQuery q;
         bool     b_FlagService = false;
         if (!Utility.isValidCheckedGrid(_currentGRd))
         {
             Utility.ShowMsg("Bạn cần check chọn ít nhất một dịch vụ trên lưới trước khi xóa");
             return;
         }
         if (_currentGRd.GetCheckedRows().Length <= 0)
         {
             Utility.ShowMsg("Bạn phải chọn một dịch vụ thực hiện xoá", "Thông báo");
             _currentGRd.Focus();
             return;
         }
         string lsterr = "";
         if (_currentGRd.CurrentRow != null)
         {
             if (Utility.AcceptQuestion("Bạn có muốn xoá các dịch vụ đang chọn không", "Thông báo", true))
             {
                 foreach (Janus.Windows.GridEX.GridEXRow gridExRow in _currentGRd.GetCheckedRows())
                 {
                     int _IdChitietdichvu = Utility.Int32Dbnull(gridExRow.Cells[DmucDichvuclsChitiet.Columns.IdChitietdichvu].Value, -1);
                     v_ServiceDetail_Id = Utility.Int32Dbnull(grdChitiet.CurrentRow.Cells[DmucDichvuclsChitiet.Columns.IdChitietdichvu].Value, -1);
                     KcbChidinhclsChitiet item = new Select().From(KcbChidinhclsChitiet.Schema).Where(KcbChidinhclsChitiet.Columns.IdChitietdichvu).IsEqualTo(v_ServiceDetail_Id).ExecuteSingle <KcbChidinhclsChitiet>();
                     if (item != null)
                     {
                         lsterr = lsterr + Utility.sDbnull(gridExRow.Cells[DmucDichvuclsChitiet.Columns.TenChitietdichvu].Value, "") + ";";
                     }
                     else
                     {
                         SPs.DmucXoadanhmucDichvuclsChitiet(_IdChitietdichvu).Execute();
                         gridExRow.Delete();
                         _currentGRd.UpdateData();
                         _currentGRd.Refetch();
                         dsTable.Select(DmucDichvuclsChitiet.Columns.IdChitietdichvu + "=" + _IdChitietdichvu)[0].Delete();
                         dsTable.AcceptChanges();
                     }
                 }
                 if (Utility.DoTrim(lsterr) != "")
                 {
                     Utility.ShowMsg("Một số dịch vụ chi tiết sau đã có chi tiết nên bạn không thể xóa\n" + lsterr);
                 }
             }
             dsTable.AcceptChanges();
         }
     }
     catch (Exception)
     {
     }
     finally
     {
         ModifyCommand();
     }
 }
Exemple #9
0
		public DialogResult ShowDialog(GridEX grid, Form parent)
		{

			MemoryStream layoutStream = new MemoryStream();

			grid.SaveLayoutFile(layoutStream);
			layoutStream.Flush();
			layoutStream.Position = 0;

			this.bufferGrid = new GridEX();
			this.bufferGrid.LoadLayoutFile(layoutStream);

			//Set the DataBinding of the Grid and DropDowns in order to be able to retrieve
			//the ValueList of the columns used in the FilterEditor
			this.bufferGrid.BindingContext = this.BindingContext;
			this.bufferGrid.SetDataBinding(grid.DataSource, grid.DataMember);
			this.bufferGrid.ImageList = grid.ImageList;

            for (int i = 0; i < grid.DropDowns.Count; i++)
			{
				GridEXDropDown ddMain = grid.DropDowns[i];
				GridEXDropDown ddBuffer = bufferGrid.DropDowns[i];
				ddBuffer.SetDataBinding(ddMain.DataSource, ddMain.DataMember);

			}

			layoutStream.Dispose();

			this.Table = bufferGrid.RootTable;
			this.FillTablesCombo();
			this.FillHierarchicalGroupModeCombo();

			if (bufferGrid.GroupMode == GroupMode.Collapsed)
			{
				this.UiCommandManager1.Commands["cmdExpand"].IsChecked = false;
				this.UiCommandManager1.Commands["cmdExpand"].Text = "All collapsed";
			}

			this.ShowDialog(parent);


			if (this.DialogResult == System.Windows.Forms.DialogResult.OK)
			{

                if (!this.CreateGroups())
                {
                    return this.DialogResult;
                }

				layoutStream = new MemoryStream();
				this.bufferGrid.SaveLayoutFile(layoutStream);

				layoutStream.Flush();
				layoutStream.Position = 0;

				grid.LoadLayoutFile(layoutStream);

                for (int i = 0; i < grid.DropDowns.Count; i++)
				{
					GridEXDropDown ddMain = grid.DropDowns[i];
					GridEXDropDown ddBuffer = bufferGrid.DropDowns[i];
					ddMain.SetDataBinding(ddBuffer.DataSource, ddBuffer.DataMember);
				}
				grid.Refetch();
			}
			return this.DialogResult;
		}