/// <summary> /// save new bill of lading /// </summary> /// <param name="newBillOfLading"></param> /// <returns></returns> public OperationResult SaveBillOfLading(BillOfLading newBillOfLading) { var operationResult = new OperationResult(); try { var existingBillOfLading = _db.BillOfLading.FirstOrDefault(x => x.Number.ToLower() == newBillOfLading.Number.ToLower()); if (existingBillOfLading == null) { logger.Debug("Bill of Lading is being created..."); _db.BillOfLading.Add(newBillOfLading); _db.SaveChanges(); operationResult.Success = true; operationResult.Message = "Success"; } else { operationResult.Success = false; operationResult.Message = "Duplicate Entry"; } } catch (Exception ex) { operationResult.Success = false; operationResult.Message = "Error"; logger.ErrorFormat("Error saving new bill of lading: {0} ", ex.ToString()); } return(operationResult); }
public frmShipItem(Item objItem) { InitializeComponent(); mobjItem = objItem; mobjBOL = new BillOfLading(); }
public frmBOL(Order objOrder, BillOfLading objBOL) { InitializeComponent(); mobjOrder = objOrder; mobjBOL = objBOL; }
public frmConfirmRecieveitem(Item objItem, BillOfLading objBOL) { InitializeComponent(); mobjItem = objItem; mobjBOL = objBOL; }
private void RemoveOrderValues() { mobjBOL = null; lblOrder.Text = string.Empty; lblCustomer.Text = string.Empty; }
public ActionResult CopyBill(string code) { using (var context = new WebsiteDBEntities()) { var bill = context.BillOfLadings.SingleOrDefault(i => i.BillCode == code); if (bill == null) { HttpContext.Session[SiteConfig.TransferMessageSession] = ""; return(RedirectToAction("Bills")); } ViewBag.Customer = new SelectList(context.Customers.ToList(), "Id", "CustomerName", bill.Customer); var newBill = new BillOfLading { BillCode = "00000000", Sender = bill.Sender, SenderAddress = bill.SenderAddress, SenderContactName = bill.SenderContactName, SenderTel = bill.SenderTel, SentDate = DateTime.Today, LadingStatus = SiteConfig.ProcessStatus, Customer = bill.Customer, IsReadOnly = false }; return(View("AddBill", newBill)); } }
public ActionResult EditBill(BillOfLading bill, string sentDate, string receivedDate, string retransferTime1, string retransferTime2) { try { using (var context = new WebsiteDBEntities()) { ViewBag.Customer = new SelectList(context.Customers.ToList(), "Id", "CustomerName", bill.Customer); var curentBill = context.BillOfLadings.SingleOrDefault(i => i.BillCode == bill.BillCode.ToUpper()); if (curentBill == null) { ViewBag.SaveMessage = "Error: Không tìm thấy thông tin vận đơn yêu cầu."; } ConvertBillDateTime(bill, sentDate, receivedDate, retransferTime1, retransferTime2); CheckBillStatus(bill, curentBill.LadingStatus); if (curentBill.Customer != bill.Customer) { GetSenderInfoByCustomer(bill); } ObjectHelper.Copy(bill, curentBill); context.Entry(curentBill).State = EntityState.Modified; context.SaveChanges(); ViewBag.SaveMessage = "Vận đơn lưu thành công."; } } catch (Exception ex) { ViewBag.SaveMessage = "Error: " + ex.Message; } return(View(bill)); }
public frmPrintLabel(Item objItem, BillOfLading objBOL) { int intTemp = 0; InitializeComponent(); bw = new BackgroundWorker(); bw.WorkerReportsProgress = true; bw.WorkerSupportsCancellation = true; bw.DoWork += new DoWorkEventHandler(bw_DoWork); //bw.ProgressChanged += new ProgressChangedEventHandler(bw_ProgressChanged); bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted); mobjItem = objItem; mobjBOL = objBOL; if (int.TryParse(mobjItem.SelectedOrder.CustomerNumber, out intTemp)) { mintCustomerNumber = intTemp; } else if (int.TryParse(mobjItem.SelectedJob.CustomerNumber, out intTemp)) { mintCustomerNumber = intTemp; } mstrCustomerName = mobjItem.SelectedJob.CustomerName; mobjSelectedLabel = new WTFClassLibrary.Label(); grpMultiple.Enabled = false; chkMultiple.Checked = false; }
/// <summary> /// ErrorCode = 10060 , 10061 /// </summary> /// <param name="nationalId"></param> /// <returns></returns> public static JsonResultWithObject <BillOfLading> GetBillOfLading(string nationalId) { JsonResultWithObject <BillOfLading> result = new JsonResultWithObject <BillOfLading>(); BillOfLadingInformationClient client = (BillOfLadingInformationClient)InitialClient(new BillOfLadingInformationClient()); try { BillOfLading bol = client.getBOLByDriverNationalId(nationalId); result.result = bol; result.isSuccess = true; return(result); } catch (EndpointNotFoundException ex) { Log.Error("10060 Service can not connect Bita."); Log.Error(ex); result.messages = new object[] { "10060 در هنگام دریافت بارنامه از سامانه همکار خطا رخ داده است." }; } catch (Exception ex) { Log.Error("10061 BillOfLading Exception."); Log.Error(ex); result.messages = new object[] { "10061 خطا نامشخص در فرآیند دریافت بارنامه از مرکز." }; } result.isSuccess = false; return(result); }
public BillOfLading UpdateObject(BillOfLading billoflading) { if (!isValid(_validator.VUpdateObject(billoflading, this))) { billoflading = _repository.UpdateObject(billoflading); } return(billoflading); }
public BillOfLading CreateObject(BillOfLading billoflading) { billoflading.Errors = new Dictionary <String, String>(); if (!isValid(_validator.VCreateObject(billoflading, this))) { billoflading = _repository.CreateObject(billoflading); } return(billoflading); }
public frmPackingSlip(Order objOrder, BillOfLading objBOL = null, string strJobNumber = "") { InitializeComponent(); /*sets the notes cell on the datagridview to multiline. Subsequently this is what also allows my custom control's (CustomDataGridView) overridden method to insert a newline when the enter key is pressed*/ txtNotes.DefaultCellStyle.WrapMode = DataGridViewTriState.True; mobjOrder = objOrder; mobjBOL = objBOL; mstrJobNumber = strJobNumber;//added per tonyj 10-10-12;if printing from order then this field will be empty. }
private void btnBOL_Click(object sender, EventArgs e) { frmBOL objBOLForm; BillOfLading objBOL; objBOL = new BillOfLading(); objBOLForm = new frmBOL(mobjOrder, objBOL); objBOLForm.ShowDialog(); }
private void SetOrderValues() { mobjBOL = null; lblOrder.Text = mobjItem.SelectedOrder.CustomerOrderNumber; lblCustomer.Text = mobjItem.SelectedOrder.CustomerNumber.Trim(); if (mobjItem.SelectedOrder.CustomerName.Length > 0) { lblCustomer.Text = lblCustomer.Text + " - " + mobjItem.SelectedOrder.CustomerName.Trim(); } }
/// <summary> /// convert bol to list model /// </summary> /// <param name="bol"></param> /// <returns></returns> public BillOfLadingViewModel ConvertToListView(BillOfLading bol) { BillOfLadingViewModel model = new BillOfLadingViewModel(); var _shipmentRepository = new ShipmentRepository(); var _foundryDynamicsRepository = new FoundryDynamicsRepository(); var _vesselRepository = new VesselRepository(); var _portRepository = new PortRepository(); var shipment = _shipmentRepository.GetShipment(bol.ShipmentId); var dynamicsFoundry = _foundryDynamicsRepository.GetFoundry(bol.FoundryId); var vessel = _vesselRepository.GetVessel((shipment != null) ? shipment.VesselId : Guid.Empty); var port = _portRepository.GetPort((shipment != null) ? shipment.PortId : Guid.Empty); model.BillOfLadingId = bol.BillOfLadingId; model.ShipmentId = bol.ShipmentId; model.BolNumber = (!string.IsNullOrEmpty(bol.Number)) ? bol.Number : "N/A"; model.FoundryName = (dynamicsFoundry != null) ? dynamicsFoundry.VENDSHNM : "N/A"; model.Description = (!string.IsNullOrEmpty(bol.Description)) ? bol.Description : "N/A"; model.VesselName = (vessel != null && !string.IsNullOrEmpty(vessel.Name)) ? vessel.Name : "N/A"; model.PortName = (port != null && !string.IsNullOrEmpty(port.Name)) ? port.Name : "N/A"; model.DepartureDate = (shipment != null && shipment.DepartureDate != null) ? shipment.DepartureDate : DateTime.MinValue; model.DepartureDateStr = (shipment != null) ? shipment.DepartureDate.ToShortDateString() : "N/A"; model.EstArrivalDate = (shipment != null && shipment.EstArrivalDate != null) ? shipment.EstArrivalDate : DateTime.MinValue; model.EstArrivalDateStr = (shipment != null) ? shipment.EstArrivalDate.Value.ToShortDateString() : "N/A"; model.HasBeenAnalyzed = bol.HasBeenAnalyzed; model.CreatedDate = bol.CreatedDate; if (_shipmentRepository != null) { _shipmentRepository.Dispose(); _shipmentRepository = null; } if (_foundryDynamicsRepository != null) { _foundryDynamicsRepository.Dispose(); _foundryDynamicsRepository = null; } if (_vesselRepository != null) { _vesselRepository.Dispose(); _vesselRepository = null; } if (_portRepository != null) { _portRepository.Dispose(); _portRepository = null; } return(model); }
public BillOfLading VObject(BillOfLading billoflading, IBillOfLadingService _billofladingService) { BillOfLading oldbilloflading = _billofladingService.GetObjectById(billoflading.Id); if (oldbilloflading == null) { billoflading.Errors.Add("Generic", "Invalid Data For Update"); } else if (!VOffice(billoflading.OfficeId, oldbilloflading.OfficeId)) { billoflading.Errors.Add("Generic", "Invalid Data For Update"); } return(billoflading); }
public BillOfLading VBillOfLading(BillOfLading billoflading, IBillOfLadingService _billofladingservice) { BillOfLading countrylocation = _billofladingservice.GetObjectById(billoflading.Id); if (countrylocation == null) { billoflading.Errors.Add("Country", "Tidak boleh kosong"); } else if (!VOffice(billoflading.OfficeId, countrylocation.OfficeId)) { billoflading.Errors.Add("Country", "Invalid Country"); } return(billoflading); }
public BillOfLading CreateUpdateObject(BillOfLading billoflading) { BillOfLading newbilloflading = this.GetObjectByShipmentOrderId(billoflading.ShipmentOrderId); if (newbilloflading == null) { billoflading = this.CreateObject(billoflading); } else { billoflading = this.UpdateObject(billoflading); } return(billoflading); }
public Transport() { Driver = new Driver(); Delivery = new Delivery(); Loading = new Loading(); Truck = new Truck(); Container = new Container(); Railcar = new Railcar(); Ard = new Ard(); Arrival = new Arrival(); BillOfLading = new BillOfLading(); Carrier = new Carrier(); Weighbridge = new Weighbridge(); Seal = new Seal(); }
/// <summary> /// get bill of lading by number /// </summary> /// <param name="bolNumber"></param> /// <returns></returns> public BillOfLading GetBillOfLading(string bolNumber) { var billOfLading = new BillOfLading(); try { billOfLading = _db.BillOfLading.FirstOrDefault(x => x.Number.Replace(" ", string.Empty).ToLower() == bolNumber.Replace(" ", string.Empty).ToLower()); } catch (Exception ex) { logger.ErrorFormat("Error getting bill of lading: {0} ", ex.ToString()); } return(billOfLading); }
/// <summary> /// get bill of lading by id /// </summary> /// <param name="billOfLadingId"></param> /// <returns></returns> public BillOfLading GetBillOfLading(Guid billOfLadingId) { var billOfLading = new BillOfLading(); try { billOfLading = _db.BillOfLading.FirstOrDefault(x => x.BillOfLadingId == billOfLadingId); } catch (Exception ex) { logger.ErrorFormat("Error getting bill of lading: {0} ", ex.ToString()); } return(billOfLading); }
public void RegisterBillOfLading(RegisterBillOfLadingCommand command) { _debug.Debug("[purchases] Handling registration of new Bill of lading"); var bol = new BillOfLading(command.Id, command.Number, command.IssueDate, DateTime.Today); bol.SetSupplier(command.SupplierCompanyName, command.SupplierAddress); foreach (var row in command.Rows) { bol.AddDetail(row.ItemId, row.Sku, row.Description, row.Quantity); } bol.Confirm(); _repository.Save(bol, command.Id); _debug.Debug("[purchases] Bill of lading confirmed"); }
public ActionResult AddBill(BillOfLading bill, string sentDate, string receivedDate, string retransferTime1, string retransferTime2, string btnContinue) { try { ConvertBillDateTime(bill, sentDate, receivedDate, retransferTime1, retransferTime2); CheckBillStatus(bill, string.Empty); using (var context = new WebsiteDBEntities()) { ViewBag.Customer = new SelectList(context.Customers.ToList(), "Id", "CustomerName", bill.Customer); bill.BillCode = bill.BillCode.ToUpper(); if (bill.Customer.HasValue) { GetSenderInfoByCustomer(bill); } context.BillOfLadings.Add(bill); context.SaveChanges(); if (btnContinue == null) { HttpContext.Session[SiteConfig.TransferMessageSession] = string.Format("Vận đơn mã {0} tạo thành công", bill.BillCode); return(RedirectToAction("Bills")); } var newBill = new BillOfLading { BillCode = "00000000", Sender = bill.Sender, SenderAddress = bill.SenderAddress, SenderContactName = bill.SenderContactName, SenderTel = bill.SenderTel, SentDate = DateTime.Today, LadingStatus = SiteConfig.ProcessStatus, Customer = bill.Customer, IsReadOnly = false }; ViewBag.SaveMessage = string.Format("Vận đơn mã {0} tạo thành công", bill.BillCode); return(View("AddBill", newBill)); } } catch (Exception ex) { ViewBag.SaveMessage = "Error: " + ex.Message; return(View(bill)); } }
private void ConvertBillDateTime(BillOfLading bill, string sentDate, string receivedDate, string retransfer1, string retransfer2) { bill.SentDate = DateTimeHelper.ConvertDatetimeStringToDateTime(sentDate, DateTimeHelper.dateFormat.ddMMyyyy, '-'); if (!string.IsNullOrWhiteSpace(receivedDate)) { bill.ReceivedDate = DateTimeHelper.ConvertDatetimeStringToDateTime(receivedDate, DateTimeHelper.dateFormat.ddMMMyyyyHHmm, '-'); } if (!string.IsNullOrWhiteSpace(retransfer1)) { bill.RetransferTime1 = DateTimeHelper.ConvertDatetimeStringToDateTime(retransfer1, DateTimeHelper.dateFormat.ddMMyyyy, '-'); } if (!string.IsNullOrWhiteSpace(retransfer2)) { bill.RetransferTime2 = DateTimeHelper.ConvertDatetimeStringToDateTime(retransfer2, DateTimeHelper.dateFormat.ddMMyyyy, '-'); } }
private void SetJobValues() { mobjBOL = null; txtJob.Text = mobjItem.SelectedJob.JobNumber; lblDueDate.Text = mobjItem.SelectedJob.DueDate.ToString("MM/dd/yy"); lblQtyReleased.Text = mobjItem.SelectedJob.QtyReleased.ToString("#,##0.##"); //txtJob.Text = mobjItem.SelectedJob.JobNumber; //lblOrder.Text = mobjItem.SelectedJob.SelectedOrder.CustomerOrderNumber; //lblCustomer.Text = mobjItem.SelectedJob.SelectedOrder.CustomerNumber.Trim(); //if (mobjItem.SelectedJob.SelectedOrder.CustomerName.Length > 0) // lblCustomer.Text = lblCustomer.Text + " - " + mobjItem.SelectedJob.SelectedOrder.CustomerName.Trim(); //lblDueDate.Text = mobjItem.SelectedJob.DueDate.ToString("MM/dd/yy"); //lblQtyReleased.Text = mobjItem.SelectedJob.QtyReleased.ToString("#,##0.##"); }
/// <summary> /// convert Bol view model to domain /// </summary> /// <param name="model"></param> /// <returns></returns> public BillOfLading ConvertToDomain(BillOfLadingViewModel model) { BillOfLading bol = new BillOfLading(); bol.BillOfLadingId = model.BillOfLadingId; bol.ShipmentId = model.ShipmentId; bol.Number = model.BolNumber; bol.BolDate = model.BolDate; bol.FoundryId = model.FoundryId; bol.Description = model.Description; bol.HasLcl = model.HasLcl; bol.HasDoorMove = model.HasDoorMove; bol.HasArrivalNotice = model.HasArrivalNotice; bol.HasOriginalDocuments = model.HasOriginalDocuments; bol.PalletCount = model.PalletCount; bol.GrossWeight = model.GrossWeight; bol.NetWeight = model.NetWeight; bol.Notes = model.BolNotes; bol.WireInstructions = model.WireInstructions; bol.CustomsNumber = model.CustomsNumber; bol.IsCustomsLiquidated = model.IsCustomsLiquidated; bol.HasBeenAnalyzed = model.HasBeenAnalyzed; var containers = new List <Container>(); if (model.Containers != null && model.Containers.Count > 0) { foreach (var container in model.Containers) { Container convertedModel = new ContainerConverter().ConvertToDomain(container); containers.Add(convertedModel); } bol.Containers = containers; } FoundryInvoice foundryInvoice = new FoundryInvoiceConverter().ConvertToDomain(model.FoundryInvoice); bol.FoundryInvoice = foundryInvoice; return(bol); }
private void GetSenderInfoByCustomer(BillOfLading bill) { using (var context = new WebsiteDBEntities()) { if (bill.Customer.HasValue) { try { var customer = context.Customers.SingleOrDefault(i => i.Id == bill.Customer); bill.Sender = customer.ContactPerson; bill.SenderAddress = customer.CustomerAddress; bill.SenderContactName = customer.ContactPerson; bill.SenderTel = customer.ContactNumber; } catch (Exception e) { throw new Exception("Không tìm thấy thông tin khách hàng."); } } } }
private void PopulateBOL(bool blnUpdateAverageUnitWeightHistory = false) { Single sngPieceWeight; int intQuantity; if (mobjBOL == null) { mobjBOL = new BillOfLading(); } sngPieceWeight = Single.Parse(txtPieceWgt.Text); intQuantity = int.Parse(txtQuantity.Text); mobjBOL.AveragePieceWeight = sngPieceWeight; mobjBOL.GrossWeight = double.Parse(txtGrossWgt.Text); mobjBOL.TareWeight = double.Parse(txtTareWgt.Text); mobjBOL.Quantity = intQuantity; if (blnUpdateAverageUnitWeightHistory) { mobjItem.UpdateAvgUnitWeightHistory(sngPieceWeight, intQuantity); } }
private void SetDefaults() { mobjItem = null; mobjBOL = null; lblItemDescription.Text = ""; mobjItem = null; txtItemNumber.SelectAll(); chkIsSubItem.Checked = false; txtQtyOnHand.Text = string.Empty; txtTareWgt.Text = "0.0"; // string.Empty; txtGrossWgt.Text = "0.0"; // string.Empty; txtPieceWgt.Text = "0.0"; // string.Empty; txtQuantity.Text = "0"; // string.Empty; btnGetJobs.Enabled = false; txtJob.Text = "<none selected>"; lblOrder.Text = string.Empty; lblCustomer.Text = string.Empty; lblDueDate.Text = string.Empty; lblQtyReleased.Text = string.Empty; }
public bool isValid(BillOfLading obj) { bool isValid = !obj.Errors.Any(); return(isValid); }