コード例 #1
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         DALObj = null;
     }
     base.Dispose(disposing);
 }
コード例 #2
0
        public ActionResult Create(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("BadRequest", "Home"));
            }
            if (Common.Props.LoginUser == null)
            {
                return(RedirectToAction("Login", "Users", new { ReturnUrl = "/SaleInvoice/Create" }));
            }
            else if (Common.Props.LoginUser != null && !(Common.Props.LoginUser.Role == Models.Users.eUserRoleID.Admin))
            {
                return(RedirectToAction("PermissionDenied", "Home"));
            }

            SaleInvoiceDAL       SIDAL       = new SaleInvoiceDAL();
            SaleInvoiceViewModel SaleInvoice = SIDAL.FindByID(id.Value);

            if (SaleInvoice == null)
            {
                return(RedirectToAction("RecordNotFound", "Home"));
            }

            BoxListViewModel ViewModel = new BoxListViewModel()
            {
                SaleInvoiceID = SaleInvoice.SaleInvoiceID,

                BusinessName        = SaleInvoice.BusinessName,
                ContactName         = SaleInvoice.ContactName,
                Address             = SaleInvoice.Address,
                City                = SaleInvoice.City,
                Postcode            = SaleInvoice.Postcode,
                Country             = SaleInvoice.Country,
                IntPhoneNo          = SaleInvoice.IntPhoneNo,
                EMailContact        = SaleInvoice.EMailContact,
                AirportDestCity     = SaleInvoice.AirportDestCity,
                ShippingDate        = SaleInvoice.ShippingDate,
                ArrivalDate         = SaleInvoice.ArrivalDate,
                DomesticFlight      = SaleInvoice.DomesticFlight,
                InternationalFlight = SaleInvoice.InternationalFlight,

                BoxListDetails = new List <BoxListBoxDetailViewModel>()
                {
                    new BoxListBoxDetailViewModel()
                    {
                        BoxNo    = 1,
                        Products = new List <BoxListProductDetailViewModel>()
                        {
                            new BoxListProductDetailViewModel()
                            {
                            },
                        }
                    }
                }
            };

            return(View(ViewModel));
        }