private void btnCreate_Click(object sender, EventArgs e) { // проверить, нет ли уже незакрытой копии CellContentSnapshot oCellContentSnapshotTemp = new CellContentSnapshot(); oCellContentSnapshotTemp.FilterIsClosed = false; oCellContentSnapshotTemp.FillData(); if (oCellContentSnapshotTemp.ErrorNumber != 0 || oCellContentSnapshotTemp.MainTable == null) { RFMMessage.MessageBoxError("Ошибка при проверке существующих копий..."); return; } if (oCellContentSnapshotTemp.MainTable.Rows.Count > 0) { RFMMessage.MessageBoxError("Существуют незакрытые копии...\n\rОткрытие новой копии невозможно."); return; } if (RFMMessage.MessageBoxYesNo("Открыть новую копию?") != DialogResult.Yes) { return; } oCellContentSnapshotTemp.ClearFilters(); string sNote = ""; if (StartForm(new frmInputBoxString("Примечание для копии:", sNote)) == DialogResult.Yes) { Refresh(); sNote = GotParam[0].ToString(); if (oCellContentSnapshotTemp.Create(0, ((RFMFormMain)Application.OpenForms[0]).UserID, sNote)) { grdData_Restore(); if (oCellContentSnapshotTemp.ID.HasValue && oCellContentSnapshotTemp.ID > 0) { grdData.GridSource.Position = grdData.GridSource.Find(oCellContentSnapshotList.ColumnID, Convert.ToInt32(oCellContentSnapshotTemp.ID)); } } } }
private bool grdData_Restore() { RFMCursorWait.Set(true); RFMCursorWait.LockWindowUpdate(FindForm().Handle); oCellContentSnapshotCur.ID = null; oCellContentSnapshotList.ClearError(); oCellContentSnapshotList.ClearFilters(); oCellContentSnapshotList.ID = null; oCellContentSnapshotList.IDList = null; // собираем условия // даты if (!dtrDates.dtpBegDate.IsEmpty) { oCellContentSnapshotList.FilterDateBeg = dtrDates.dtpBegDate.Value.Date; } if (!dtrDates.dtpEndDate.IsEmpty) { oCellContentSnapshotList.FilterDateEnd = dtrDates.dtpEndDate.Value.Date; } // владельцы if (sSelectedOwnersIDList.Length > 0) { oCellContentSnapshotList.FilterOwnersList = sSelectedOwnersIDList; } // состояния if (sSelectedGoodsStatesIDList.Length > 0) { oCellContentSnapshotList.FilterGoodsStatesList = sSelectedGoodsStatesIDList; } // ячейки if (sSelectedCellsIDList.Length > 0) { oCellContentSnapshotList.FilterCellsList = sSelectedCellsIDList; } // товары if (sSelectedPackingIDList.Length > 0) { oCellContentSnapshotList.FilterPackingsList = sSelectedPackingIDList; } // подтверждение if (optIsClosed.Checked) { oCellContentSnapshotList.FilterIsClosed = true; } if (optIsClosedNot.Checked) { oCellContentSnapshotList.FilterIsClosed = false; } // grdDetailBeg.DataSource = null; grdDetailEnd.DataSource = null; grdDetailGroupByCells.DataSource = null; grdDetailGroupAll.DataSource = null; grdData.GetGridState(); oCellContentSnapshotList.FillData(); grdData.IsLockRowChanged = true; grdData.Restore(oCellContentSnapshotList.MainTable); tmrRestore.Enabled = true; RFMCursorWait.LockWindowUpdate(IntPtr.Zero); RFMCursorWait.Set(false); return(oCellContentSnapshotList.ErrorNumber == 0); }