Пример #1
0
        private bool grdPartnersRoots_Restore()
        {
            RFMCursorWait.Set(true);
            RFMCursorWait.LockWindowUpdate(FindForm().Handle);

            oPartnerRootCur.ClearOne();

            oPartnerRootList.ClearError();
            oPartnerRootList.ClearFilters();
            oPartnerRootList.ID     = null;
            oPartnerRootList.IDList = null;

            // собираем условия

            // контексты
            if (txtNameContext.Text.Trim().Length > 0)
            {
                oPartnerRootList.FilterNameContext = txtNameContext.Text.Trim().ToUpper();
            }
            if (txtInnContext.Text.Trim().Length > 0)
            {
                oPartnerRootList.FilterInnContext = txtInnContext.Text.Trim().ToUpper();
            }

            // выбор
            oPartnerRootList.FilterPartnersRootsList = ucSelectRecordID_PartnersRoots.GetIdString();

            // checks
            if (optActual.Checked)
            {
                oPartnerRootList.FilterActual = true;
            }
            if (optActualNot.Checked)
            {
                oPartnerRootList.FilterActual = false;
            }
            //

            grdPartnersRoots_Partners.DataSource = null;

            grdPartnersRoots.GetGridState();

            oPartnerRootList.FillTablePartnersRoots();
            grdPartnersRoots.IsLockRowChanged = true;
            grdPartnersRoots.Restore(oPartnerRootList.TablePartnersRoots);
            tmrRestore.Enabled = true;

            RFMCursorWait.LockWindowUpdate(IntPtr.Zero);
            RFMCursorWait.Set(false);

            return(oPartnerRootList.ErrorNumber == 0);
        }
Пример #2
0
        // CellFormatting - не нужен

        #endregion grdPrintForms

        #endregion Top Grids

        private void tmrRestore_Tick(object sender, EventArgs e)
        {
            tmrRestore.Enabled = false;

            if (tcList.CurrentPage.Name.ToUpper().Contains("DATA"))
            {
                if (grdData.CurrentRow == null)
                {
                    return;
                }

                int rowIndex = grdData.CurrentRow.Index;

                btnPrint.Enabled       =
                    btnService.Enabled =
                        true;

                if (grdData.IsStatusRow(rowIndex))
                {
                    oPartnerCur.ClearOne();
                    btnEdit.Enabled       =
                        btnDelete.Enabled =
                            false;
                }
                else
                {
                    // заполнение объекта по текущей строке
                    DataRow r = ((DataRowView)((DataGridViewRow)grdData.Rows[rowIndex]).DataBoundItem).Row;
                    oPartnerCur.FillOne(r);
                    btnEdit.Enabled = true;
                }
                tcPartners.SetAllNeedRestore(true);
            }

            if (tcList.CurrentPage.Name.ToUpper().Contains("ROOTS"))
            {
                if (grdPartnersRoots.CurrentRow == null)
                {
                    return;
                }

                int rowIndex = grdPartnersRoots.CurrentRow.Index;

                btnPrint.Enabled       =
                    btnService.Enabled =
                        true;

                if (grdPartnersRoots.IsStatusRow(rowIndex))
                {
                    oPartnerRootCur.PartnerRootID = null;
                    btnEdit.Enabled       =
                        btnDelete.Enabled =
                            false;
                }
                else
                {
                    // заполнение объекта по текущей строке
                    DataRow r = ((DataRowView)((DataGridViewRow)grdPartnersRoots.Rows[rowIndex]).DataBoundItem).Row;
                    if (Convert.IsDBNull(r["ID"]))
                    {
                        oPartnerRootCur.PartnerRootID = null;
                    }
                    else
                    {
                        oPartnerRootCur.PartnerRootID = Convert.ToInt32(r["ID"]);
                    }
                    btnEdit.Enabled = false;
                }
                tcPartnersRoots.SetAllNeedRestore(true);
            }

            if (tcList.CurrentPage.Name.ToUpper().Contains("PRINT"))
            {
                if (grdPrintForms.CurrentRow == null)
                {
                    return;
                }

                int rowIndex = grdPrintForms.CurrentRow.Index;

                btnAdd.Enabled   = true;
                btnPrint.Enabled = false;

                if (grdPrintForms.IsStatusRow(rowIndex))
                {
                    btnEdit.Enabled            =
                        btnDelete.Enabled      =
                            btnService.Enabled =
                                false;
                }
                else
                {
                    // заполнение объекта по текущей строке
                    DataRow r = ((DataRowView)((DataGridViewRow)grdPrintForms.Rows[rowIndex]).DataBoundItem).Row;
                    oPrintFormCur.FillOne(r);

                    btnEdit.Enabled            =
                        btnDelete.Enabled      =
                            btnService.Enabled =
                                true;
                }
                tcPrintForms.SetAllNeedRestore(true);
            }
        }