public RedirectToRouteResult CompleteConsignment(int?id)
        {
            Consignment consi = wde.Consignments.Find(id);


            WorkerLogs           wl     = new WorkerLogs();
            Worker               worker = wde.Workers.Find(Convert.ToInt32(Session["WorkerID"]));
            JavaScriptSerializer jss    = new JavaScriptSerializer();

            if (worker.workerLogs != null)
            {
                List <WorkerLogs> workerlogs = Newtonsoft.Json.JsonConvert.DeserializeObject <List <WorkerLogs> >(worker.workerLogs);
                wl.date        = DateTime.Now.ToShortDateString();
                wl.time        = DateTime.Now.ToShortTimeString();
                wl.description = "Completed Consignment of " + consi.supplier;
                workerlogs.Add(wl);
                string jsObj = jss.Serialize(workerlogs);
                worker.workerLogs = jsObj;
                wde.SaveChanges();
            }



            consi.consignmentStatus = "Completed";
            wde.Entry(consi).State  = EntityState.Modified;
            wde.SaveChanges();


            return(RedirectToAction("ConsignmentsSlotted"));
        }
        public Consignment Update(Consignment entity)
        {
            var value = entity;

            unitOfWork.ConsignmentRepository.Update(value);
            return(entity);
        }
 private ConsignmentData CreateDropOffData(Consignment consignment)
 {
     return(new ConsignmentData
     {
         IntegrationKey = consignment.Reference,
         Reference = consignment.Reference,
         CargoType = CargoTypeData.Freight,
         ConsignorEntityIntegrationKey = _stop.Consignor.Reference,
         ConsigneeEntityIntegrationKey = _stop.Consignee.Reference,
         Dropoffs = new List <DropoffData>()
         {
             new DropoffData()
             {
                 IntegrationKey = consignment.Reference,
                 DueAt = consignment.DueAtDateTime.ToUniversalTime(),
                 EntityIntegrationKey = _stop.Consignee.Reference,
                 ShippingAddressIntegrationKey = _stop.Consignee.Reference,
                 EntityContactIntegrationKeys = _entityContactIntegrationKeys,
                 MaximumServiceTime = TimeSpan.FromMinutes(_stop.Consignee.MST),
                 ExpectedCompletionDate = consignment.DueAtDateTime.ToUniversalTime(),
                 SpecialInstructions = consignment.SpecialInstructions,
                 TimerType = "Up",
                 Reference = consignment.Reference,
                 InternalReference = consignment.ReferenceInternal,
                 Requirements = CreateRequirementData(),
                 Dimensions = CreateDimensionData(consignment),
                 Financial = CreateFinancialData(consignment),
                 HandlingUnits = CreateHandlingUnitData(consignment)
             }
         },
         Pickups = new List <PickupData>()
         {
         }
     });
 }
        public void ValidateParseModel_AssertSuccess()
        {
            var m = new Consignment
            {
                Receiver = new EdiPartnerIdentification
                {
                    EdiId = "CONIZVK"
                },
                Sender = new EdiPartnerIdentification
                {
                    PartnerId = "4711"
                },
                ShippingDate     = DateTime.Now,
                ReceivingPartner = new EdiPartnerIdentification
                {
                    Name = "Hans Marks"
                },
                ShippingPartner = new EdiPartnerIdentification
                {
                    Name   = "Franz Kafka",
                    Street = "Kafka Straße"
                }
            };

            var result = Converter.Serialize(m, false);

            Assert.NotNull(result);


            var test = Validator.ValidateSchema(result.Content, out var errors);
        }
Example #5
0
        private static Consignment CreateConsignment()
        {
            var guid        = PrimeActs.Service.IDGenerator.NewGuid('L');
            var consignment = new Consignment
            {
                ConsignmentID        = guid,
                ConsignmentReference = "blahRef", //guid.ToString().Replace("-", ""),
                //CreatedBy = "Test",
                CreatedDate = DateTime.Now,
                //IsActive = true,
                ObjectState            = ObjectState.Added,
                ConsignmentDescription = "TestDesc",
                ContractDate           = DateTime.Today,
                VehicleDetail          = "blah blah",
                //ReceivedDate = DateTime.Today,
                //DepartmentID = Guid.Parse("1732DADB-150B-416D-9972-035F16A972A9"),
                PortID = Guid.Parse("68041464-4812-3000-0076-000000000125"),
                //SupplierID = Guid.Parse("68041464-4812-3000-0076-000000000125"),
                DespatchDate = DateTime.Today,
                Handling     = 0,
                Commission   = 1,
                //OriginCountryID = Guid.Parse("E9EF69C1-B775-4918-B5A1-197D8231F0FE"),
                DespatchLocationID   = Guid.Parse("68041464-4851-0000-0076-000000000309"),
                Vehicle              = "blah",
                ShowVehicleOnInvoice = true,
                PurchaseTypeID       = Guid.Parse("A3ADEBD8-A70C-43C2-A0A0-4299772810E1"),
                SupplierReference    = "blahAgain"
            };

            return(consignment);
        }
Example #6
0
        public async Task <ActionResult> Create([Bind(Include = "SalesPersonID,DispatchDate,Campus,Locality,ContactName,Email,ReturnBy,AttentionOf")] Consignment consignment)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    db.Consignments.Add(consignment);
                    await db.SaveChangesAsync();

                    return(RedirectToAction("Details", new { consignment.ID }));
                }
            }
            catch (DataException /* dex */)
            {
                // Log the error (uncomment dex variable name and add a line here to write a log.
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
            }
            ApplicationUserManager userManager = HttpContext.GetOwinContext().GetUserManager <ApplicationUserManager>();
            List <ApplicationUser> users       = await userManager.Users.OrderBy(o => o.FirstName).ToListAsync();

            ApplicationUser user = await userManager.FindByEmailAsync(User.Identity.Name);

            ViewBag.SalesPersonID = new SelectList(users, "Id", "FullName", consignment.SalesPersonID);
            return(View(consignment));
        }
        public async Task <ActionResult> InternationalConnote(string crId, string cId)
        {
            LoadData <ConsigmentRequest> lo = await GetConsigmentRequest(crId);

            var item    = lo.Source;
            var connote = new Consignment();

            foreach (var consignment in item.Consignments)
            {
                if (consignment.WebId == cId)
                {
                    connote = consignment;
                    break;
                }
            }
            connote.Pemberi.Address.Postcode = int.Parse(Regex.Replace(connote.Pemberi.Address.Postcode, @"\D", "")).ToString("D5");
            UserProfile userProfile = await GetDesignation();

            var pcm = new printConnoteModel
            {
                referenceNo = item.ReferenceNo,
                consignment = connote,
                accountNo   = item.UserId,
                pickupDate  = (item.Payment.IsPickupScheduled ? item.Pickup.DateReady : item.ChangedDate),
                designation = userProfile.Designation,
            };

            return(View(pcm));
        }
Example #8
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Consignment consignment = (Consignment)Session["listconsign"];


            int id = consignBal.CreateConsignment(consignment);
        }
Example #9
0
 public AddConsignmentViewModel()
 {
     dataAccess  = DataAccess.DataAccess.Instance;
     products    = new ObservableCollection <Product>(dataAccess.Products);
     product     = new Product();
     consignment = new Consignment();
 }
Example #10
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Consignment consignment = db.Consignments.Find(id);

            List <Item_Consignment> ic    = db.Item_Consignment.Where(u => u.consignmentId == consignment.id).ToList();
            List <Item_Consignment> newIc = new List <Item_Consignment>();

            foreach (Item_Consignment i in ic)
            {
                i.Consignment = consignment;

                Item item = db.Items.Find(i.itemId);
                i.Item = item;
                newIc.Add(i);
            }
            ViewBag.ItemDetails = newIc;
            if (consignment == null)
            {
                return(HttpNotFound());
            }
            return(View(consignment));
        }
Example #11
0
        // GET: Consignments/Details/5
        public ActionResult Details(int?id)
        {
            ViewBag.PageName = "Consignments";
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Consignment             consignment = db.Consignments.Find(id);
            List <Item_Consignment> ic          = db.Item_Consignment.Where(u => u.consignmentId == consignment.id).ToList();
            List <Item_Consignment> newIc       = new List <Item_Consignment>();

            foreach (Item_Consignment i in ic)
            {
                i.Consignment = consignment;

                Item item = db.Items.Find(i.itemId);
                i.Item = item;
                newIc.Add(i);
            }

            ViewBag.ItemDetails = newIc;


            //Yaha se instruction ja rhi ha
            List <string> instructionList = Newtonsoft.Json.JsonConvert.DeserializeObject <List <string> >(consignment.instruction);

            ViewBag.Instructions = instructionList;


            if (consignment == null)
            {
                return(HttpNotFound());
            }
            return(View(consignment));
        }
Example #12
0
        public IHttpActionResult PutConsignment(int id, Consignment consignment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != consignment.ConsignmentId)
            {
                return(BadRequest());
            }

            db.Entry(consignment).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ConsignmentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public Consignment Map_ConsignmentDataModel_ToViewModel(Consignment_DataModel _consignment, List <Invoice_Header> result_invoiceHeaders)
        {
            DateTime dtCustomsBooked = Convert.ToDateTime(_consignment.Customs_Entered);
            DateTime dtBookedInDate  = Convert.ToDateTime(_consignment.Booked_In_Date);
            DateTime dtETAatPort     = Convert.ToDateTime(_consignment.ETA_At_Port);

            int  _deliveryStatus = calculationHandler.Return_ConsignmentDeliveryStatus_ToInt(_consignment);
            bool _orderInTransit = calculationHandler.Return_IsOrderInTransit_ToBool(_consignment);

            Consignment result = new Consignment()
            {
                Consignment_Number          = _consignment.Consignment_Number,
                Inland_Depot                = _consignment.Inland_Depot,
                Carrier_Code                = _consignment.Carrier_Code,
                Transport_Company           = _consignment.Ship_Nameetruck_plat,
                Customs_Booked              = dtCustomsBooked,
                Booked_In_Date              = dtBookedInDate,
                ETA_At_Port                 = dtETAatPort,
                Consignment_Delivery_Status = _deliveryStatus,
                Invoice_Headers             = result_invoiceHeaders,
                Supplier_Name               = _consignment.Supplier_Name,
                Order_In_Transit            = _orderInTransit
            };

            return(result);
        }
Example #14
0
        public Consignment GetConsignment(string id)
        {
            Consignment consignment = _context.Consignments.Where(a => a.Id.Equals(id))
                                      .SingleOrDefault();

            return(consignment);
        }
Example #15
0
        public Bill ReadBillByNewConsignmentId(int consignmentId, Consignment consignment)
        {
            Bill returnBill = new Bill();


            //BILL_ID	not required in new bill
//BILL_DATE	current data and time
//BILL_TYPE	by default it will normal bill type
//FK_CG_ID	from the method parameter
//PAXS	from consignment object from parameter
//ISCANCELLED	by default it is false
            //ISPRINTED	by default it is false

//ServiceCharge	numeric(18, 2)	Checked
            returnBill.NewBillItemDetails = this.ReadBillItems(consignment.FkAgentId, consignment.Country_Id, consignment.PaxDetails[0].VisaTypeOneId, consignment.PaxDetails[0].VisaTypeTwoId);
            for (int i = 0; i < returnBill.NewBillItemDetails.Count; i++)
            {
                if (returnBill.NewBillItemDetails[i].BillItemDescription.ToUpper().Equals("Service Charges"))
                {
                    returnBill.ServiceCharge = returnBill.NewBillItemDetails[i].ItemCharge;
                }
            }
            MiscellaneousBusinessAccess misBal = new MiscellaneousBusinessAccess();

            //returnBill.ServiceTax = misBal.ReadServiceTax();
            return(null);
//TotalAmt	initially 0
//ServiceTax	float	Checked
        }
Example #16
0
        private Consignment GetLatestConsignment(Product product)
        {
            Consignment latest = null;

            foreach (var consignment in product.Consignments)
            {
                if (latest == null)
                {
                    latest = consignment;
                }
                if (product.HasExpirationDate)
                {
                    if ((consignment.ExpirationDate <= latest.ExpirationDate && consignment.NumberOfContent > 0) || (consignment.ExpirationDate > latest.ExpirationDate && latest.NumberOfContent == 0))
                    {
                        latest = consignment;
                    }
                }

                if (product.HasConsignmentPrice)
                {
                    if ((consignment.Price <= latest.Price && consignment.NumberOfContent > 0) || (consignment.Price > latest.Price && latest.NumberOfContent == 0))
                    {
                        latest = consignment;
                    }
                }
            }
            return(latest);
        }
Example #17
0
        public Consignment CreateConsignment(Consignment consignment)
        {
            _context.Consignments.Add(consignment);
            _context.SaveChanges();

            return(consignment);
        }
        //AddInvoicesForAuctions
        //public void AddInvoicesForAuctions(List<Auction> auctions)
        //{
        //  decimal? Insurance = GetVariableCoefficient("InsuranceCoefficient");
        //  Insurance = (Insurance.HasValue) ? Insurance.Value : (decimal)0.4;

        //  //decimal? SalesTaxRate = GetVariableCoefficient("SalesTaxRate");
        //  decimal SalesTaxRate = (decimal)0.08625;//(SalesTaxRate.HasValue) ? SalesTaxRate.Value : (decimal)0.08625;

        //  List<Invoice> invoices = new List<Invoice>(auctions.Count);
        //  Invoice invoice;
        //  Bid winningBid;
        //  foreach (Auction auc in auctions)
        //  {
        //    winningBid = auc.WinningBid as Bid;
        //    if (winningBid == null || (auc.Reserve.HasValue && auc.Reserve.Value > winningBid.Amount) || (winningBid.User.UserType_ID == (byte)Consts.UserTypes.HouseBidder)) continue;
        //    invoice = new Invoice();
        //    invoice.Auction_ID = auc.ID;
        //    invoice.Amount = winningBid.Amount;
        //    invoice.Cost = winningBid.Amount * (1 + auc.Event.BuyerFee.Value / 100);
        //    invoice.Comments = "Regular auction won item";
        //    invoice.DateCreated = DateTime.Now;
        //    invoice.IsPaid = false;
        //    invoice.IsSent = false;
        //    invoice.Quantity = 1;
        //    invoice.Shipping = (auc.Shipping.HasValue) ? auc.Shipping.Value : 0;
        //    invoice.Tax = (winningBid.User.AddressCard_Billing.State.Equals("NY") && String.IsNullOrEmpty(winningBid.User.TaxpayerID)) ? invoice.Amount * SalesTaxRate : 0;
        //    invoice.User_ID = winningBid.User_ID;
        //    invoices.Add(invoice);
        //  }
        //  dataContext.Invoices.InsertAllOnSubmit(invoices);
        //  SubmitChanges();
        //}



        //AddEditPayment
        public bool AddEditPayment(long Payment_Id, byte Method, decimal Amount, DateTime Date, string Note, bool IsCleared, string CDetails, long ID, bool IsAdding, bool IsInvoice)
        {
            Payment payment = (IsAdding) ? new Payment() : dataContext.Payments.SingleOrDefault(P => P.ID == Payment_Id);

            if (payment == null || ID < 1)
            {
                return(false);
            }
            PaymentType pt = dataContext.PaymentTypes.SingleOrDefault(PT => PT.ID == Method);

            payment.PaymentType    = pt;
            payment.Amount         = Amount;
            payment.PaidDate       = Date;
            payment.Notes          = Note;
            payment.IsCleared      = IsCleared;
            payment.ClearedDetails = CDetails;
            if (IsInvoice)
            {
                payment.UserInvoices_ID = ID;
                UserInvoice ui = dataContext.UserInvoices.SingleOrDefault(UI => UI.ID == ID);
                payment.User_ID = (ui != null) ? ui.User_ID : 0;
            }
            else
            {
                payment.Consignments_ID = ID;
                Consignment ui = dataContext.Consignments.SingleOrDefault(UI => UI.ID == ID);
                payment.User_ID = (ui != null) ? ui.User_ID : 0;
            }
            payment.PostDate = DateTime.Now;
            if (IsAdding)
            {
                dataContext.Payments.InsertOnSubmit(payment);
            }
            return(SubmitChanges());
        }
Example #19
0
        public virtual int _GetUniqueIdentifier()
        {
            var hashCode = 399326290;

            hashCode = hashCode * -1521134295 + (WayPointVisibilityID?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Waypoint?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (From?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (To?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (ConveyanceId?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (ConveyanceRef?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (ShippingAgent?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (TotalConsignments?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (DirectConsignments?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (TransshipmentConsignments?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (TotalCargos?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (FullCargos?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (EmptyCargos?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (TotalRiskDetected?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Consignment?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (CargoId?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (RiskType?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (RiskScore?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Severity?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Details?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Suggestions?.GetHashCode() ?? 0);
            return(hashCode);
        }
        private Action CreateAction(RTTTripDetails details, Consignment consignment, RttSiteDefault site)
        {
            var action = new Action
            {
                Id = utils.CreateActionId(consignment, site),
                InternalReference = consignment.ConsignmentID.ToString(),
                Reference         = consignment.ConsignmentNo?.Trim(),
                CreatedOn         = details.TripDate.GetValueOrDefault(),
                ExpectedDelivery  = details.TripDate,
                ClientId          = site.Id,
                CustomerReference = consignment.Account.Acc_Id.ToString(),
                CustomerCode      = consignment.Account.AccountNo?.Trim(),
                IsCod             = false,
                AmountIncl        = 0,
                Nature            = EActionNature.Product,
                Weight            = consignment.Parcels.Sum(p => p.ActualKG),
                Pieces            = consignment.Parcels.Count,
                Volume            = consignment.Parcels.Sum(p => p.Length * p.Height * p.Width),
                VolumetricMass    = consignment.Parcels.Sum(p => p.VolumizerKG),
                HandlingUnitIds   = consignment.Parcels.Select(p => $"{site.Id}/unit/{p.ParcelID?.Trim()}").ToList(),
            };

            if (consignment.Parcels.Count == 0)
            {
                action.ActionTypeId   = site.RttActionTypeCollection;
                action.ActionTypeName = "Collection";
            }
            else
            {
                action.ActionTypeId   = site.RttActionTypeDelivery;
                action.ActionTypeName = "Delivery";
            }

            return(action);
        }
Example #21
0
        public IHttpActionResult PostConsignment([FromUri] ConsignmentDTO consignmentDtoModel)
        {
            var meattypeslist     = db.MeatKinds.ToList();
            var consignmentobject = new Consignment();
            var vendorslist       = db.Vendors.ToList();

            consignmentobject.VendorId     = consignmentDtoModel.VendorId;
            consignmentobject.MeatType     = db.MeatKinds.Single(c => c.Id == consignmentDtoModel.MeatKinds.Id).MeatName;
            consignmentobject.Quantity     = consignmentDtoModel.Quantity;
            consignmentobject.BillAmount   = consignmentDtoModel.BillAmount;
            consignmentobject.SuppliedDate = DateTime.Now;

            db.Consignments.Add(consignmentobject);
            db.SaveChanges();

            //List<Inventory> inventorylist = new List<Inventory>();

            var df = db.Inventories.Single(c => c.MeatKindId == consignmentDtoModel.MeatKinds.Id);


            df.QuantityInStock = df.QuantityInStock + consignmentDtoModel.Quantity;



            var suppliesviewmodelobject = new ConsignmentDTO()
            {
                ConsignmentList = db.Consignments.ToList(),
                MeatKindList    = db.MeatKinds.ToList(),
                VendorList      = vendorslist,
            };

            return(Ok(suppliesviewmodelobject));
        }
Example #22
0
        public Consignment SaveConsignment(Consignment consignment)
        {
            //Validate the object before trying to save.
            //I added a custom attribute for validating phone numbers. I only did it for phone numbers - but in reality all of the properties that needed validation would have it.
            if (!_consignmentValidator.IsValid(consignment))
            {
                return(consignment);
            }

            try
            {
                //Generic retry pattern to accomodate for failed attempts & retrying.
                //Both the delay between attempts & the amount of times to retry are stored in the appsettings.json config files
                var isSuccess = Retry.Execute(() => WriteConsignment(consignment), new TimeSpan(0, 0, _retryDelay), _retryCount, true);

                if (isSuccess)
                {
                    return(consignment);
                }

                //If after retry logic the saving of the consignment was still unsuccessful then throw an error to be caught and handled appropriately.
                throw new Exception($"Failed to save consignment after {_retryCount} attempts");
            }
            catch (Exception e)
            {
                //Log & rethrow error
                Console.WriteLine(e);
                throw;
            }
        }
Example #23
0
        /// <summary>
        /// Single consignment booking.
        /// </summary>
        /// <param name="consignment">Consignment to book.</param>
        /// <returns>Booking confirmation.</returns>
        public async Task <Confirmation> BookAsync(Consignment consignment)
        {
            var consignments = await BookAsync(new[] { consignment }).ConfigureAwait(false);

            var first = consignments.FirstOrDefault();

            return(first ?? Confirmation.CreateError("No confirmation received."));
        }
Example #24
0
 private bool IsLastStopInvalid(Consignment consignment)
 {
     if (consignment.PlannedStopArrivalTime == null)
     {
         return(false);
     }
     return(true);
 }
Example #25
0
 private static void BindItemsToPackages(FlatLevelConsignmentDto result, Consignment consignment)
 {
     //When reading back from the database items must be bound to the appropriate package.
     foreach (var package in consignment.Packages)
     {
         package.Items = result.Items.Where(i => i.PackageId == package.PackageId).ToList();
     }
 }
Example #26
0
        private bool WriteConsignment(Consignment consignment)
        {
            consignment.ConsignmentId = (int)_consignmentsRepository.SaveConsignment(consignment);
            consignment.Packages      = _packagesService.SavePackages(consignment.Packages, consignment.ConsignmentId);

            //If the save method from the repository does not return an Id of the saved object then it wasn't a successful save.
            return(consignment.ConsignmentId != 0);
        }
Example #27
0
        public ActionResult DeleteConfirmed(int id)
        {
            Consignment consignment = db.Consignments.Find(id);

            db.Consignments.Remove(consignment);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #28
0
 public void IncrementConsignment(int productId, Consignment consignment)
 {
     if (consignment != null)
     {
         consignment.NumberOfContent++;
         dataAccess.EditConsignment(productId, consignment);
     }
 }
Example #29
0
 public void Add(Consignment item)
 {
     Deliveries.Add(item);
     if (item is IValuable)
     {
         Valuables.Add((item as IValuable));
     }
 }
Example #30
0
 private static decimal GetVolumetricWeight(Consignment consigment)
 {
     if (consigment.Produk.Length > 0 && consigment.Produk.Width > 0 && consigment.Produk.Height > 0)
     {
         return((consigment.Produk.Length * consigment.Produk.Width * consigment.Produk.Height) / 6000);
     }
     return(0.00m);
 }
 //CheckAndAddConsignment
 public JsonExecuteResult AddConsignment(long user_id, long event_id)
 {
     try
     {
         Consignment cons = dataContext.Consignments.SingleOrDefault(C => C.User_ID == user_id && C.Event_ID == event_id);
         if (cons != null) return new JsonExecuteResult(JsonExecuteResultTypes.ERROR, "The consignor statement already exists.");
         cons = new Consignment();
         dataContext.Consignments.InsertOnSubmit(cons);
         cons.User_ID = user_id;
         cons.Event_ID = event_id;
         cons.ConsDate = DateTime.Now;
         Specialist sp = dataContext.Specialists.SingleOrDefault(S => S.FirstName == "Other" && S.IsActive);
         cons.Specialist_ID = (sp != null) ? sp.ID : dataContext.Specialists.FirstOrDefault(S => sp.IsActive).ID;
         GeneralRepository.SubmitChanges(dataContext);
     }
     catch (Exception ex)
     {
         return new JsonExecuteResult(JsonExecuteResultTypes.ERROR, ex.Message);
     }
     return new JsonExecuteResult(JsonExecuteResultTypes.SUCCESS);
 }
        private static int[] GetMultiplierArray(Consignment consignment)
        {
            int[] result = new int[MoneyMultiplier.Length];
            int multiple = 0;
            if (consignment == Consignment.ES)
                multiple = 1;
            else if (consignment == Consignment.S)
                multiple = 2;
            else if (consignment == Consignment.M)
                multiple = 3;
            else if (consignment == Consignment.L)
                multiple = 4;
            else if (consignment == Consignment.EL)
                multiple = 5;

            for (var i = 0; i < MoneyMultiplier.Length; i++)
            {
                result[i] = MoneyMultiplier[i] * multiple;
            }
            return result;
        }
 public static bool GenerateMoney(Consignment consignment)
 {
     Dictionary<int, List<Money>> moneyDictionary = new Dictionary<int, List<Money>>();
     int value;
     int[] moneyMultiplier = GetMultiplierArray(consignment);
     try
     {
         for (var i = 0; i < moneyMultiplier.Length; i++)
         {
             List<Money> moneyList = new List<Money>();
             value = MoneySequence[i];
             for (var j = 0; j < moneyMultiplier[i]; j++)
             {
                 Money money = new Money(value);
                 moneyList.Add(money);
             }
             moneyDictionary.Add(value, moneyList);
         }
         MoneyBankDBTool mdDBTool = new MoneyBankDBTool();
         mdDBTool.InsertMoney(moneyDictionary);
     }
     catch (Exception) { return false; }
     return true;
 }
        //UpdateConsignorStatement
        public bool UpdateConsignorStatement(ConsignorStatementForm info)
        {
            Consignment cons = (info.ID > 0) ? GetConsignment(info.ID) : null;
            bool newCons = cons == null;
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    if (newCons)
                    {
                        cons = new Consignment();
                        dataContext.Consignments.InsertOnSubmit(cons);
                    }
                    cons.ConsDate = info.ConsDate;
                    cons.Event_ID = info.Event_ID;
                    cons.Specialist_ID = info.Specialist_ID;
                    cons.User_ID = info.User_ID;

                    GeneralRepository.SubmitChanges(dataContext);
                    ts.Complete();
                    info.ID = cons.ID;
                }
            }
            catch (ChangeConflictException cce)
            {
                Logger.LogException(cce);
                throw cce;
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                throw ex;
            }
            return true;
        }
Example #35
0
 private void Button_Click_3(object sender, RoutedEventArgs e)
 {
     Consignment сonsignmentWindow = new Consignment();
     сonsignmentWindow.Owner = this;
     сonsignmentWindow.Show();
 }