private void Sale_CreateSaleOrder()
 {
     if (SecurityUtil.CheckAccess("Sale_CreateSaleOrder"))
     {
         FrmSaleOrder frm = new FrmSaleOrder();
         frm.Model = AccountantPool.Instance.CurrentAccountant.SaleFactory.CreateSaleOrder();
         ShowWindowsForm(frm);
     }
 }
 private void OpenJournalDialog(BusinessObject model)
 {
     if (model is BOSaleQuote)
     {
         FrmSaleQuote frm = new FrmSaleQuote();
         frm.Model = (BOSaleQuote)model;
         frm.ShowDialog();
     }
     else if (model is BOSaleOrder)
     {
         FrmSaleOrder frm = new FrmSaleOrder();
         frm.Model = (BOSaleOrder)model;
         frm.ShowDialog();
     }
     else if (model is BOSaleOpenInvoice)
     {
         FrmSaleOpenInvoice frm = new FrmSaleOpenInvoice();
         frm.Model = (BOSaleOpenInvoice)model;
         frm.ShowDialog();
     }
     else if (model is BOPurchaseQuote)
     {
         FrmPurchaseQuote frm = new FrmPurchaseQuote();
         frm.Model = (BOPurchaseQuote)model;
         frm.ShowDialog();
     }
     else if (model is BOPurchaseOrder)
     {
         FrmPurchaseOrder frm = new FrmPurchaseOrder();
         frm.Model = (BOPurchaseOrder)model;
         frm.ShowDialog();
     }
     else if (model is BOPurchaseOpenBill)
     {
         FrmPurchaseOpenBill frm = new FrmPurchaseOpenBill();
         frm.Model = (BOPurchaseOpenBill)model;
         frm.ShowDialog();
     }
 }
        public void ShowSale(BOSale model)
        {
            BaseView frm = null;

            if (model is BOSaleQuote)
            {
                if (mApplicationController.CheckAccess(BOType.BOSaleQuote, BOPropertyAttrType.Visible))
                {
                    if (IsInvalid(mFrmSaleQuote))
                    {
                        mFrmSaleQuote = new FrmSaleQuote(mApplicationController, model as BOSaleQuote);
                    }
                    else
                    {
                        mFrmSaleQuote.Model = model as BOSaleQuote;
                        mFrmSaleQuote.UpdateView();
                    }
                    frm = mFrmSaleQuote;
                }
            }
            else if (model is BOSaleOrder)
            {
                if (mApplicationController.CheckAccess(BOType.BOSaleOrder, BOPropertyAttrType.Visible))
                {
                    if (IsInvalid(mFrmSaleOrder))
                    {
                        mFrmSaleOrder = new FrmSaleOrder(mApplicationController, model as BOSaleOrder);
                    }
                    else
                    {
                        mFrmSaleOrder.Model = model as BOSaleOrder;
                        mFrmSaleOrder.UpdateView();
                    }
                    frm = mFrmSaleOrder;
                }
            }
            else if (model is BOSaleOpenInvoice)
            {
                if (mApplicationController.CheckAccess(BOType.BOSaleOpenInvoice, BOPropertyAttrType.Visible))
                {
                    if (IsInvalid(mFrmSaleOpenInvoice))
                    {
                        mFrmSaleOpenInvoice = new FrmSaleOpenInvoice(mApplicationController, model as BOSaleOpenInvoice);
                    }
                    else
                    {
                        mFrmSaleOpenInvoice.Model = model as BOSaleOpenInvoice;
                        mFrmSaleOpenInvoice.UpdateView();
                    }
                    frm = mFrmSaleOpenInvoice;
                }
            }
            else if (model is BOSaleCreditReturn)
            {
                if (mApplicationController.CheckAccess(BOType.BOSaleCreditReturn, BOPropertyAttrType.Visible))
                {
                    if (IsInvalid(mFrmSaleCreditReturn))
                    {
                        mFrmSaleCreditReturn = new FrmSaleCreditReturn(mApplicationController, model as BOSaleCreditReturn);
                    }
                    else
                    {
                        mFrmSaleCreditReturn.Model = model as BOSaleCreditReturn;
                        mFrmSaleCreditReturn.UpdateView();
                    }
                    frm = mFrmSaleCreditReturn;
                }
            }
            else if (model is BOSaleClosedInvoice)
            {
                if (mApplicationController.CheckAccess(BOType.BOSaleClosedInvoice, BOPropertyAttrType.Visible))
                {
                    if (IsInvalid(mFrmSaleClosedInvoice))
                    {
                        mFrmSaleClosedInvoice = new FrmSaleClosedInvoice(mApplicationController, model as BOSaleClosedInvoice);
                    }
                    else
                    {
                        mFrmSaleClosedInvoice.Model = model as BOSaleClosedInvoice;
                        mFrmSaleClosedInvoice.UpdateView();
                    }
                    frm = mFrmSaleClosedInvoice;
                }
            }

            if (frm != null)
            {
                SetCurrentForm(frm);
            }
        }