private async void Approve_Click(object sender, RoutedEventArgs e) { prg1.Visibility = Visibility.Visible; ((Button)sender).IsEnabled = false; var data = ((Button)sender).DataContext as ShipmentDetails; ShipmentDetailForPayment shipmentDetailrequest = new ShipmentDetailForPayment() { ContainerId = data.Id, ContainerName = data.ContainerName, Quantity = Convert.ToInt32(data.Unit), SupplierName = App.UserName }; await APICall.AddShipmentDetail(shipmentDetailrequest.ContainerId, shipmentDetailrequest); ShipmentDetails shipmentRequest = new ShipmentDetails() { Id = data.Id, ContainerName = data.ContainerName, Weight = Convert.ToInt32(data.Weight), _status = 0, Desc = string.Format("Container {0} is Approved by {1}", data.ContainerName, App.UserName), Source = data.Source, Destination = data.Destination }; await APICall.AddShipmentStatus(shipmentRequest.Id, shipmentRequest); prg.Visibility = Visibility.Collapsed; prg1.Visibility = Visibility.Collapsed; }
public void FromEmail() { string emailBody = File.ReadAllText("ShipmentNotices\\Shipment Notice-Ricardo Adocicados.txt"); MailMessage email = new MailMessage { Subject = "Order Shipped", Body = emailBody }; ShipmentNotice notice = ShipmentNotice.FromEmail(email); Assert.AreEqual(11059, notice.OrderNumber); Assert.AreEqual("Ricardo Adocicados", notice.CustomerName); Assert.AreEqual("*****@*****.**", notice.EmailTo); Assert.AreEqual(107.53M, notice.Tax); Assert.AreEqual(86.00M, notice.Shipping); Assert.AreEqual(1985.75M, notice.OrderTotal); Assert.IsTrue(notice.CustomerComments.StartsWith(" Thank you for your business")); Assert.AreEqual(3, notice.AddressLines.Count); Assert.AreEqual("Av. Copacabana, 267", notice.AddressLines.First()); Assert.AreEqual(3, notice.OrderDetails.Count); ShipmentDetails detail = notice.OrderDetails.Last(); Assert.AreEqual("Camembert Pierrot", detail.Description); Assert.AreEqual(35, detail.Quantity); Assert.AreEqual(34M, detail.UnitPrice); Assert.AreEqual(1154.30M, detail.Total); }
public ActionResult DeleteConfirmed(int id) { ShipmentDetails shipmentdetails = db.ShipmentDetails.Find(id); db.ShipmentDetails.Remove(shipmentdetails); db.SaveChanges(); return(RedirectToAction("Index")); }
// // GET: /ShipmentDetailsAdmin/Details/5 public ActionResult Details(int id = 0) { ShipmentDetails shipmentdetails = db.ShipmentDetails.Find(id); if (shipmentdetails == null) { return(HttpNotFound()); } return(View(shipmentdetails)); }
public ActionResult Edit(ShipmentDetails shipmentdetails) { if (ModelState.IsValid) { db.Entry(shipmentdetails).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(shipmentdetails)); }
public ActionResult Create(ShipmentDetails shipmentdetails) { if (ModelState.IsValid) { db.ShipmentDetails.Add(shipmentdetails); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(shipmentdetails)); }
public CityEntity(City City, params object[] args) : base(City) { foreach (object arg in args) { if (arg is Country Country) { CountryEntity = new CountryEntity(Country); } if (arg is ICollection <ShipmentDetail> ShipmentDetails) { ShipmentDetailEntities = ShipmentDetails.Select(model => new ShipmentDetailEntity(model, model.Country, model.Customer)).ToList(); } } }
private async void UpdateShipmentStatus(string desc, int status) { ShipmentDetails shipmentRequest = new ShipmentDetails() { Id = Container.Id, ContainerName = Container.ContainerName, Weight = Convert.ToInt32(Container.Weight), _status = status, Desc = desc, Source = Container.Source, Destination = Container.Destination }; await APICall.AddShipmentStatus(shipmentRequest.Id, shipmentRequest); prg.Visibility = Visibility.Collapsed; }
public CountryEntity(Country Country, params object[] args) : base(Country) { foreach (object arg in args) { if (arg is ICollection <City> Cities) { CityEntities = Cities.Select(model => new CityEntity(model)).ToList(); } if (arg is ICollection <ShipmentDetail> ShipmentDetails) { ShipmentDetailEntities = ShipmentDetails.Select(model => new ShipmentDetailEntity(model, model.City, model.Customer)).ToList(); } if (arg is ICollection <Tax> Taxes) { TaxEntities = Taxes.Select(model => new TaxEntity(model, model.Category)).ToList(); } } }
private async Task <bool> SendForApprovals(int docstatus, int containerstatus) { string desc = string.Empty; if (docstatus == 1) { desc = String.Format("Document {0} is Approved by {1}", selectedItem.Document, txtUserName.Text); } else { desc = String.Format("Document {0} is Rejected by {1}", selectedItem.Document, txtUserName.Text); } ApprovalsDetails approvalRequest = new ApprovalsDetails() { DocId = selectedItem.DocId, Document = selectedItem.Document, Id = selectedItem.Id, Url = selectedItem.Url, _status = docstatus, TransactionTime = DateTime.Now.ToString() }; await APICall.UpdateApprovalStatus(approvalRequest.Id, approvalRequest); ShipmentDetails shipmentRequest = new ShipmentDetails() { Id = Container.Id, ContainerName = Container.ContainerName, Weight = Convert.ToInt32(Container.Weight), _status = containerstatus, Desc = desc, Source = Container.Source, Destination = Container.Destination }; await APICall.AddShipmentStatus(shipmentRequest.Id, shipmentRequest); prg.Visibility = Visibility.Collapsed; btnSave.IsEnabled = true; btnClose.IsEnabled = true; return(true); }
private async void VerifyWeight() { try { prg.Visibility = Visibility.Visible; ShipmentDetails shipmentRequest = new ShipmentDetails() { Id = Container.Id, ContainerName = Container.ContainerName, Weight = Convert.ToInt32(txtWeight.Text), Source = Container.Source, Destination = Container.Destination }; await APICall.VerifyWeight(shipmentRequest.Id, shipmentRequest); prg.Visibility = Visibility.Collapsed; } catch { } }
public CustomerEntity(Customer Customer, params object[] args) : base(Customer) { foreach (object arg in args) { if (arg is CustomerGroup CustomerGroup) { CustomerGroupEntity = new CustomerGroupEntity(CustomerGroup); } if (arg is ICollection <IssueNote> IssueNotes) { IssueNoteEntities = IssueNotes.Select(model => new IssueNoteEntity(model, model.Invoice, model.WareHouse)).ToList(); } if (arg is ICollection <Order> Orders) { OrderEntities = Orders.Select(model => new OrderEntity(model, model.ShipmentDetail)).ToList(); } if (arg is ICollection <ShipmentDetail> ShipmentDetails) { ShipmentDetailEntities = ShipmentDetails.Select(model => new ShipmentDetailEntity(model, model.City, model.Country)).ToList(); } } }
public static async Task <bool> AddShipmentStatus(string containerId, ShipmentDetails request) { bool result = false; var jsonstring = JsonConvert.SerializeObject(request); string url = String.Format(API + "{0}/shipmentStatus", containerId); System.Net.HttpWebRequest requestForJason = (HttpWebRequest)WebRequest.Create(url); requestForJason.Method = "POST"; //make an HTTP POST // var jsonstring = WebUtility.UrlEncode(JsonConvert.SerializeObject(vehiclebookingdata));// "{\"CarId\":\"\",\"DriverId\":null,\"EmployeeId\":null,\"EmployeeContactNumber\":null,\"EmployeeAddress\":\"Kothrud\",\"EmployeeName\":\"Kunal Kalbande\",\"Status\":\"cancelled\",\"BookingTime\":\"0001-01-01 00:00:00.000 +00:00\",\"Latitude\":18.4994,\"Longitude\":73.8279,\"DriverIds\":[\"adas\",\"asd\"],\"CarType\":\"mini\"}"; requestForJason.ContentType = "application/json"; // requestForJason.Accept = "application/json"; Encoding encoding = new UTF8Encoding(); byte[] data = encoding.GetBytes(jsonstring); using (var stream = await requestForJason.GetRequestStreamAsync()) { // var streamwriter = new StreamWriter(stream); //streamwriter.Write(postdata); // streamwriter.Flush(); stream.Write(data, 0, data.Length); stream.Dispose(); } string resultResponce = ""; HttpWebResponse responseLocationMapping = await requestForJason.GetResponseAsync() as HttpWebResponse; if (responseLocationMapping != null) { result = true; //string Charset = response.; string Charset = "utf-8"; encoding = Encoding.GetEncoding(Charset); var streamReaderResult = new StreamReader(responseLocationMapping.GetResponseStream(), encoding); resultResponce = streamReaderResult.ReadToEnd(); streamReaderResult.Dispose(); } return(result); }
private async Task <bool> InitateShipment() { string url1 = "http://idtp376/Pdf/GST_B2B_INVOICE_CASES-CF.pdf"; string url2 = "http://idtp376/Pdf/Ethereum%20Multi-Member%20Consortium%20Network.pdf"; string url3 = "http://idtp376/Pdf/ASF-VGM-Declaration-Form.pdf"; string url4 = "http://idtp376/Pdf/Ethereum%20Consortium%20Blockchain%20in%20Azure%20Marketplace.pdf"; ShipmentDetailForPayment shipmentDetailrequest = new ShipmentDetailForPayment() { ContainerId = detail.txtContainerId.Text, ContainerName = detail.txtContainerName.Text, Quantity = Convert.ToInt32(detail.txtQuantity.Text), SupplierName = string.Empty }; await APICall.AddShipmentDetail(shipmentDetailrequest.ContainerId, shipmentDetailrequest); ShipmentDetails shipmentRequest = new ShipmentDetails() { Id = detail.txtContainerId.Text, ContainerName = detail.txtContainerName.Text, Weight = Convert.ToInt32(detail.txtContainerWeight.Text), _status = 9, Desc = string.Format("Container {0} is initiated successfully at {1} from {2} to {3}", detail.txtContainerName.Text, DateTime.Now.ToString(), detail.txtSource.Text, detail.txtDestination.Text), Source = detail.txtSource.Text, Destination = detail.txtDestination.Text }; await APICall.AddShipmentStatus(shipmentRequest.Id, shipmentRequest); ApprovalsDetails approvalRequest = new ApprovalsDetails() { DocId = 1, Document = "Excise Form", Id = detail.txtContainerId.Text, Url = url1, _status = 0, TransactionTime = DateTime.Now.ToString() }; await APICall.UpdateApprovalStatus(approvalRequest.Id, approvalRequest); shipmentRequest.Desc = string.Format("Excise Form for Container {0} is uploaded successfully at {1}", detail.txtContainerName.Text, DateTime.Now.ToString()); await APICall.AddShipmentStatus(shipmentRequest.Id, shipmentRequest); approvalRequest = new ApprovalsDetails() { DocId = 2, Document = "Packaging List", Id = detail.txtContainerId.Text, Url = url2, _status = 0, TransactionTime = DateTime.Now.ToString() }; await APICall.UpdateApprovalStatus(approvalRequest.Id, approvalRequest); shipmentRequest.Desc = string.Format("Packaging List for Container {0} is uploaded successfully at {1}", detail.txtContainerName.Text, DateTime.Now.ToString()); await APICall.AddShipmentStatus(shipmentRequest.Id, shipmentRequest); approvalRequest = new ApprovalsDetails() { DocId = 3, Document = "VGM", Id = detail.txtContainerId.Text, Url = url3, _status = 0, TransactionTime = DateTime.Now.ToString() }; await APICall.UpdateApprovalStatus(approvalRequest.Id, approvalRequest); shipmentRequest.Desc = string.Format("VGM for Container {0} is uploaded successfully at {1}", detail.txtContainerName.Text, DateTime.Now.ToString()); await APICall.AddShipmentStatus(shipmentRequest.Id, shipmentRequest); approvalRequest = new ApprovalsDetails() { DocId = 4, Document = "Custom Form", Id = detail.txtContainerId.Text, Url = url4, _status = 0, TransactionTime = DateTime.Now.ToString() }; await APICall.UpdateApprovalStatus(approvalRequest.Id, approvalRequest); shipmentRequest.Desc = string.Format("Custom Form for Container {0} is uploaded successfully at {1}", detail.txtContainerName.Text, DateTime.Now.ToString()); shipmentRequest._status = 11; await APICall.AddShipmentStatus(shipmentRequest.Id, shipmentRequest); return(true); }
//public static ShipmentDetails AddNewShipmentDetail(int invoiceNo) //{ // var detail = new ShipmentDetails(); // detail.ItemNo = "-"; // ent.ShipmentDetails.AddObject(detail); // return detail; //} //public static List<ShipmentDetails> GetShipmentShipmentDetails(int shipmentID) //{ // var shipment = ent.Shipments.FirstOrDefault(i => i.ShipmentID == shipmentID && !i.IsCancelled); // return // shipment.ShipmentDetails // .OrderBy(i => i.ItemNo) // .ThenBy(i => i.BoxNumber) // .ToList(); //} public static void DeleteShipmentDetail(ShipmentDetails detail) { ent.ShipmentDetails.Remove(detail); }
//public static ins_data GetInsDataForInvoice(int invs_num) //{ // return ent.ins_data.FirstOrDefault(i => i.INVS_NUM == invs_num); //} //public static List<InvoiceDetail> GetInvtLogDataForInvoice(int invs_num) //{ // //ignore items with no weight and dimension information // return // (from i in ent.invt_log.Where(i => i.INVS_NUM == invs_num) // join d in ent.inv_detl on i.PROD_CD equals d.PROD_CD // where d.CASE_HI.HasValue && d.CASE_LEN.HasValue && d.CASE_WI.HasValue && d.CASE_WT.HasValue // select new InvoiceDetail { ProductCode = i.PROD_CD, ProductQuantity = i.PROD_QTY, UnitPrice = i.UNIT_PRS } // ).OrderBy(i => i.ProductCode).ToList(); //} //public static inv GetInv(string productCode) //{ // return (from item in ent.invs // where item.PROD_CD == productCode // select item).FirstOrDefault(); //} //public static inv_detl GetInvDetl(string productCode) //{ // return (from item in ent.inv_detl // where item.PROD_CD == productCode // select item).FirstOrDefault(); //} //public static FromAddresses GetFromAddress(int id) //{ // return ent.FromAddresses.FirstOrDefault(i => i.FromAddressID == id); //} //public static List<FromAddresses> GetAllFromAddresses() //{ // return ent.FromAddresses.OrderBy(i => i.FromAddressID).ToList(); //} //public static List<ListItem> GetAllFromAddressesForDdl() //{ // return ent.FromAddresses.OrderBy(i => i.FromAddressID).ToList().Select(i => new ListItem { Value = i.FromAddressID.ToString(), Text = i.CompanyName }).ToList(); //} //public static void AddNewFromAddress(string companyName, string contact, // string address1, string address2, string city, string countryCode, // string postalCode, string stateCode, string telephone) //{ // var address = new FromAddresses(); // address.CompanyName = companyName; // address.Contact = contact; // address.Address1 = address1; // address.Address2 = address2; // address.City = city; // address.CountryCode = countryCode; // address.PostalCode = postalCode; // address.StateCode = stateCode; // address.Telephone = telephone; // ent.FromAddresses.AddObject(address); //} //public static void AddNewFromAddress(FromAddresses newAddress) //{ // ent.FromAddresses.AddObject(newAddress); //} //public static FromAddresses AddNewFromAddress() //{ // var address = new FromAddresses(); // ent.FromAddresses.AddObject(address); // return address; //} //public static void DeleteFromAddress(FromAddresses address) //{ // ent.FromAddresses.DeleteObject(address); //} public static void AddNewShipmentDetail(ShipmentDetails detail) { ent.ShipmentDetails.Add(detail); }
private async Task <bool> TrackApprovals() { try { listDoc.DataContext = vm; listDoc.ItemsSource = vm.Approvalsdetail; var detail = await APICall.TrackApproval(Container.Id); switch (App.UserType) { case UserType.Excise: btnExport.Visibility = Visibility.Collapsed; if (vm.Approvalsdetail.Count() < 2) { vm.Approvalsdetail = new ObservableCollection <ApprovalsDetails>(detail.Where(x => x.DocId == 1 || x.DocId == 2).ToList()); } break; case UserType.VGM: btnExport.Visibility = Visibility.Collapsed; if (vm.Approvalsdetail.Count() == 0) { vm.Approvalsdetail = new ObservableCollection <ApprovalsDetails>(detail.Where(x => x.DocId == 3).ToList()); } break; case UserType.Custom: btnExport.Visibility = Visibility.Visible; if (vm.Approvalsdetail.Count() == 0) { vm.Approvalsdetail = new ObservableCollection <ApprovalsDetails>(detail.Where(x => x.DocId == 4).ToList()); } break; default: btnExport.Visibility = Visibility.Collapsed; if (vm.Approvalsdetail.Count() < 4) { vm.Approvalsdetail = new ObservableCollection <ApprovalsDetails>(detail.ToList()); } break; } //Approvalsdetail.Clear(); foreach (var s in detail) { if (vm.Approvalsdetail.Where(x => x.Document == s.Document).Count() > 0) { vm.Approvalsdetail.Where(x => x.Document == s.Document).First()._status = s._status; } //Approvalsdetail.Add(s.Event); } if (detail.Where(c => c.Status == ApprovalStatus.Approved).Count() == 2 && TrackingDetails.Count == 8 && Container.Status == Status.Initiated && App.UserType == UserType.Excise && !Approved) { Approved = true; Container._status = (int)Status.ExciseApproved; ShipmentDetails shipmentRequest = new ShipmentDetails() { Id = Container.Id, ContainerName = Container.ContainerName, Weight = Convert.ToInt32(Container.Weight), _status = 1, Desc = String.Format("Documents for container {0} are approved successfully by {1}", Container.ContainerName, App.UserName), Source = Container.Source, Destination = Container.Destination }; await APICall.AddShipmentStatus(shipmentRequest.Id, shipmentRequest); } if (detail.Where(c => c.Status == ApprovalStatus.Approved).Count() == 3 && Container.Status == Status.ExciseApproved && App.UserType == UserType.VGM && !weighingApproved) { prg.Visibility = Visibility.Visible; weighingApproved = true; VerifyWeight(); } var doc = (ApprovalsDetails)listDoc.SelectedItem; //if (doc._status == 0 && App.UserType == UserType.Custom) //{ // stkAppprover.Visibility = Visibility.Visible; //} //else //{ // stkAppprover.Visibility = Visibility.Collapsed; //} } catch { } return(true); }