예제 #1
0
 public DeliveryTask(DefaultAddress from, DefaultAddress to) :
     base(JobTaskTypes.DELIVERY, "Deliverying Package")
 {
     this.From = from;
     this.To = to;
     this.Result = new AssetTaskResult();
 }
예제 #2
0
 public DeliveryTask(DefaultAddress from, DefaultAddress to) :
     base(JobTaskTypes.DELIVERY, "Delivery")
 {
     this.From   = from;
     this.To     = to;
     this.Result = new AssetTaskResult();
 }
예제 #3
0
 protected DeliveryTask(DefaultAddress from, DefaultAddress to, string type) :
     this(from, to)
 {
     this.Type = type;
     if (type != JobTaskTypes.SECURE_DELIVERY)
     {
         throw new NotSupportedException($"{type} is not supported as a JobTaskType under Delivery JobTask");
     }
 }
예제 #4
0
        public int Delete(Guid customerId, int addressId, bool persist = true)
        {
            DefaultAddress cartDetail = Find(c => c.AddressId == addressId && c.CustomerId == customerId);

            cartDetail.IsDeleted = true;
            Table.Update(cartDetail);
            //Table.Attach(cartDetail).State = EntityState.IsDeleted;
            return(persist ? SaveChanges() : 0);
        }
예제 #5
0
        public void Test_DefaultAddress_Creation()
        {
            addressWithFormattedString = new DefaultAddress("Test Formatted Address", new Point(new double[] { 1, 2 }.ToList()));
            Assert.AreEqual("Test Formatted Address", addressWithFormattedString.Address);

            address       = new DefaultAddress("Test AddressLine 1", "Test AddressLine 2", "Testlocality", "Dhaka", "1217", "Bangladesh", new Point(new double[] { 1, 2 }.ToList()));
            address.State = "Dhaka";
            Assert.AreEqual("Test AddressLine 1", address.AddressLine1);
            Assert.AreEqual("Test AddressLine 2", address.AddressLine2);
            Assert.AreEqual("Dhaka", address.City);
            Assert.AreEqual("1217", address.PostalCode);
            Assert.AreEqual("Bangladesh", address.Country);
            Assert.AreEqual("Test AddressLine 1, Test AddressLine 2, Testlocality, Dhaka-1217, Dhaka, Bangladesh", address.Address);
        }
예제 #6
0
        public void Test_DefaultAddress_Creation()
        {
            addressWithFormattedString = new DefaultAddress("Test Formatted Address", new Point(new double[] { 1, 2 }.ToList()));
            Assert.AreEqual("Test Formatted Address", addressWithFormattedString.Address);

            address = new DefaultAddress("Test AddressLine 1", "Test AddressLine 2", "TestLocality", "Dhaka", "1217", "Bangladesh", new Point(new double[] { 1, 2 }.ToList()));
            address.State = "Dhaka";
            Assert.AreEqual("Test AddressLine 1", address.AddressLine1);
            Assert.AreEqual("Test AddressLine 2", address.AddressLine2);
            Assert.AreEqual("Dhaka", address.City);
            Assert.AreEqual("1217", address.PostalCode);
            Assert.AreEqual("Bangladesh", address.Country);
            Assert.AreEqual("Test AddressLine 1, Test AddressLine 2, TestLocality, Dhaka-1217, Dhaka, Bangladesh", address.Address);
        }
예제 #7
0
        public void Test_DeliveryOrder_Creation_With_Name()
        {
            DefaultAddress FromLocation       = new DefaultAddress("Test From Address", new Point((new double[] { 1, 2 }).ToList()));
            DefaultAddress ToLocation         = new DefaultAddress("Test To Address", new Point((new double[] { 2, 1 }).ToList()));
            string         orderName          = "Test Delivery Order";
            string         PackageDescription = "Sample Package Description";

            List <ItemDetails> invoiceItems = new List <ItemDetails>();

            invoiceItems.Add(new ItemDetails()
            {
                Item     = "Test Item 1",
                Price    = 100,
                Quantity = 1,
                VAT      = 10,
                Weight   = 5
            });

            invoiceItems.Add(new ItemDetails()
            {
                Item     = "Test Item 2",
                Price    = 100,
                Quantity = 3,
                VAT      = 20,
                Weight   = 2
            });

            DeliveryOrder order = new DeliveryOrder(orderName);

            order.From        = FromLocation;
            order.To          = ToLocation;
            order.Description = PackageDescription;
            order.UserId      = "12345678";

            Assert.IsNotNull(order);
            Assert.AreEqual(FromLocation, order.From);
            Assert.AreEqual(ToLocation, order.To);
            Assert.AreEqual(orderName, order.Name);
            Assert.AreEqual("default", order.Variant);
            Assert.AreEqual(JobTaskTypes.DELIVERY, order.Type);
            Assert.Null(order.ETA);
            Assert.Null(order.ETAMinutes);
            Assert.AreEqual("12345678", order.UserId);
        }
예제 #8
0
        public void Test_DeliveryOrder_Creation_With_Name()
        {
            DefaultAddress FromLocation = new DefaultAddress("Test From Address", new Point((new double[] { 1, 2 }).ToList()));
            DefaultAddress ToLocation = new DefaultAddress("Test To Address", new Point((new double[] { 2, 1 }).ToList()));
            string orderName = "Test Delivery Order";
            string PackageDescription = "Sample Package Description";

            List<ItemDetails> invoiceItems = new List<ItemDetails>();
            invoiceItems.Add(new ItemDetails()
            {
                Item = "Test Item 1",
                Price = 100,
                Quantity = 1,
                VAT = 10,
                Weight = 5
            });

            invoiceItems.Add(new ItemDetails()
            {
                Item = "Test Item 2",
                Price = 100,
                Quantity = 3,
                VAT = 20,
                Weight = 2
            });

            DeliveryOrder order = new DeliveryOrder(orderName);
            order.From = FromLocation;
            order.To = ToLocation;
            order.Description = PackageDescription;
            order.UserId = "12345678";

            Assert.IsNotNull(order);
            Assert.AreEqual(FromLocation, order.From);
            Assert.AreEqual(ToLocation, order.To);
            Assert.AreEqual(orderName, order.Name);
            Assert.AreEqual("default", order.Variant);
            Assert.AreEqual(JobTaskTypes.DELIVERY, order.Type);
            Assert.Null(order.ETA);
            Assert.Null(order.ETAMinutes);
            Assert.AreEqual("12345678", order.UserId);
        }
예제 #9
0
 public PackagePickUpTask(DefaultAddress pickupLocation) : base(JobTaskTypes.PACKAGE_PICKUP, pickupLocation)
 {
     this.Name   = "Package pick up";
     this.Result = new AssetTaskResult();
 }
예제 #10
0
 public AssignAssetTask(string type, string name, DefaultAddress from, DefaultAddress to) : base(type, name)
 {
     From = from;
     To = to;
 }
예제 #11
0
        //public int Update(Guid customerId, int cartId, int newQuantity, bool persist = true)
        //{
        //    DefaultAddress cartDetail = Find(c => c.AddressId == cartId && c.CustomerId == customerId);
        //    Table.Attach(cartDetail).State = EntityState.Deleted;
        //    return persist ? SaveChanges() : 0;
        //}

        public virtual int Delete(DefaultAddress entity, bool persist = true)
        {
            entity.IsDeleted = true;
            Table.Update(entity);
            return(persist ? SaveChanges() : 0);
        }
예제 #12
0
 public int Add(DefaultAddress entity, bool persist = true)
 {
     Table.Add(entity);
     return(persist ? SaveChanges() : 0);
 }
예제 #13
0
 public SecureDeliveryTask(DefaultAddress from, DefaultAddress to) :
     base(from, to, JobTaskTypes.SECURE_DELIVERY)
 {
     this.Name = "Secure delivery";
 }
예제 #14
0
 public RidePickUpTask(DefaultAddress pickupLocation) :base(JobTaskTypes.RIDE_PICKUP, "Picking up", pickupLocation)
 {
     this.PickupLocation = pickupLocation;
 }
예제 #15
0
 public PickUpTask(string type, string name, DefaultAddress pickupLocation) : base(type, name)
 {
     this.PickupLocation = pickupLocation;
 }
예제 #16
0
 public FetchDeliveryManTask(DefaultAddress from, DefaultAddress to) : base(JobTaskTypes.FETCH_DELIVERYMAN, "Fetching Delivery Guy", from, to)
 {
     this.Result = new DefaultAssignAssetTaskResult();
 }     
예제 #17
0
 public void Test_DefaultAddress_Creation_Without_AddressLine()
 {
     Assert.Throws <ArgumentException>(() => {
         address = new DefaultAddress("", "Test AddressLine 2", "Testlocality", "Dhaka", "1217", "Bangladesh", new Point(new double[] { 1, 2 }.ToList()));
     });
 }
예제 #18
0
 public DropPoint(string userId, string name, DefaultAddress address)
 {
     this.Name    = name;
     this.UserId  = userId;
     this.Address = address;
 }
예제 #19
0
 public PickUpTask(string type, DefaultAddress pickupLocation) : base(type, "Pick up")
 {
     this.PickupLocation = pickupLocation;
 }
예제 #20
0
 public FetchDeliveryManTask(DefaultAddress from, DefaultAddress to) : base(JobTaskTypes.FETCH_DELIVERYMAN, from, to)
 {
     this.Result = new DefaultAssignAssetTaskResult();
 }
예제 #21
0
 protected DeliveryTask(DefaultAddress from, DefaultAddress to, string type, string name) : 
     base(type, name)
 {
     if (type != JobTaskTypes.SECURE_DELIVERY)
         throw new NotSupportedException($"{type} is not supported as a JobTaskType under Delivery JobTask");
 }
예제 #22
0
 public AssignAssetTask(string type, DefaultAddress from, DefaultAddress to) : base(type, "Assign asset")
 {
     From = from;
     To   = to;
 }
예제 #23
0
 public SecureDeliveryTask(DefaultAddress from, DefaultAddress to) : 
     base(from, to, JobTaskTypes.SECURE_DELIVERY, "Deliverying Secure Package")
 {
 }
예제 #24
0
 public PackagePickUpTask(DefaultAddress pickupLocation) : base(JobTaskTypes.PACKAGE_PICKUP, "Picking up Package", pickupLocation)
 {
     this.Result = new AssetTaskResult();
 }
예제 #25
0
 public DropPoint(string userId, string name, DefaultAddress address)
 {
     this.Name = name;
     this.UserId = userId;
     this.Address = address;
 }
예제 #26
0
 public void Test_DefaultAddress_Creation_Without_AddressLine()
 {
     Assert.Throws<ArgumentException>(()=> {
         address = new DefaultAddress("", "Test AddressLine 2", "TestLocality", "Dhaka", "1217", "Bangladesh", new Point(new double[] { 1, 2 }.ToList()));
     });            
 }
예제 #27
0
        public Asset ProposedRide { get; set; } //FIXME: It will definitely not be a hardburned Asset reference of course

        public FetchRideTask(DefaultAddress from, DefaultAddress to, Asset proposedRide = null) : base(JobTaskTypes.FETCH_RIDE, "Fetching Ride", from, to)
        {
            this.Result = new DefaultAssignAssetTaskResult();
            ProposedRide = proposedRide;
        }