private void cbbMasterBill_SelectedIndexChanged(object sender, EventArgs e) { MasterAirwayBillEntity masterBill = (MasterAirwayBillEntity)cbbMasterBill.SelectedItem; if (masterBill != null) { IEnumerable <BoxInforEntity> listBoxInfo = _boxInforServices.GetByMasterBill(masterBill.Id); if (listBoxInfo != null && listBoxInfo.Any()) { cbbBoxId.DataSource = listBoxInfo; cbbBoxId.ValueMember = "Id"; cbbBoxId.DisplayMember = "BoxId"; } else { cbbBoxId.DataSource = null; cbbBoxId.Items.Clear(); } } else { cbbBoxId.Items.Clear(); } lblMasterBill.Text = cbbMasterBill.Text; }
private int LoadAllMasterBillByDateToComboboxXacNhanDen(string airwaybill) { List <MasterAirwayBillEntity> finalList = new List <MasterAirwayBillEntity>(); //manifestList = _manifestServices.GetManifestByDateString(dtpNgayDen.Value.ToString("yyyy-MM-dd")); manifestList = repositoryShipment.GetManifestByAirwaybill(airwaybill); if (manifestList.Count == 0) { return(0); } else { var masterBillList = manifestList.GroupBy(t => t.MasterAirWayBill).Select(p => p.First()); if (masterBillList != null && masterBillList.Any()) { foreach (ManifestEntity manifest in masterBillList) { MasterAirwayBillEntity entity = new MasterAirwayBillEntity(); entity.MasterAirwayBill = manifest.MasterAirWayBill; finalList.Add(entity); } } return(manifestList.Count); } }
public int CreateMasterAirwayBill(MasterAirwayBillEntity masterAirwayBillEntity) { using (var scope = new TransactionScope()) { Mapper.CreateMap <MasterAirwayBillEntity, MasterBill>(); var masterBillService = Mapper.Map <MasterAirwayBillEntity, MasterBill>(masterAirwayBillEntity); _unitOfWork.MasterBillRepository.Insert(masterBillService); _unitOfWork.SaveWinform(); scope.Complete(); return(masterBillService.Id); } }
private void cbbMasterBillOut_SelectedIndexChanged(object sender, EventArgs e) { if (cbbMasterBillOut.SelectedIndex >= 0) { cbbBoxIdOut.Text = ""; MasterAirwayBillEntity itemMaster = (MasterAirwayBillEntity)cbbMasterBillOut.SelectedItem; lblMasterBillOut.Text = itemMaster.MasterAirwayBill; LoadBoxIdListFromMasterBillId(itemMaster.Id, cbbBoxIdOut); } else { cbbBoxIdOut.DataSource = null; lblMasterBillOut.Text = ""; } }
private void btnXNĐ_Click(object sender, EventArgs e) { try { if (String.IsNullOrWhiteSpace(txtMAWB.Text)) { MessageBox.Show("Bạn cần phải nhập Master airway bill (MAWB) trước", "Nhập thông tin", MessageBoxButtons.OK); txtMAWB.Focus(); return; } if (!CheckIsMawbExistsInManifest(txtMAWB.Text)) { MessageBox.Show(txtMAWB.Text + " không có thông tin manifest.", "Thông báo", MessageBoxButtons.OK); txtMAWB.Focus(); return; } MasterAirwayBillEntity masterBill = _masterBillServices.GetByMasterBillId(txtMAWB.Text); if (masterBill == null) { // DateTime dateconvert = DateTime.ParseExact(manifestList.First().FlightDate, "yyyy-MM-dd", CultureInfo.InvariantCulture); string iString = manifestList.First().FlightDate + " 00:00 AM"; DateTime oDate = DateTime.ParseExact(iString, "yyyy-MM-dd HH:mm tt", null); masterBill = new MasterAirwayBillEntity(); masterBill.MasterAirwayBill = txtMAWB.Text; masterBill.DateArrived = oDate; masterBill.DateCreated = DateTime.Now; masterBill.DateInt = repositoryShipment.DateToInt(DateTime.Now); masterBill.EmployeeId = currentEmployee.Id; currentMasterBillId = _masterBillServices.CreateMasterAirwayBill(masterBill); currentMasterBill = masterBill.MasterAirwayBill; masterBill.Id = currentMasterBillId; } else { currentMasterBillId = masterBill.Id; currentMasterBill = masterBill.MasterAirwayBill; //MessageBox.Show("Mã MAWB: " + masterBill.MasterAirwayBill + " này đã được xác nhận rồi", "Mã MAWB đã được xác nhận", MessageBoxButtons.OK, MessageBoxIcon.Information); //return; } object result = Jacksonsoft.WaitWindow.Show(this.WorkerMethod, "Vui lòng chờ...", txtMAWB.Text); } catch (Exception ex) { } }
private void cbbMasterBillOut_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Tab) { SendKeys.Send("{TAB}"); if (cbbMasterBillOut.SelectedIndex >= 0) { MasterAirwayBillEntity itemMaster = (MasterAirwayBillEntity)cbbMasterBillOut.SelectedItem; lblMasterBillOut.Text = itemMaster.MasterAirwayBill; LoadBoxIdListFromMasterBillId(itemMaster.Id, cbbBoxIdOut); } else { cbbBoxIdOut.DataSource = null; lblMasterBillOut.Text = ""; } } }
private void cbbMasterBill_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Tab) { if (string.IsNullOrEmpty(cbbMasterBill.Text)) { return; } SendKeys.Send("{TAB}"); MasterAirwayBillEntity masterBill = _masterBillServices.GetByMasterBillId(cbbMasterBill.Text); if (masterBill == null) { cbbMasterBill.DataSource = null; cbbMasterBill.Items.Clear(); cbbBoxId.DataSource = null; cbbBoxId.Items.Clear(); } } }
private void btnXNĐ_Click(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(cbbMasterBill.Text)) { MessageBox.Show("Bạn cần phải nhập Master airway bill (MAWB) trước", "Nhập thông tin", MessageBoxButtons.OK); cbbMasterBill.Focus(); return; } if (!CheckIsMawbExistsInManifest(cbbMasterBill.Text)) { MessageBox.Show("Mã MAWB không có trong manifest của ngày đã chọn " + dtpNgayDen.Value.ToString("dd/MM/yyyy"), "Nhập thông tin", MessageBoxButtons.OK); cbbMasterBill.Focus(); return; } MasterAirwayBillEntity masterBill = _masterBillServices.GetByMasterBillId(cbbMasterBill.Text); if (masterBill == null) { masterBill = new MasterAirwayBillEntity(); masterBill.MasterAirwayBill = cbbMasterBill.Text; masterBill.DateArrived = dtpNgayDen.Value; masterBill.DateCreated = DateTime.Now; masterBill.EmployeeId = currentEmployee.Id; currentMasterBillId = _masterBillServices.CreateMasterAirwayBill(masterBill); currentMasterBill = masterBill.MasterAirwayBill; masterBill.Id = currentMasterBillId; } else { currentMasterBillId = masterBill.Id; currentMasterBill = masterBill.MasterAirwayBill; MessageBox.Show("Mã MAWB: " + masterBill.MasterAirwayBill + " này đã được xác nhận rồi", "Mã MAWB đã được xác nhận", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } LuuXacNhanDen(); }
private void LoadAllMasterBillByDateToComboboxXacNhanDen(DateTime date) { manifestList = _manifestServices.GetManifestByDateString(dtpNgayDen.Value.ToString("yyyy-MM-dd")); List <MasterAirwayBillEntity> finalList = new List <MasterAirwayBillEntity>(); var masterBillList = manifestList.GroupBy(t => t.MasterAirWayBill).Select(p => p.First()); if (masterBillList != null && masterBillList.Any()) { foreach (ManifestEntity manifest in masterBillList) { MasterAirwayBillEntity entity = new MasterAirwayBillEntity(); entity.MasterAirwayBill = manifest.MasterAirWayBill; finalList.Add(entity); } cbbMasterBill.DataSource = finalList; cbbMasterBill.ValueMember = "MasterAirwayBill"; cbbMasterBill.DisplayMember = "MasterAirwayBill"; } else { cbbMasterBill.DataSource = null; cbbMasterBill.Items.Clear(); } }
private void btnOpenBoxOut_Click(object sender, EventArgs e) { try { if (btnOpenBoxOut.Text.Equals("Mở", StringComparison.CurrentCultureIgnoreCase)) { if (String.IsNullOrWhiteSpace(cbbMasterBillOut.Text) || String.IsNullOrWhiteSpace(cbbBoxIdOut.Text)) { MessageBox.Show("Bạn phải nhập mã Airwaybill", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } currentMasterOut = _masterBillServices.GetByMasterBillId(cbbMasterBillOut.Text); if (currentMasterOut == null) { nhapMoiKhongCanXacNhan = true; currentMasterOut = new MasterAirwayBillEntity { MasterAirwayBill = cbbMasterBillOut.Text, DateArrived = dtpNgayXuat.Value, EmployeeId = currentEmployee.Id, DateCreated = DateTime.Now }; currentMasterBillId = _masterBillServices.CreateMasterAirwayBill(currentMasterOut); currentMasterBill = currentMasterOut.MasterAirwayBill; currentMasterOut.Id = currentMasterBillId; } else { currentMasterBill = currentMasterOut.MasterAirwayBill; currentMasterBillId = currentMasterOut.Id; } /// Chuyển sang BOX OUT currentBoxOut = _boxOutServices.GetByBoxCodeandAirWaybill(cbbBoxIdOut.Text, currentMasterOut.Id); if (currentBoxOut == null) { nhapMoiKhongCanXacNhan = true; currentBoxOut = new BoxOutEntity { BoxId = cbbBoxIdOut.Text, ShipmentQuantity = 0, MasterBillId = currentMasterBillId, EmployeeId = currentEmployee.Id, DateCreated = DateTime.Now, DateInt = _repositoryShipment.DateToInt(DateTime.Now) }; currentBoxIdInt = _boxOutServices.CreateBoxOut(currentBoxOut); currentBoxId = currentBoxOut.BoxId; currentBoxOut.Id = currentBoxIdInt; } else { currentBoxIdInt = currentBoxOut.Id; currentBoxId = currentBoxOut.BoxId; } if (!LoadShipmentsByBoxId(currentBoxOut, grvShipmentListOut)) { return; } OpenBoxOut(); // Dữ liệu xác nhận đến #region Dữ liệu xác nhận đến BoxInforEntity boxEntity = _boxInforServices.GetByBoxId(cbbBoxIdOut.Text.Trim()); if (boxEntity != null) { lblCountIn.Text = _boxInforServices.GetByBoxId(boxEntity.Id).ShipmentQuantity.ToString(); } IEnumerable <ShipmentEntity> lstShipmentInfor = _shipmentServices.GetByBoxId(boxEntity.Id); if (lstShipmentInfor != null) { lstShipmentInfor = lstShipmentInfor.Where(t => t.Status == "Check"); lblClearance.Text = lstShipmentInfor.Count().ToString(); } #endregion txtShipmentIdOut.BackColor = Color.LightYellow; btnOpenBoxOut.Text = "Đóng"; } else { currentBoxOut = _boxOutServices.GetByBoxCode(cbbBoxIdOut.Text); if (currentBoxOut == null) { return; } else { IEnumerable <ShipmentOutEntity> lstshipment = _shipmentOutServices.GetByBoxId(currentBoxOut.Id); if (lstshipment == null) { _boxOutServices.Delete(currentBoxOut.Id); } else { _boxOutServices.CreateOrUpdateByQuery(lstshipment.Count(), currentBoxOut.Id); } } CloseBoxOut(); btnOpenBoxOut.Text = "Mở"; } } catch (Exception ex) { Ultilities.FileHelper.WriteLog(Ultilities.ExceptionLevel.Function, "btnOpenBoxOut_Click", ex); return; } }
private void btnOpenClose_Click(object sender, EventArgs e) { if (btnOpenClose.Text.Equals("Mở", StringComparison.CurrentCultureIgnoreCase)) { if (!ValidateInputDataConfirmArrived()) { return; } MasterAirwayBillEntity masterBill = _masterBillServices.GetByMasterBillId(cbbMasterBill.Text); if (masterBill == null) { masterBill = new MasterAirwayBillEntity(); masterBill.MasterAirwayBill = cbbMasterBill.Text; masterBill.DateArrived = dtpNgayDen.Value; masterBill.DateCreated = DateTime.Now; masterBill.EmployeeId = currentEmployee.Id; currentMasterBillId = _masterBillServices.CreateMasterAirwayBill(masterBill); currentMasterBill = masterBill.MasterAirwayBill; masterBill.Id = currentMasterBillId; cbbMasterBill.SelectedText = masterBill.MasterAirwayBill; } else { currentMasterBillId = masterBill.Id; currentMasterBill = masterBill.MasterAirwayBill; } BoxInforEntity boxEntity = _boxInforServices.GetByBoxId(cbbBoxId.Text); if (boxEntity == null) { boxEntity = new BoxInforEntity(); boxEntity.BoxId = cbbBoxId.Text; boxEntity.ShipmentQuantity = numberShipment; boxEntity.MasterBillId = currentMasterBillId; boxEntity.DateCreated = DateTime.Now; boxEntity.EmployeeId = currentEmployee.Id; currentBoxIdInt = _boxInforServices.CreateBoxInfor(boxEntity); boxEntity.Id = currentBoxIdInt; currentBoxId = boxEntity.BoxId; } else { currentBoxIdInt = boxEntity.Id; currentBoxId = boxEntity.BoxId; } OpenBox(); LoadShipmentsByBoxIdInXacNhanDen(cbbBoxId.Text, grvShipments); btnOpenClose.Text = "Đóng"; } else { if (!isConfirmed) { SaveShipment(); } BoxInforEntity boxEntity = _boxInforServices.GetByBoxId(cbbBoxId.Text); if (boxEntity == null) { return; } else { IEnumerable <ShipmentEntity> lstshipment = _shipmentServices.GetByBoxId(boxEntity.Id); if (lstshipment == null) { _boxInforServices.Delete(boxEntity.Id); } else { _boxInforServices.CreateOrUpdateByQuery(lstshipment.Count(), boxEntity.Id); } } CloseBox(); btnOpenClose.Text = "Mở"; } MasterAirwayBillEntity itemMaster = _masterBillServices.GetByMasterBillId(cbbMasterBill.Text); }