private void tmrRestore_Tick(object sender, EventArgs e) { tmrRestore.Enabled = false; RFMDataGridView grd = grdOutputsDocuments; if (grd.CurrentRow == null || grd.CurrentRow.Index < 0) { return; } int rowIndex = grd.CurrentRow.Index; btnOutputsDocumentBring.Enabled = btnOutputsDocumentBringZero.Enabled = false; if (grd.IsStatusRow(rowIndex)) { oOutputDocumentCur.ClearOne(); } else { // заполнение объекта по текущей строке DataRow r = ((DataRowView)((DataGridViewRow)grdOutputsDocuments.Rows[rowIndex]).DataBoundItem).Row; oOutputDocumentCur.FillOne(r); btnOutputsDocumentBring.Enabled = btnOutputsDocumentBringZero.Enabled = oOutputDocumentCur.IsConfirmed && !oOutputDocumentCur.IsBrought; } tcOutputsDocumentsGoods.SetAllNeedRestore(true); }
private bool grdOutputsDocuments_Restore() { RFMCursorWait.Set(true); RFMCursorWait.LockWindowUpdate(FindForm().Handle); oOutputDocumentCur.ClearOne(); oOutputDocumentList.ClearError(); oOutputDocumentList.ClearFilters(); oOutputDocumentList.ID = null; oOutputDocumentList.IDList = null; // собираем условия // даты if (!dtrDates.dtpBegDate.IsEmpty) { oOutputDocumentList.FilterDateBeg = dtrDates.dtpBegDate.Value.Date; } if (!dtrDates.dtpEndDate.IsEmpty) { oOutputDocumentList.FilterDateEnd = dtrDates.dtpEndDate.Value.Date; } // доставка? if (optDeliveryNeed.Checked) { oOutputDocumentList.FilterDeliveryNeed = true; } if (optDeliveryNeedNot.Checked) { oOutputDocumentList.FilterDeliveryNeed = false; } // клиенты-поставщики if (txtPartnerSourceNameContext.Text.Trim().Length > 0) { Partner oPartnerSource = new Partner(); oPartnerSource.FilterNameContext = txtPartnerSourceNameContext.Text.Trim(); oPartnerSource.FillData(); oOutputDocumentList.FilterPartnersSourceList = ""; foreach (DataRow rcs in oPartnerSource.MainTable.Rows) { oOutputDocumentList.FilterPartnersSourceList += rcs["ID"].ToString() + ","; } } if (ucSelectRecordID_PartnersSource.IsSelectedExist) { oOutputDocumentList.FilterPartnersSourceList += ucSelectRecordID_PartnersSource.GetIdString(); } // клиенты-получатели if (txtPartnerTargetNameContext.Text.Trim().Length > 0) { Partner oPartnerTarget = new Partner(); oPartnerTarget.FilterNameContext = txtPartnerTargetNameContext.Text.Trim(); oPartnerTarget.FillData(); oOutputDocumentList.FilterPartnersTargetList = ""; foreach (DataRow rct in oPartnerTarget.MainTable.Rows) { oOutputDocumentList.FilterPartnersTargetList += rct["ID"].ToString() + ","; } } if (ucSelectRecordID_PartnersTarget.IsSelectedExist) { oOutputDocumentList.FilterPartnersTargetList += ucSelectRecordID_PartnersTarget.GetIdString(); } // владельцы if (ucSelectRecordID_Owners.IsSelectedExist) { oOutputDocumentList.FilterOwnersList = ucSelectRecordID_Owners.GetIdString(); } // рейс? if (optTripExists.Checked) { oOutputDocumentList.FilterTripExists = true; } if (optTripExistsNot.Checked) { oOutputDocumentList.FilterTripExists = false; } // задания на расход? if (optOutputExists.Checked) { oOutputDocumentList.FilterIsOutputExists = true; } if (optOutputExistsNot.Checked) { oOutputDocumentList.FilterIsOutputExists = false; } // выбранные товары if (sSelectedPackingsIDList.Length > 0) { oOutputDocumentList.FilterPackingsList = sSelectedPackingsIDList; } // подтверждение отгрузки if (optOutputsDocumentsIsConfirmedNot.Checked) { oOutputDocumentList.FilterIsConfirmed = false; } if (optOutputsDocumentsIsConfirmed.Checked) { oOutputDocumentList.FilterIsConfirmed = true; } // подтверждение доставки if (optOutputsDocumentsIsBroughtNot.Checked) { oOutputDocumentList.FilterIsBrought = false; } if (optOutputsDocumentsIsBrought.Checked) { oOutputDocumentList.FilterIsBrought = true; } // по рейсу string sTripsList = ""; if (txtTripAliasContext.Text.Trim().Length > 0) { Trip oTripFilter = new Trip(); oTripFilter.FilterAliasContext = txtTripAliasContext.Text.Trim(); oTripFilter.FillData(); if (oTripFilter.ErrorNumber == 0 && oTripFilter.MainTable != null) { foreach (DataRow tr in oTripFilter.MainTable.Rows) { sTripsList += tr["ID"].ToString() + ","; } } oOutputDocumentList.FilterTripsList = sTripsList; } if (numTripID.Value > 0) { if (oOutputDocumentList.FilterTripsList == null) { oOutputDocumentList.FilterTripsList = Convert.ToInt32(numTripID.Value).ToString(); } else { oOutputDocumentList.FilterTripsList += Convert.ToInt32(numTripID.Value).ToString(); } } // хосты if (nUserHostID.HasValue) { oOutputDocumentList.FilterHostsList = nUserHostID.ToString(); } else { if (ucSelectRecordID_Hosts.IsSelectedExist) { oOutputDocumentList.FilterHostsList = ucSelectRecordID_Hosts.GetIdString(); } } // // начальные условия if (oOutputDocument != null) { if (oOutputDocument.FilterOwnersList != null) { oOutputDocumentList.FilterOwnersList = oOutputDocument.FilterOwnersList; } if (oOutputDocument.FilterPartnersSourceList != null) { oOutputDocumentList.FilterPartnersSourceList = oOutputDocument.FilterPartnersSourceList; } if (oOutputDocument.FilterPartnersTargetList != null) { oOutputDocumentList.FilterPartnersTargetList = oOutputDocument.FilterPartnersTargetList; } if (oOutputDocument.FilterHostsList != null) { if (!nUserHostID.HasValue) { oOutputDocumentList.FilterHostsList = oOutputDocument.FilterHostsList; } else { if (!((string)("," + oOutputDocument.FilterHostsList + ",")).Contains("," + nUserHostID.ToString().Trim() + ",")) { oOutputDocumentList.FilterHostsList = "-1"; } } } } grdOutputsDocumentsGoods.DataSource = null; grdOutputsDocuments.GetGridState(); oOutputDocumentList.FillData(); grdOutputsDocuments.IsLockRowChanged = true; grdOutputsDocuments.Restore(oOutputDocumentList.MainTable); tmrRestore.Enabled = true; RFMCursorWait.LockWindowUpdate(IntPtr.Zero); RFMCursorWait.Set(false); return(oOutputDocumentList.ErrorNumber == 0); }
private void tmrRestore_Tick(object sender, EventArgs e) { tmrRestore.Enabled = false; RFMDataGridView grd = new RFMDataGridView(); string sPageName = tcList.CurrentPage.Name.ToUpper(); if (sPageName.Contains("OUTPUTS") && !sPageName.Contains("DOCUMENTS")) { grd = grdOutputs; } if (sPageName.Contains("OUTPUTS") && sPageName.Contains("DOCUMENTS")) { grd = grdOutputsDocuments; } if (sPageName.Contains("INPUTS")) { grd = grdInputs; } if (grd.CurrentRow == null || grd.CurrentRow.Index < 0) { return; } int rowIndex = grd.CurrentRow.Index; if (sPageName.Contains("OUTPUTS") && !sPageName.Contains("DOCUMENTS")) { if (grd.IsStatusRow(rowIndex)) { oOutputCur.ClearOne(); } else { DataRow r = ((DataRowView)((DataGridViewRow)grd.Rows[rowIndex]).DataBoundItem).Row; oOutputCur.FillOne(r); } tcOutputsGoods.SetAllNeedRestore(true); } if (sPageName.Contains("OUTPUTS") && sPageName.Contains("DOCUMENTS")) { if (grd.IsStatusRow(rowIndex)) { oOutputDocumentCur.ClearOne(); } else { DataRow r = ((DataRowView)((DataGridViewRow)grd.Rows[rowIndex]).DataBoundItem).Row; oOutputDocumentCur.FillOne(r); } tcOutputsDocumentsGoods.SetAllNeedRestore(true); } if (sPageName.Contains("INPUTS")) { if (grd.IsStatusRow(rowIndex)) { oInputCur.ClearOne(); } else { DataRow r = ((DataRowView)((DataGridViewRow)grd.Rows[rowIndex]).DataBoundItem).Row; oInputCur.FillOne(r); } tcInputsGoods.SetAllNeedRestore(true); } }