public void SortContracts() { if (beiSortField.EditValue != null && beiSortMethod.EditValue != null) { Forms.ContractSelectForm childForm = new Forms.ContractSelectForm(); foreach (var item in this.MdiChildren) { if (item is Forms.ContractSelectForm) { childForm = item as Forms.ContractSelectForm; break; } } string sortField = string.Empty; DevExpress.Data.ColumnSortOrder method = new DevExpress.Data.ColumnSortOrder(); if (beiSortMethod.EditValue.ToString() == "По возрастанию") { method = DevExpress.Data.ColumnSortOrder.Ascending; } else { method = DevExpress.Data.ColumnSortOrder.Descending; } switch (beiSortField.EditValue.ToString()) { case "Номер договора": sortField = "Number"; break; } childForm.gvList.SortInfo.ClearAndAddRange(new[] { new GridColumnSortInfo(childForm.gvList.Columns[sortField], method) }); } }
public void updateContracts() { Forms.ContractSelectForm childForm = new Forms.ContractSelectForm(); foreach (var item in this.MdiChildren) { if (item is Forms.ContractSelectForm) { childForm = item as Forms.ContractSelectForm; break; } } childForm.gridControl1.DataSource = null; childForm.gridControl1.MainView = childForm.gvList; var contractsBindingSource = dbContext.Contracts.Where(y => y.IsRemoved != true).Join(dbContext.getFullUserName, e => e.AuthorID, x => x.ID, (e, x) => new { e.ID, e.Number, Category = e.ContractCategory.Name, e.Theme, e.Summ, Name = x.FullName }).ToList(); childForm.gridControl1.DataSource = contractsBindingSource; childForm.gvList.Columns["ID"].Visible = false; childForm.gvList.Columns["Number"].Caption = "Номер договора"; childForm.gvList.Columns["Category"].Caption = "Категория договора"; childForm.gvList.Columns["Theme"].Caption = "Предмет договора"; childForm.gvList.Columns["Summ"].Caption = "Сумма договора"; childForm.gvList.Columns["Name"].Caption = "Автор"; }
private void FilterContracts() { if (beiFilterValue.EditValue != null && beiFilterField.EditValue != null && beiFilterMethod.EditValue != null) { Forms.ContractSelectForm childForm = new Forms.ContractSelectForm(); foreach (var item in this.MdiChildren) { if (item is Forms.ContractSelectForm) { childForm = item as Forms.ContractSelectForm; break; } } string filterString = string.Empty; string filterField = string.Empty; string filterValue = beiFilterValue.EditValue.ToString(); switch (beiFilterField.EditValue.ToString()) { case "Номер договора": filterField = "Number"; break; } switch (beiFilterMethod.EditValue.ToString()) { case "Содержит": filterString = "Contains([" + filterField + "], '" + filterValue + "')"; break; case "Равно": filterString = "[" + filterField + "]='" + filterValue + "'"; break; case "Не равно": filterString = "[" + filterField + "]!='" + filterValue + "'"; break; } childForm.gvList.ActiveFilterString = filterString; childForm.gvList.ApplyColumnsFilter(); } }
private void bbtnOpenContract_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { Forms.ContractSelectForm childForm = (xtraTabbedMdiManager1.SelectedPage.MdiChild as Forms.ContractSelectForm); int rowIndex = childForm.gvList.GetSelectedRows()[0]; int id = Convert.ToInt32(childForm.gvList.GetRowCellValue(rowIndex, "ID")); Forms.ContractForm form = new Forms.ContractForm(id); form.MdiParent = this; form.Show(); }
private void bbrnContracts_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { Forms.ContractSelectForm tmpForm = Forms.ContractSelectForm.getInst(); tmpForm.MdiParent = this; tmpForm.Show(); xtraTabbedMdiManager1.SelectedPage = xtraTabbedMdiManager1.Pages[tmpForm]; rpContractWork.Visible = true; ribbonControl1.SelectedPage = rpContractWork; }
private void bbiAutoWidth_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { Forms.ContractSelectForm childForm = new Forms.ContractSelectForm(); foreach (var item in this.MdiChildren) { if (item is Forms.ContractSelectForm) { childForm = item as Forms.ContractSelectForm; break; } } childForm.gvList.BestFitColumns(); }
private void bbiRemoveSort_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { Forms.ContractSelectForm childForm = new Forms.ContractSelectForm(); foreach (var item in this.MdiChildren) { if (item is Forms.ContractSelectForm) { childForm = item as Forms.ContractSelectForm; break; } } childForm.gvList.ClearSorting(); }
private void bbiFilterCreator_ItemClick_1(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { Forms.ContractSelectForm childForm = new Forms.ContractSelectForm(); foreach (var item in this.MdiChildren) { if (item is Forms.ContractSelectForm) { childForm = item as Forms.ContractSelectForm; break; } } childForm.gvList.ShowFilterEditor(null); }
private void bbtnRemoveContract_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { Forms.ContractSelectForm childForm = (xtraTabbedMdiManager1.SelectedPage.MdiChild as Forms.ContractSelectForm); int rowIndex = childForm.gvList.GetSelectedRows()[0]; int id = Convert.ToInt32(childForm.gvList.GetRowCellValue(rowIndex, "ID")); childForm.RemoveContract(id); updateContracts(); DB.ContractMovements movements = new DB.ContractMovements(); movements.ContractID = id; movements.Date = DateTime.Now; movements.AuthorID = Properties.Settings.CurrentUserID; movements.MovementTypeID = 3; dbContext.ContractMovements.Add(movements); dbContext.SaveChanges(); }
private void bciAutoFilterPanel_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { Forms.ContractSelectForm childForm = new Forms.ContractSelectForm(); foreach (var item in this.MdiChildren) { if (item is Forms.ContractSelectForm) { childForm = item as Forms.ContractSelectForm; break; } } if (bciAutoFilterPanel.Checked) { childForm.gvList.OptionsView.ShowAutoFilterRow = true; } else { childForm.gvList.OptionsView.ShowAutoFilterRow = false; } }
private void bciFindString_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { Forms.ContractSelectForm childForm = new Forms.ContractSelectForm(); foreach (var item in this.MdiChildren) { if (item is Forms.ContractSelectForm) { childForm = item as Forms.ContractSelectForm; break; } } if (bciFindString.Checked) { childForm.gvList.ShowFindPanel(); } else { childForm.gvList.HideFindPanel(); } }