Пример #1
0
        private void OpenOrderForm(int orderId)
        {
            if (orderId > 0)
            {
                bool isFormOpened = false;

                foreach (Form frm in Application.OpenForms)
                {
                    if (frm.Name == "FrmOrder")
                    {
                        ((FrmOrder)frm).rdoFindOrder.Checked    = true;
                        ((FrmOrder)frm).ddlFindBy.SelectedIndex = 0;
                        ((FrmOrder)frm).txtFindByValue.Text     = orderId.ToString();
                        ((FrmOrder)frm).PrepareForUpdateEntry(orderId);
                        frm.BringToFront();

                        isFormOpened = true;
                    }
                }

                if (isFormOpened == false)
                {
                    FrmOrder orderForm = new FrmOrder();
                    orderForm.MdiParent = FrmMain.ActiveForm;
                    orderForm.Location  = new Point(5, 5);

                    orderForm.rdoFindOrder.Checked    = true;
                    orderForm.ddlFindBy.SelectedIndex = 0;
                    orderForm.txtFindByValue.Text     = orderId.ToString();
                    orderForm.PrepareForUpdateEntry(orderId);
                    orderForm.Show();
                }
            }
        }
Пример #2
0
        private void orderToolStripButton_Click(object sender, EventArgs e)
        {
            bool isFormOpened = false;

            foreach (Form frm in Application.OpenForms)
            {
                if (frm.Name == "FrmOrder")
                {
                    frm.BringToFront();
                    isFormOpened = true;
                }
            }

            if (isFormOpened == false)
            {
                FrmOrder orderForm = new FrmOrder();
                orderForm.MdiParent = this;
                orderForm.Location  = new Point(5, 5);
                orderForm.Show();
            }
        }
Пример #3
0
        private void btnPlaceOrder_Click(object sender, EventArgs e)
        {
            bool isFormOpened = false;
            int  customerNo   = 0;

            int.TryParse(txtCustomerNo.Text, out customerNo);

            if (customerNo < 1)
            {
                MessageBox.Show("Please select a customer to place an order.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            FrmOrder orderForm;

            foreach (Form frm in Application.OpenForms)
            {
                if (frm.Name == "FrmOrder")
                {
                    isFormOpened        = true;
                    orderForm           = (FrmOrder)frm;
                    orderForm.MdiParent = ActiveForm;
                    //orderForm.Location = new Point(5, 5);
                    orderForm.CustomerNo = customerNo.ToString();
                    orderForm.FillCustomerDetailById(customerNo);
                    orderForm.BringToFront();
                }
            }

            if (isFormOpened == false)
            {
                orderForm            = new FrmOrder();
                orderForm.MdiParent  = FrmMain.ActiveForm;
                orderForm.Location   = new Point(5, 5);
                orderForm.CustomerNo = customerNo.ToString();
                orderForm.Show();
            }
        }