Esempio n. 1
0
        public void MapEFToBO()
        {
            var  mapper = new DALSaleMapper();
            Sale entity = new Sale();

            entity.SetProperties(1m, "A", 1, "A", 1, 1, "A");

            BOSale response = mapper.MapEFToBO(entity);

            response.Amount.Should().Be(1m);
            response.FirstName.Should().Be("A");
            response.Id.Should().Be(1);
            response.LastName.Should().Be("A");
            response.PaymentTypeId.Should().Be(1);
            response.PetId.Should().Be(1);
            response.Phone.Should().Be("A");
        }
Esempio n. 2
0
        public void MapBOToEF()
        {
            var mapper = new DALSaleMapper();
            var bo     = new BOSale();

            bo.SetProperties(1, 1m, "A", "A", 1, 1, "A");

            Sale response = mapper.MapBOToEF(bo);

            response.Amount.Should().Be(1m);
            response.FirstName.Should().Be("A");
            response.Id.Should().Be(1);
            response.LastName.Should().Be("A");
            response.PaymentTypeId.Should().Be(1);
            response.PetId.Should().Be(1);
            response.Phone.Should().Be("A");
        }
Esempio n. 3
0
        public void MapEFToBO()
        {
            var  mapper = new DALSaleMapper();
            Sale entity = new Sale();

            entity.SetProperties(1m, 1, 1, "A", 1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1);

            BOSale response = mapper.MapEFToBO(entity);

            response.Amount.Should().Be(1m);
            response.ClientId.Should().Be(1);
            response.Id.Should().Be(1);
            response.Note.Should().Be("A");
            response.PetId.Should().Be(1);
            response.SaleDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.SalesPersonId.Should().Be(1);
        }
Esempio n. 4
0
        public void MapBOToEF()
        {
            var mapper = new DALSaleMapper();
            var bo     = new BOSale();

            bo.SetProperties(1, 1m, 1, "A", 1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1);

            Sale response = mapper.MapBOToEF(bo);

            response.Amount.Should().Be(1m);
            response.ClientId.Should().Be(1);
            response.Id.Should().Be(1);
            response.Note.Should().Be("A");
            response.PetId.Should().Be(1);
            response.SaleDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.SalesPersonId.Should().Be(1);
        }
 private void OpenSaleDialog(BOSale saleModel)
 {
     if (saleModel is BOSaleQuote && SecurityUtil.CheckAccess("Sale_ReadSaleQuote"))
     {
         FrmSaleQuote frm = new FrmSaleQuote();
         frm.Model = (BOSaleQuote)saleModel;
         frm.ShowDialog();
     }
     else if (saleModel is BOSaleOrder && SecurityUtil.CheckAccess("Sale_ReadSaleOrder"))
     {
         FrmSaleOrder frm = new FrmSaleOrder();
         frm.Model = (BOSaleOrder)saleModel;
         frm.ShowDialog();
     }
     else if (saleModel is BOSaleOpenInvoice && SecurityUtil.CheckAccess("Sale_ReadSaleOpenInvoice"))
     {
         FrmSaleOpenInvoice frm = new FrmSaleOpenInvoice();
         frm.Model = (BOSaleOpenInvoice)saleModel;
         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);
            }
        }
        private void btnCreateOrder_Click(object sender, EventArgs e)
        {
            BOSale saleModel = mModel.CreateItem(Status.StatusType.Order);

            OpenSaleDialog(saleModel);
        }