Beispiel #1
0
        private void listViewTaskMaster_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (this.listViewTaskMaster.SelectedItems.Count > 0)
                {
                    //Get taskID by ListViewItem key (The key defined when add ListViewItem to ListView)
                    int taskID; if (!int.TryParse(this.listViewTaskMaster.SelectedItems[0].Name, out taskID))
                    {
                        return;
                    }

                    //Find and active the current form
                    for (int i = 0; i < this.MdiChildren.Length; i++)
                    {
                        IToolstripChild mdiChildCallToolStrip = this.MdiChildren[i] as IToolstripChild;
                        if (mdiChildCallToolStrip != null)
                        {
                            if (taskID == (int)mdiChildCallToolStrip.NMVNTaskID)
                            {
                                Form mdiChildrenForm = (Form)this.MdiChildren[i];
                                mdiChildrenForm.Activate();
                                return;
                            }
                        }

                        this.OpenModuleDetail(taskID);
                    }
                }
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Beispiel #2
0
        private void MasterMDI_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                for (int i = 0; i < this.MdiChildren.Length; i++)
                {
                    IToolstripChild mdiChildCallToolStrip = this.MdiChildren[i] as IToolstripChild;
                    if (mdiChildCallToolStrip != null)
                    {
                        if (mdiChildCallToolStrip.ReadonlyMode)
                        {
                            ((Form)mdiChildCallToolStrip).Close();
                        }
                    }
                    else
                    {
                        this.MdiChildren[i].Close();
                    }
                }

                if (this.MdiChildren.Length > 0)
                {
                    e.Cancel = true;
                }
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Beispiel #3
0
        private void MasterMdi_MdiChildActivate(object sender, EventArgs e)
        {
            try
            {
                ToolStripManager.RevertMerge(this.toolstripMain);
                IToolstripMerge mergeToolstrip = ActiveMdiChild as IToolstripMerge;
                if (mergeToolstrip != null)
                {
                    ToolStripManager.Merge(mergeToolstrip.toolstripChild, toolstripMain);
                }

                IToolstripChild toolstripChild = ActiveMdiChild as IToolstripChild;
                if (toolstripChild != null)
                {
                    toolstripChild.PropertyChanged -= new PropertyChangedEventHandler(toolstripChild_PropertyChanged);
                    toolstripChild.PropertyChanged += new PropertyChangedEventHandler(toolstripChild_PropertyChanged);

                    toolstripChild_PropertyChanged(toolstripChild, new PropertyChangedEventArgs("IsDirty"));
                }

                if (ActiveMdiChild != null)
                {
                    ActiveMdiChild.WindowState = FormWindowState.Maximized;
                }
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Beispiel #4
0
 private void buttonPrintPreview_Click(object sender, EventArgs e)
 {
     try
     {
         IToolstripChild toolstripChild = ActiveMdiChild as IToolstripChild;
         if (toolstripChild != null)
         {
             toolstripChild.Print(GlobalEnums.PrintDestination.PrintPreview);
         }
     }
     catch (Exception exception)
     {
         ExceptionHandlers.ShowExceptionMessageBox(this, exception);
     }
 }
Beispiel #5
0
 private void buttonVoid_Click(object sender, EventArgs e)
 {
     try
     {
         IToolstripChild toolstripChild = ActiveMdiChild as IToolstripChild;
         if (toolstripChild != null)
         {
             toolstripChild.Void();
         }
     }
     catch (Exception exception)
     {
         ExceptionHandlers.ShowExceptionMessageBox(this, exception);
     }
 }
Beispiel #6
0
 private void comboFilterTexts_TextChanged(object sender, EventArgs e)
 {
     try
     {
         IToolstripChild toolstripChild = ActiveMdiChild as IToolstripChild;
         if (toolstripChild != null)
         {
             if (sender.Equals(this.comboFilterTexts))
             {
                 toolstripChild.ApplyFilter(this.comboFilterTexts.Text);
             }
         }
     }
     catch (Exception exception)
     {
         ExceptionHandlers.ShowExceptionMessageBox(this, exception);
     }
 }
Beispiel #7
0
        private void MasterMdi_MdiChildActivate(object sender, EventArgs e)
        {
            try
            {
                ToolStripManager.RevertMerge(this.toolstripMain);
                IToolstripMerge mergeToolstrip = ActiveMdiChild as IToolstripMerge;
                if (mergeToolstrip != null)
                {
                    ToolStripManager.Merge(mergeToolstrip.toolstripChild, toolstripMain);
                }

                IToolstripChild toolstripChild = ActiveMdiChild as IToolstripChild;
                if (toolstripChild != null)
                {
                    toolstripChild.PropertyChanged -= new PropertyChangedEventHandler(toolstripChild_PropertyChanged);
                    toolstripChild.PropertyChanged += new PropertyChangedEventHandler(toolstripChild_PropertyChanged);

                    toolstripChild_PropertyChanged(toolstripChild, new PropertyChangedEventArgs("IsDirty"));
                }

                else
                {
                    this.toolStripSeparatorPrint.Visible = false;
                    this.buttonPrint.Visible             = false;
                    this.buttonPrintPreview.Visible      = false;
                }

                this.buttonEscape.Visible       = toolstripChild != null;
                this.separatorInputData.Visible = toolstripChild != null;

                this.labelSearchBarcode.Visible = toolstripChild != null;
                this.panelTopRight.Width        = (toolstripChild != null ? this.labelSearchBarcode.Width + 20 : 10) + this.comboSearchBarcode.Width + this.buttonSearchBarcode.Width + this.buttonReports.Width;

                if (ActiveMdiChild != null)
                {
                    ActiveMdiChild.WindowState = FormWindowState.Maximized;
                }
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Beispiel #8
0
 private void buttonEscape_Click(object sender, EventArgs e)
 {
     try
     {
         IToolstripChild toolstripChild = ActiveMdiChild as IToolstripChild;
         if (toolstripChild != null)
         {
             toolstripChild.Escape();
         }
         if (this.MdiChildren.Length <= 0)
         {
             this.naviBarModuleMaster.Collapsed = false;
         }
     }
     catch (Exception exception)
     {
         ExceptionHandlers.ShowExceptionMessageBox(this, exception);
     }
 }
Beispiel #9
0
        private void toolstripChild_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            try
            {
                IToolstripChild toolstripChild = sender as IToolstripChild;
                if (toolstripChild != null)
                {
                    bool closable     = toolstripChild.Closable;
                    bool loadable     = toolstripChild.Loadable;
                    bool newable      = toolstripChild.Newable;
                    bool editable     = toolstripChild.Editable;
                    bool isDirty      = toolstripChild.IsDirty;
                    bool deletable    = toolstripChild.Deletable;
                    bool importable   = toolstripChild.Importable;
                    bool exportable   = toolstripChild.Exportable;
                    bool approvable   = toolstripChild.Approvable;
                    bool unapprovable = toolstripChild.Unapprovable;
                    bool voidable     = toolstripChild.Voidable;
                    bool unvoidable   = toolstripChild.Unvoidable;

                    bool printable    = toolstripChild.Printable;
                    bool printVisible = toolstripChild.PrintVisible;

                    bool readonlyMode = toolstripChild.ReadonlyMode;
                    bool editableMode = toolstripChild.EditableMode;

                    bool isValid = toolstripChild.IsValid;


                    this.buttonEscape.Enabled  = closable;
                    this.buttonLoading.Enabled = loadable && readonlyMode;

                    this.buttonNew.Visible    = toolstripChild.AllowDataInput;
                    this.buttonEdit.Visible   = toolstripChild.AllowDataInput;
                    this.buttonSave.Visible   = toolstripChild.AllowDataInput;
                    this.buttonDelete.Visible = toolstripChild.AllowDataInput;

                    this.buttonNew.Enabled    = newable && readonlyMode;
                    this.buttonEdit.Enabled   = editable && readonlyMode;
                    this.buttonSave.Enabled   = isDirty && isValid && editableMode;
                    this.buttonDelete.Enabled = deletable && readonlyMode;

                    this.buttonImport.Visible             = importable;
                    this.buttonImport.Enabled             = importable && newable && readonlyMode;
                    this.buttonExport.Visible             = exportable;
                    this.buttonExport.Enabled             = exportable;//&& !isDirty && readonlyMode;
                    this.toolStripSeparatorImport.Visible = importable || exportable;

                    this.buttonApprove.Visible = sender is Batches ? false : (approvable || unapprovable);
                    this.buttonApprove.Enabled = (approvable || unapprovable) && readonlyMode;
                    this.buttonApprove.Text    = approvable ? "Verify" : "Un-verify";
                    this.buttonApprove.Image   = approvable ? Resources.Check_Saki_Ok : Resources.Cross_UnVerify;

                    this.toolStripSeparatorApprove.Visible = sender is Batches ? false : (approvable || unapprovable);

                    this.buttonVoid.Visible = (sender is Batches || sender is BatchMasters) ? false : (voidable || unvoidable);
                    this.buttonVoid.Enabled = (voidable || unvoidable) && readonlyMode;
                    this.buttonVoid.Text    = voidable ? "Void" : "Un-void";
                    this.buttonVoid.Image   = voidable ? Resources.Void_24 : Resources.Cross_UnVerify;

                    this.toolStripSeparatorVoid.Visible = (sender is Batches || sender is BatchMasters) ? false : (voidable || unvoidable);

                    this.buttonPrint.Enabled             = printable;
                    this.buttonPrint.Visible             = printVisible;
                    this.buttonPrintPreview.Enabled      = printable;
                    this.buttonPrintPreview.Visible      = printVisible;
                    this.toolStripSeparatorPrint.Visible = printVisible && toolstripChild.AllowDataInput;
                }
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Beispiel #10
0
        private void OpenModuleDetail(int moduleDetailID)
        {
            if (moduleDetailID > 0)
            {
                Form openingView = null;//Form to open

                for (int i = 0; i < this.MdiChildren.Length; i++)
                {//Find and active the current form
                    IToolstripChild mdiChildCallToolStrip = this.MdiChildren[i] as IToolstripChild;
                    if (mdiChildCallToolStrip != null)
                    {
                        if (moduleDetailID == (int)mdiChildCallToolStrip.NMVNTaskID)
                        {
                            openingView = (Form)this.MdiChildren[i];
                            break;
                        }
                    }
                }

                if (openingView != null)
                {
                    openingView.Activate();
                    IToolstripChild mdiChildCallToolStrip = openingView as IToolstripChild;
                    if (mdiChildCallToolStrip != null)
                    {
                        mdiChildCallToolStrip.DoAfterActivate();
                    }
                }
                else
                { //OPEN NEW VIEW
                    switch (moduleDetailID)
                    {
                    case (int)GlobalEnums.NmvnTaskID.Customers:
                        openingView = new Customers();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.CustomerTypes:
                        openingView = new CustomerTypes();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.CustomerCategories:
                        openingView = new CustomerCategories();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.Commodities:
                        openingView = new Commodities();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.CommoditySettings:
                        openingView = new CommoditySettings();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.CommodityTypes:
                        openingView = new CommodityTypes();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.CommodityCategories:
                        openingView = new CommodityCategories();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.BinLocations:
                        openingView = new BinLocations();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.Teams:
                        openingView = new Teams();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.Territories:
                        openingView = new Territories();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.Warehouses:
                        openingView = new Warehouses();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.Employees:
                        openingView = new Employees();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.Pickups:
                        openingView = new Pickups();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.GoodsReceipts:
                        openingView = new GoodsReceipts();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.Forecasts:
                        openingView = new Forecasts();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.SalesOrders:
                        openingView = new SalesOrders();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.DeliveryAdvices:
                        openingView = new DeliveryAdvices();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.TransferOrders:
                        openingView = new TransferOrders();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.GoodsIssues:
                        openingView = new GoodsIssues();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.WarehouseAdjustments:
                        openingView = new WarehouseAdjustments();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.AvailableItems:
                        openingView = new GoodsReceiptDetailAvailables();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.PendingOrders:
                        openingView = new PendingOrders();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.Reports:
                        openingView = new Reports();
                        break;

                    default:
                        openingView = new BlankView();
                        break;
                    }

                    if (openingView != null)
                    {
                        this.OpenView(openingView);
                    }
                }

                if (!this.naviBarModuleMaster.Collapsed)
                {
                    buttonNaviBarHeader_Click(this.buttonNaviBarHeader, new EventArgs());
                }
            }
        }