Exemplo n.º 1
0
        public void ShowForm(string formName)
        {
            try
            {
                switch (formName)
                {
                case "frmClientMaster":
                    if (frmClientMaster == null)
                    {
                        frmClientMaster = new frmClientMaster();
                        //frmClientMaster.MdiParent = this;
                        frmClientMaster.Show();
                        frmClientMaster.BringToFront();
                    }
                    else if (frmClientMaster.IsDisposed == true)
                    {
                        frmClientMaster = new frmClientMaster();
                        //frmClientMaster.MdiParent = this;
                        frmClientMaster.Show();
                        frmClientMaster.BringToFront();
                    }
                    else
                    {
                        frmClientMaster.Activate();
                        frmClientMaster.Show();
                        frmClientMaster.BringToFront();
                    }
                    break;

                case "frmStateMaster":
                    if (frmStateMaster == null)
                    {
                        frmStateMaster = new frmStateMaster();
                        //frmClientMaster.MdiParent = this;
                        frmStateMaster.IsLookup = 0;
                        frmStateMaster.Show();
                        frmStateMaster.BringToFront();
                    }
                    else if (frmStateMaster.IsDisposed == true)
                    {
                        frmStateMaster = new frmStateMaster();
                        //frmClientMaster.MdiParent = this;
                        frmStateMaster.IsLookup = 0;
                        frmStateMaster.Show();
                        frmStateMaster.BringToFront();
                    }
                    else
                    {
                        frmStateMaster.Activate();
                        frmStateMaster.Show();
                        frmStateMaster.BringToFront();
                    }
                    break;

                case "frmCityMaster":
                    if (frmCityMaster == null)
                    {
                        frmCityMaster = new frmCityMaster();
                        //frmClientMaster.MdiParent = this;
                        frmCityMaster.IsLookup = 0;
                        frmCityMaster.Show();
                        frmCityMaster.BringToFront();
                    }
                    else if (frmCityMaster.IsDisposed == true)
                    {
                        frmCityMaster = new frmCityMaster();
                        //frmClientMaster.MdiParent = this;
                        frmCityMaster.IsLookup = 0;
                        frmCityMaster.Show();
                        frmCityMaster.BringToFront();
                    }
                    else
                    {
                        frmCityMaster.Activate();
                        frmCityMaster.Show();
                        frmCityMaster.BringToFront();
                    }
                    break;

                case "frmIndustryTypeMaster":
                    if (frmIndustryTypeMaster == null)
                    {
                        frmIndustryTypeMaster = new frmIndustryTypeMaster();
                        //frmClientMaster.MdiParent = this;
                        frmIndustryTypeMaster.IsLookup = 0;
                        frmIndustryTypeMaster.Show();
                        frmIndustryTypeMaster.BringToFront();
                    }
                    else if (frmIndustryTypeMaster.IsDisposed == true)
                    {
                        frmIndustryTypeMaster = new frmIndustryTypeMaster();
                        //frmClientMaster.MdiParent = this;
                        frmIndustryTypeMaster.IsLookup = 0;
                        frmIndustryTypeMaster.Show();
                        frmIndustryTypeMaster.BringToFront();
                    }
                    else
                    {
                        frmIndustryTypeMaster.Activate();
                        frmIndustryTypeMaster.Show();
                        frmIndustryTypeMaster.BringToFront();
                    }
                    break;

                case "frmService":
                    if (frmService == null)
                    {
                        frmService = new frmService();
                        //frmClientMaster.MdiParent = this;
                        //frmService.IsLookup = 0;
                        frmService.Show();
                        frmService.BringToFront();
                    }
                    else if (frmService.IsDisposed == true)
                    {
                        frmService = new frmService();
                        //frmClientMaster.MdiParent = this;
                        //frmService.IsLookup = 0;
                        frmService.Show();
                        frmService.BringToFront();
                    }
                    else
                    {
                        frmService.Activate();
                        frmService.Show();
                        frmService.BringToFront();
                    }
                    break;

                case "frmFoodCategoryMaster":
                    if (frmFoodCategoryMaster == null)
                    {
                        frmFoodCategoryMaster           = new frmFoodCategoryMaster();
                        frmFoodCategoryMaster.MdiParent = this;
                        //frmFoodCategoryMaster.IsLookup = 0;
                        frmFoodCategoryMaster.Show();
                        frmFoodCategoryMaster.BringToFront();
                    }
                    else if (frmFoodCategoryMaster.IsDisposed == true)
                    {
                        frmFoodCategoryMaster           = new frmFoodCategoryMaster();
                        frmFoodCategoryMaster.MdiParent = this;
                        //frmFoodCategoryMaster.IsLookup = 0;
                        frmFoodCategoryMaster.Show();
                        frmFoodCategoryMaster.BringToFront();
                    }
                    else
                    {
                        frmFoodCategoryMaster.Activate();
                        frmFoodCategoryMaster.Show();
                        frmFoodCategoryMaster.BringToFront();
                    }
                    break;


                case "frmFoodItemMaster":
                    if (frmFoodItemMaster == null)
                    {
                        frmFoodItemMaster           = new frmFoodItemMaster();
                        frmFoodItemMaster.MdiParent = this;
                        //frmFoodItemMaster.IsLookup = 0;
                        frmFoodItemMaster.Show();
                        frmFoodItemMaster.BringToFront();
                    }
                    else if (frmFoodItemMaster.IsDisposed == true)
                    {
                        frmFoodItemMaster           = new frmFoodItemMaster();
                        frmFoodItemMaster.MdiParent = this;
                        //frmFoodItemMaster.IsLookup = 0;
                        frmFoodItemMaster.Show();
                        frmFoodItemMaster.BringToFront();
                    }
                    else
                    {
                        frmFoodItemMaster.Activate();
                        frmFoodItemMaster.Show();
                        frmFoodItemMaster.BringToFront();
                    }
                    break;

                case "frmSale":
                    if (frmSale == null)
                    {
                        frmSale           = new frmSale();
                        frmSale.MdiParent = this;
                        //frmSale.IsLookup = 0;
                        frmSale.Show();
                        frmSale.BringToFront();
                    }
                    else if (frmSale.IsDisposed == true)
                    {
                        frmSale           = new frmSale();
                        frmSale.MdiParent = this;
                        //frmSale.IsLookup = 0;
                        frmSale.Show();
                        frmSale.BringToFront();
                    }
                    else
                    {
                        frmSale.Activate();
                        frmSale.Show();
                        frmSale.BringToFront();
                    }
                    break;
                //case "CapitalLoanSetting":
                //    if (CapitalLoanSetting == null)
                //    {
                //        CapitalLoanSetting = new frmCapitalLoanSetting();
                //        CapitalLoanSetting.MdiParent = this;
                //        CapitalLoanSetting.Show();
                //        CapitalLoanSetting.BringToFront();
                //    }
                //    else if (CapitalLoanSetting.IsDisposed == true)
                //    {
                //        CapitalLoanSetting = new frmCapitalLoanSetting();
                //        CapitalLoanSetting.MdiParent = this;
                //        CapitalLoanSetting.Show();
                //        CapitalLoanSetting.BringToFront();
                //    }
                //    else
                //    {
                //        CapitalLoanSetting.Activate();
                //        CapitalLoanSetting.Show();
                //        CapitalLoanSetting.BringToFront();
                //    }
                //    break;
                //case "MeetingFile":
                //    if (MeetingFile == null)
                //    {
                //        MeetingFile = new frmMeetingFile();
                //        MeetingFile.MdiParent = this;
                //        MeetingFile.Size = this.Size;
                //        MeetingFile.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                //        MeetingFile.Dock = DockStyle.Fill;
                //        MeetingFile.Show();
                //        MeetingFile.BringToFront();
                //    }
                //    else if (MeetingFile.IsDisposed == true)
                //    {
                //        MeetingFile = new frmMeetingFile();
                //        MeetingFile.MdiParent = this;
                //        MeetingFile.Size = this.Size;
                //        MeetingFile.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                //        MeetingFile.Dock = DockStyle.Fill;
                //        MeetingFile.Show();
                //        MeetingFile.BringToFront();
                //    }
                //    else
                //    {
                //        MeetingFile.Activate();
                //        //MeetingFile.Show();
                //        //MeetingFile.BringToFront();
                //        MeetingFile.MdiParent = this;
                //        MeetingFile.Size = this.Size;
                //        MeetingFile.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                //        MeetingFile.Dock = DockStyle.Fill;
                //        MeetingFile.Show();
                //        MeetingFile.BringToFront();
                //    }

                //    break;


                default:    //Defautl meeting file at home
                    //if (MeetingFile == null)
                    //{
                    //    MeetingFile = new frmMeetingFile();
                    //    MeetingFile.MdiParent = this;
                    //    MeetingFile.Show();
                    //    MeetingFile.BringToFront();
                    //}
                    //else if (MeetingFile.IsDisposed == true)
                    //{
                    //    MeetingFile = new frmMeetingFile();
                    //    MeetingFile.MdiParent = this;
                    //    MeetingFile.Show();
                    //    MeetingFile.BringToFront();
                    //}
                    //else
                    //{
                    //    MeetingFile.Activate();
                    //    MeetingFile.Show();
                    //    MeetingFile.BringToFront();
                    //}

                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 2
0
        public void ShowForm(string formName)
        {
            try
            {
                switch (formName)
                {
                case "frmFoodCategoryMaster":
                    if (frmFoodCategoryMaster == null)
                    {
                        frmFoodCategoryMaster           = new frmFoodCategoryMaster();
                        frmFoodCategoryMaster.MdiParent = this;
                        //frmFoodCategoryMaster.IsLookup = 0;
                        frmFoodCategoryMaster.Show();
                        frmFoodCategoryMaster.BringToFront();
                    }
                    else if (frmFoodCategoryMaster.IsDisposed == true)
                    {
                        frmFoodCategoryMaster           = new frmFoodCategoryMaster();
                        frmFoodCategoryMaster.MdiParent = this;
                        //frmFoodCategoryMaster.IsLookup = 0;
                        frmFoodCategoryMaster.Show();
                        frmFoodCategoryMaster.BringToFront();
                    }
                    else
                    {
                        frmFoodCategoryMaster.Activate();
                        frmFoodCategoryMaster.Show();
                        frmFoodCategoryMaster.BringToFront();
                    }
                    break;


                case "frmFoodItemMaster":
                    if (frmFoodItemMaster == null)
                    {
                        frmFoodItemMaster           = new frmFoodItemMaster();
                        frmFoodItemMaster.MdiParent = this;
                        //frmFoodItemMaster.IsLookup = 0;
                        frmFoodItemMaster.Show();
                        frmFoodItemMaster.BringToFront();
                    }
                    else if (frmFoodItemMaster.IsDisposed == true)
                    {
                        frmFoodItemMaster           = new frmFoodItemMaster();
                        frmFoodItemMaster.MdiParent = this;
                        //frmFoodItemMaster.IsLookup = 0;
                        frmFoodItemMaster.Show();
                        frmFoodItemMaster.BringToFront();
                    }
                    else
                    {
                        frmFoodItemMaster.Activate();
                        frmFoodItemMaster.Show();
                        frmFoodItemMaster.BringToFront();
                    }
                    break;

                case "frmSale":
                    if (frmSale == null)
                    {
                        frmSale           = new frmSale();
                        frmSale.MdiParent = this;
                        //frmSale.IsLookup = 0;
                        frmSale.Show();
                        frmSale.BringToFront();
                    }
                    else if (frmSale.IsDisposed == true)
                    {
                        frmSale           = new frmSale();
                        frmSale.MdiParent = this;
                        //frmSale.IsLookup = 0;
                        frmSale.Show();
                        frmSale.BringToFront();
                    }
                    else
                    {
                        frmSale.Activate();
                        frmSale.Show();
                        frmSale.BringToFront();
                    }
                    break;


                case "frmBackup":
                    if (frmBackup == null)
                    {
                        frmBackup           = new frmBackup();
                        frmBackup.MdiParent = this;
                        //frmSale.IsLookup = 0;
                        frmBackup.Show();
                        frmBackup.BringToFront();
                    }
                    else if (frmBackup.IsDisposed == true)
                    {
                        frmBackup           = new frmBackup();
                        frmBackup.MdiParent = this;
                        //frmSale.IsLookup = 0;
                        frmBackup.Show();
                        frmBackup.BringToFront();
                    }
                    else
                    {
                        frmBackup.Activate();
                        frmBackup.Show();
                        frmBackup.BringToFront();
                    }
                    break;

                case "frmItemWiseSale":
                    if (frmItemWiseSale == null)
                    {
                        frmItemWiseSale           = new frmItemWiseSale();
                        frmItemWiseSale.MdiParent = this;
                        //frmSale.IsLookup = 0;
                        frmItemWiseSale.Show();
                        frmItemWiseSale.BringToFront();
                    }
                    else if (frmItemWiseSale.IsDisposed == true)
                    {
                        frmItemWiseSale           = new frmItemWiseSale();
                        frmItemWiseSale.MdiParent = this;
                        //frmSale.IsLookup = 0;
                        frmItemWiseSale.Show();
                        frmItemWiseSale.BringToFront();
                    }
                    else
                    {
                        frmItemWiseSale.Activate();
                        frmItemWiseSale.Show();
                        frmItemWiseSale.BringToFront();
                    }
                    break;



                default:    //Defautl Sale
                    if (frmSale == null)
                    {
                        frmSale           = new frmSale();
                        frmSale.MdiParent = this;
                        //frmSale.IsLookup = 0;
                        frmSale.Show();
                        frmSale.BringToFront();
                    }
                    else if (frmSale.IsDisposed == true)
                    {
                        frmSale           = new frmSale();
                        frmSale.MdiParent = this;
                        //frmSale.IsLookup = 0;
                        frmSale.Show();
                        frmSale.BringToFront();
                    }
                    else
                    {
                        frmSale.Activate();
                        frmSale.Show();
                        frmSale.BringToFront();
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }