Exemplo n.º 1
0
        private void LoadData(CCalcOrder objCalcOrder)
        {
            try
            {
                //System.String strStartProcess = "идет загрузка данных...";
                if (objCalcOrder == null)
                {
                    return;
                }
                this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
                System.Boolean bPageExsits = false;
                System.String  strTabName  = objCalcOrder.Num;
                foreach (DevExpress.XtraTab.XtraTabPage tabPageItem in tabControl.TabPages)
                {
                    if (tabPageItem.Name == strTabName)
                    {
                        bPageExsits = true;
                        tabControl.SelectedTabPage = tabPageItem;
                        break;
                    }
                }
                if (bPageExsits == true)
                {
                    return;
                }

                DevExpress.XtraTab.XtraTabPage tabPage = new DevExpress.XtraTab.XtraTabPage();
                if (tabPage != null)
                {
                    tabPage.Name = strTabName;
                    tabControl.TabPages.Add(tabPage);
                    tabControl.SelectedTabPage = tabPage;

                    ctrlCalcOrderItem ViewerCalcOrderItem = new ctrlCalcOrderItem(m_objProfile, objCalcOrder);
                    if (ViewerCalcOrderItem != null)
                    {
                        tabPage.Controls.Add(ViewerCalcOrderItem);
                        tabPage.Text             = strTabName;
                        ViewerCalcOrderItem.Dock = DockStyle.Fill;

                        this.Refresh();

                        ViewerCalcOrderItem.LoadCalcOrderItems();
                        ViewerCalcOrderItem.ChangeCalcOrderItem += this.OnChangeCalcOrderItem;
                    }
                    this.Refresh();
                }
            }
            catch (System.Exception f)
            {
                DevExpress.XtraEditors.XtraMessageBox.Show("Ошибка загрузки плана закупок для ." + objCalcOrder.Num + "\n\nТекст ошибки: " + f.Message, "Ошибка",
                                                           System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
            finally
            {
                this.Cursor = System.Windows.Forms.Cursors.Default;
            }
            return;
        }
Exemplo n.º 2
0
        private void barBtnPrint_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (tabControl.TabPages.Count == 0)
            {
                return;
            }
            if (tabControl.SelectedTabPage == null)
            {
                return;
            }
            if (tabControl.SelectedTabPage.Controls.Count == 0)
            {
                return;
            }

            ctrlCalcOrderItem ViewerPlanProductOwner = (ctrlCalcOrderItem)tabControl.SelectedTabPage.Controls[0];

            if (ViewerPlanProductOwner == null)
            {
                return;
            }
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                SendMessageToLog("идет экспорт данных в Microsoft Excel...");
                ViewerPlanProductOwner.PrintCalcOrderItem();
                SendMessageToLog("завершен экспорт данных в Microsoft Excel");
                Cursor.Current = Cursors.Default;
            }
            catch (System.Exception f)
            {
                System.Windows.Forms.MessageBox.Show(this, "Ошибка печати\n" + f.Message, "Ошибка",
                                                     System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }

            return;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Закрывает закладку вместе с работающим в ней потоком
        /// </summary>
        /// <param name="tPage">закладка</param>
        /// <param name="bConfirm">Признак "Выдавать сообщение"</param>
        private void CloseTabPage(DevExpress.XtraTab.XtraTabPage tabPage, System.Boolean bConfirm)
        {
            System.String tPageText = "";
            try
            {
                if (tabControl.TabPages.Count == 0)
                {
                    return;
                }
                if (tabPage == null)
                {
                    return;
                }
                if (tabPage.Controls.Count == 0)
                {
                    return;
                }
                tPageText = tabPage.Text;

                ctrlCalcOrderItem ViewerPlanProductOwner = (ctrlCalcOrderItem)tabPage.Controls[0];
                if (ViewerPlanProductOwner == null)
                {
                    return;
                }

                if (ViewerPlanProductOwner.PlanIsChanged == true)
                {
                    DialogResult resDlg = DevExpress.XtraEditors.XtraMessageBox.Show("Сохранить изменения в расчете?", "Подтверждение",
                                                                                     System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question);

                    switch (resDlg)
                    {
                    case DialogResult.Yes:
                    {
                        //// попробуем сохранить
                        //if (bSavePlanOnlyOneProductOwner(tabPage) == true)
                        //{
                        ViewerPlanProductOwner = null;
                        tabControl.TabPages.Remove(tabPage);
                        tabPage = null;
                        this.Refresh();
                        //}
                        break;
                    }

                    case DialogResult.No:
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    ViewerPlanProductOwner = null;
                    tabControl.TabPages.Remove(tabPage);
                    tabPage = null;
                    this.Refresh();
                }
            }
            catch (System.Exception f)
            {
                DevExpress.XtraEditors.XtraMessageBox.Show(tPageText + "\nCloseTabPage.\n\nТекст ошибки: " + f.Message, "Ошибка",
                                                           System.Windows.Forms.MessageBoxButtons.OK,
                                                           System.Windows.Forms.MessageBoxIcon.Warning);
            }
            finally
            {
            }
            return;
        }