Esempio n. 1
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);
            }
        }