コード例 #1
0
 public Order(int orderID, string CustomerID, int EmployeeID)
 {
     this.orderID    = orderID;
     this.CustomerID = CustomerID;
     this.EmployeeID = EmployeeID;
     Status          = WorkEnum.New;
 }
コード例 #2
0
        public Order(int orderID, string CustomerID, int EmployeeID, DateTime OrderDate, DateTime RequiredDate, DateTime ShippedDate,
                     int ShipVia, decimal Freight, string ShipName, string ShipAddress, string ShipCity, string ShipRegion, string ShipPostalCode, string ShipCounty)
        {
            this.orderID        = orderID;
            this.CustomerID     = CustomerID;
            this.EmployeeID     = EmployeeID;
            this.OrderDate      = OrderDate;
            this.RequiredDate   = RequiredDate;
            this.ShippedDate    = ShippedDate;
            this.ShipVia        = ShipVia;
            this.Freight        = Freight;
            this.ShipName       = ShipName;
            this.ShipAddress    = ShipAddress;
            this.ShipCity       = ShipCity;
            this.ShipRegion     = ShipRegion;
            this.ShipPostalCode = ShipPostalCode;
            this.ShipCounty     = ShipCounty;

            if (ShippedDate == DateTime.MinValue)
            {
                if (OrderDate == DateTime.MinValue)
                {
                    Status = WorkEnum.New;
                }
                else
                {
                    Status = WorkEnum.InTheWork;
                }
            }
            else
            {
                Status = WorkEnum.Made;
            }
        }
コード例 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] WorkEnum workEnum)
        {
            if (id != workEnum.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(workEnum);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!WorkEnumExists(workEnum.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(workEnum));
        }
コード例 #4
0
        public void CanChangeWorkEnumName()
        {
            var u = new WorkEnum {
                Id = 3, Name = "name"
            };

            u.Name = "Text";
            Assert.Equal("Text", u.Name);
        }
コード例 #5
0
        public void CanChangeWorkEnumId()
        {
            var u = new WorkEnum {
                Id = 3, Name = "name"
            };

            u.Id = 4;
            Assert.Equal(4, u.Id);
        }
コード例 #6
0
        public async Task <IActionResult> Create([Bind("Id,Name")] WorkEnum workEnum)
        {
            if (ModelState.IsValid)
            {
                _context.Add(workEnum);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(workEnum));
        }
コード例 #7
0
 public Order()
 {
     Status = WorkEnum.New;
 }