private void DeleteParcel_Click(object sender, EventArgs e) { const string message = "Are you confirm to delete the parcel infomation? "; const string caption = "Delete"; var result = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); // If the no button was pressed ... if (result == DialogResult.No) { // will auto close } else { List<int> list = new List<int>(); for(int i = 0; i < dataGridView1.Rows.Count; i++) { if (Convert.ToBoolean(dataGridView1.Rows[i].Cells[0].Value) == true) { list.Add(Convert.ToInt32(dataGridView1.Rows[i].Cells[1].Value)); } } ParcelController.Delete(list); MessageBox.Show("Deleted Successful"); registerHereLoad(); } }
public MainForm(LoginForm loginForm, ParcelController parcelController, CourierForm courierForm) { _parcelController = parcelController; _loginForm = loginForm; _courierForm = courierForm; InitializeComponent(); }
protected void Page_Load(object sender, EventArgs e) { string path = HttpContext.Current.Request.Url.AbsolutePath; if (!Authentication.IsSignedIn() && !path.Equals("/default.aspx") && !path.Equals("/SendPackage.aspx") && !path.Equals("/Tracking.aspx") && !path.Equals("/SendPackage") && !path.Equals("/Tracking")) { Response.Redirect("~/", true); } User user = repository.GetUser(Authentication.GetUid()); Username.Text = user.Name; pendingNum.Text = Convert.ToString(ParcelController.CalculatePendingParcels(user.Uid)); pickUpNum.Text = Convert.ToString(ParcelController.CalculatePickUpParcels(user.Uid)); inTransitNum.Text = Convert.ToString(ParcelController.CalculateInTransitParcels(user.Uid)); outOfDeliveryNum.Text = Convert.ToString(ParcelController.CalculateDeliveringParcels(user.Uid)); deliveredNum.Text = Convert.ToString(ParcelController.CalculateDeliveredParcels(user.Uid)); List <ShipmentRecord> list = repository.GetShipmentHistory(user.Uid); Debug.WriteLine(list.Count); ShipmentHistory.DataSource = list; ShipmentHistory.DataBind(); }
private void ConfirmBtn_Click(object sender, EventArgs e) { const string message = "Confirm assign route? "; const string caption = "Assign Route"; var result = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); // If the no button was pressed ... if (result == DialogResult.No) { // cancel the closure of the form. this.Close(); } else { string nextBranchId = dbroute.SelectedValue.ToString(); bool notAssigned = false; if (dbroute.SelectedValue.ToString() == "NULL") { nextBranchId = null; } else if (dbroute.SelectedValue.ToString() == "NA") { nextBranchId = null; notAssigned = true; } ParcelController.ChangeRoute(trackingNum, nextBranchId, notAssigned); this.Close(); admin.ViewParcelInBranch(); } }
private void Button1_Click(object sender, EventArgs e) { const string message = "Are you confirm to register the parcel? "; const string caption = "Register Online Pick up parcel"; var result = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); // If the no button was pressed ... if (result == DialogResult.No) { // will auto close } else { List<int> list = new List<int>(); for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (Convert.ToBoolean(dataGridView1.Rows[i].Cells[0].Value) == true) { list.Add(Convert.ToInt32(dataGridView1.Rows[i].Cells[1].Value)); } } ParcelController.RegisterOnlinePickUp(list, branchId); MessageBox.Show("Added Successful"); ViewOnlinePickUpRequest(); } }
private void UpdateParcelDetails_Load(object sender, EventArgs e) { DataTable result = ParcelController.Get(trackNo); tbSenderName.Text = result.Rows[0].Field <string>(11); tbSenderContactNo.Text = result.Rows[0].Field <string>(14); cbIdtype.SelectedIndex = result.Rows[0].Field <byte>(12) - 1; idNumber.Text = result.Rows[0].Field <string>(13); tbSenderEmail.Text = result.Rows[0].Field <string>(15); tbSenderAddress.Text = result.Rows[0].Field <string>(16); tbSenderPosCode.Text = result.Rows[0].Field <string>(18); cbSenderLocation.Text = result.Rows[0].Field <string>(17); tbReceiverName.Text = result.Rows[0].Field <string>(19); tbReceiverContactNo.Text = result.Rows[0].Field <string>(20); tbReceiverEmail.Text = result.Rows[0].Field <string>(21); tbReceiverAddress.Text = result.Rows[0].Field <string>(22); tbReceiverPosCode.Text = result.Rows[0].Field <string>(24); cbReceiverLocation.Text = result.Rows[0].Field <string>(23); if (result.Rows[0].Field <bool>(2) == false) { rbParcel.Checked = true; } else { rbDocument.Checked = true; } tbPieces.Text = result.Rows[0].Field <byte>(3).ToString(); tbContent.Text = result.Rows[0].Field <string>(4); tbValueofContent.Text = result.Rows[0].Field <decimal>(5).ToString(); tbWeight.Text = result.Rows[0].Field <float>(6).ToString(); }
public ParcelRegistrationForm(ParcelController parcelController, EmployeeController employeeController, EmploymentController employmentController) { _parcelController = parcelController; _employeeController = employeeController; _employmentController = employmentController; InitializeComponent(); Console.WriteLine(parcelPriorityComboBox.SelectedIndex); }
public CourierForm(StorePlaceController storePlaceController, ParcelController parcelController, EmployeeController employeeController, ParcelReturnForm parcelReturnForm) { _storePlaceController = storePlaceController; _parcelController = parcelController; _employeeController = employeeController; _parcelReturnForm = parcelReturnForm; InitializeComponent(); }
private void QuoteBtn_Click(object sender, EventArgs e) { if (!(is_tbValidate())) { // Initializes the variables to pass to the MessageBox.Show method. string message = "Some information is missing. Please check again the form."; string caption = "Error Detected in Input"; MessageBoxButtons buttons = MessageBoxButtons.OKCancel; DialogResult result; // Displays the MessageBox. result = MessageBox.Show(message, caption, buttons); if (result == System.Windows.Forms.DialogResult.Cancel) { // Closes the parent form. this.Close(); } } else { if (!(formatValidate())) { string message = "Some information is in invalid format. Please check again."; string caption = "Invalid Format"; MessageBoxButtons buttons = MessageBoxButtons.OKCancel; DialogResult result; // Displays the MessageBox. result = MessageBox.Show(message, caption, buttons); if (result == System.Windows.Forms.DialogResult.Cancel) { // Closes the parent form. this.Close(); } } else { bool parcelTypeResult; if (rbParcel.Checked) { parcelTypeResult = false; } else { parcelTypeResult = true; } ParcelInfo parcelInfo = new ParcelInfo(false, parcelTypeResult, Convert.ToByte(tbPieces.Text), tbContent.Text, Convert.ToDecimal(tbValueofContent.Text), Convert.ToSingle(tbWeight.Text), 0, 0); decimal quoteFee = ParcelController.Quote(cbSenderLocation.Text, tbSenderPosCode.Text, cbReceiverLocation.Text, tbReceiverPosCode.Text, parcelInfo, null); price.Text = Convert.ToString(quoteFee); ConfirmBtn.Enabled = true; } } }
protected void QuoteBtn_Click(object sender, EventArgs e) { string senderPostcode = FromPostCode.Text; string senderLocation = FromLocation.SelectedValue; string receiverPostcode = ToPostCode.Text; string receiverLocation = ToLocation.SelectedValue; float parcelWeight = Convert.ToSingle(Weight.Text); Decimal quotedPrice = ParcelController.Quote(senderLocation, senderPostcode, receiverLocation, receiverPostcode, new Models.ParcelInfo(false, false, 1, "", 0, parcelWeight, 0, 0), null); QuotedPrice.Text = "RM " + quotedPrice.ToString("N2"); QuotedPrice.Visible = true; }
public WarehouseForm(EmployeeController employeeController, SortController sortController, StorePlaceController storePlaceController, ParcelController parcelController) { _employeeController = employeeController; _sortController = sortController; vehiclesCargoDictionary = new Dictionary <Vehicle, List <ListViewItem> >(); _availableVehicles = new List <Vehicle>(); _availableParcels = new List <ListViewItem>(); _parcels = new List <Parcel>(); _storePlaceController = storePlaceController; _parcelController = parcelController; InitializeComponent(); }
public void registerHereLoad() { branchId = staff.BranchId; DataTable dt = ParcelController.GetAllRegisteredParcels(branchId); DataTable dt1 = new DataTable(); dt1 = dt.DefaultView.ToTable( true, "tracking_number", "pieces", "weight", "date_created", "sender_name", "sender_phone", "receiver_name", "receiver_phone", "receiver_address", "receiver_location", "receiver_postcode"); dataGridView1.DataSource = dt1; }
public void Index_HasCorrectModeType_ParcelList() { //Arrage // ParcelController controller = new ParcelController(); // ViewResult indexView = (ViewResult)controller.Index(); ViewResult indexView = new ParcelController().Index() as ViewResult; //Act var result = indexView.ViewData.Model; //Assert Assert.IsInstanceOfType(result, typeof(List <Parcel>)); }
public void GetParcelCost_returns_400(int weight, int height, int width, int depth) { //Given var sut = new ParcelController(mockParcelManager.Object); //When var actual = sut.GetParcelCost(weight, height, width, depth); //Then var result = Assert.IsType <BadRequestObjectResult>(actual); Assert.Equal(400, result.StatusCode); }
private void ConfirmBtn_Click(object sender, EventArgs e) { string message = "Do you want to confirm the parcel details?"; string caption = "Confirmation"; MessageBoxButtons buttons = MessageBoxButtons.OKCancel; DialogResult result; result = MessageBox.Show(message, caption, buttons); if (result == System.Windows.Forms.DialogResult.Cancel) { // Closes the parent form. this.Close(); } else { int senderIDType = 0; if (cbIdtype.Text == "IC Number") { senderIDType = 1; } else if (cbIdtype.Text == " Old IC Number") { senderIDType = 2; } else { senderIDType = 3; } bool parcelTypeResult; if (rbParcel.Checked) { parcelTypeResult = false; } else { parcelTypeResult = true; } PersonInfo sender1 = new PersonInfo(tbSenderName.Text, tbSenderEmail.Text, tbSenderContactNo.Text, tbSenderAddress.Text, tbSenderPosCode.Text, cbSenderLocation.Text, tbSenderCity.Text, tbSenderState.Text); PersonInfo receiver1 = new PersonInfo(tbReceiverName.Text, tbReceiverEmail.Text, tbReceiverContactNo.Text, tbReceiverAddress.Text, tbReceiverPosCode.Text, cbReceiverLocation.Text, tbReceiverCity.Text, tbReceiverState.Text); ParcelInfo parcelInfo = new ParcelInfo(false, parcelTypeResult, Convert.ToByte(tbPieces.Text), tbContent.Text, Convert.ToDecimal(tbValueofContent.Text), Convert.ToSingle(tbWeight.Text), Convert.ToDecimal(price.Text), 0); ParcelController.Create(Convert.ToByte(senderIDType), tbSenderidNumber.Text, sender1, receiver1, parcelInfo, Authentication.CurrentStaff.BranchId); MessageBox.Show("Add Success!"); this.Close(); admin.registerHereLoad(); } }
public void StartProcess(int weight, int height, int width, int depth, decimal cost) { //Given var sut = new ParcelController(_parcelManager); //When var actual = sut.GetParcelCost(weight, height, width, depth); //Then var result = Assert.IsType <OkObjectResult>(actual); var parcelCost = Assert.IsType <ParcelCost>(result.Value); Assert.Equal(cost, parcelCost.CostOfDelivery); }
public void GetParcelCost_returns_404(int weight, int height, int width, int depth) { //Given mockParcelManager.Setup(m => m.GetCost(It.IsAny <Parcel>())).Returns <ParcelCost>(null); var sut = new ParcelController(mockParcelManager.Object); //When var actual = sut.GetParcelCost(weight, height, width, depth); //Then var result = Assert.IsType <NotFoundResult>(actual); Assert.Equal(404, result.StatusCode); }
public void GetParcelCost_returns_500(int weight, int height, int width, int depth) { //Given mockParcelManager.Setup(m => m.GetCost(It.IsAny <Parcel>())).Throws <Exception>(); var sut = new ParcelController(mockParcelManager.Object); //When var actual = sut.GetParcelCost(weight, height, width, depth); //Then var result = Assert.IsType <StatusCodeResult>(actual); Assert.Equal(500, result.StatusCode); }
public void SetUp() { var xmlData = string.Empty; _parcelServiceWithMock = new Mock <IParcelService>(MockBehavior.Strict); _mapper = new Mock <IMapper>(); _controller = new ParcelController(_parcelServiceWithMock.Object); var myProfile = new MappingProfile(); var configuration = new MapperConfiguration(cfg => cfg.AddProfile(myProfile)); var mapper = new Mapper(configuration); parcelServiceWithoutMock = new ParcelService( mapper); _parcelServiceWithMock.Setup(p => p.PostXmlData(It.IsAny <HttpPostedFileBase>())).Returns(xmlData); _parcelServiceWithMock.Setup(p => p.ProcessData(It.IsAny <string>())).Returns(new List <ParcelOutputDto>()); }
public void GetParcelCost_returns_correct_object_state(int weight, int height, int width, int depth) { //Given ParcelCost parcelCost = new ParcelCost(20, "mock"); mockParcelManager.Setup(m => m.GetCost(It.IsAny <Parcel>())).Returns(parcelCost); var sut = new ParcelController(mockParcelManager.Object); //When var actual = sut.GetParcelCost(weight, height, width, depth); //Then var result = Assert.IsType <OkObjectResult>(actual); Assert.Equal(200, result.StatusCode); Assert.IsType <ParcelCost>(result.Value); }
//view all outgoing parcels(each route, delivery) public void ViewOutGoingParcel() { branchId = staff.BranchId; list = RouteController.GetRoutesForBranch(branchId); if (comboBox3.SelectedIndex == 0) { DataTable dt = ParcelController.GetAllOutgoingParcels(branchId, null); DataTable dt1 = new DataTable(); dt1 = dt.DefaultView.ToTable( true, "tracking_number", "plate_number", "pieces", "weight", "date_created", "sender_name", "sender_phone", "receiver_name", "receiver_phone", "receiver_address", "receiver_location", "receiver_postcode"); dataGridView1.DataSource = dt1; dataGridView1.Columns["plate_number"].DisplayIndex = 2; endTripBtn.Enabled = true; } else { endTripBtn.Enabled = false; } int j = 1; for (int i = 0; i < list.Count; i++) { if (comboBox3.SelectedIndex == j) { DataTable dt = ParcelController.GetAllOutgoingParcels(branchId, list[i].Id); DataTable dt1 = new DataTable(); dt1 = dt.DefaultView.ToTable( true, "tracking_number", "plate_number", "pieces", "weight", "date_created", "sender_name", "sender_phone", "receiver_name", "receiver_phone", "receiver_address", "receiver_location", "receiver_postcode"); dataGridView1.DataSource = dt1; dataGridView1.Columns["plate_number"].DisplayIndex = 2; } j++; } }
public LogisticsNewRouteForm( RouteController routeController, VehicleController vehicleController, EmployeeController employeeController, StorePlaceController storePlaceController, PositionController positionController, ParcelController parcelController ) { _routeController = routeController; _vehicleController = vehicleController; _employeeController = employeeController; _storePlaceController = storePlaceController; _positionController = positionController; _parcelController = parcelController; InitializeComponent(); }
private void RadioButton5_CheckedChanged(object sender, EventArgs e) { if (radioButton5.Checked) { branchId = staff.BranchId; DataTable dt = ParcelController.GetAllDeliveredParcels(branchId); DataTable dt1 = new DataTable(); dt1 = dt.DefaultView.ToTable( true, "tracking_number", "delivered_date", "pieces", "weight", "date_created", "sender_name", "sender_phone", "receiver_name", "receiver_phone", "receiver_address", "receiver_location", "receiver_postcode"); dataGridView1.DataSource = dt1; dataGridView1.Columns["delivered_date"].DisplayIndex = 2; } }
private void Button1_Click(object sender, EventArgs e) { branchId = staff.BranchId; int trackingNum = Convert.ToInt32(textBox1.Text); if (ParcelController.RegisterOnlineLodgeIn(trackingNum, branchId) == true) { MessageBox.Show("Successful Added"); textBox1.Text = ""; home.registerHereLoad(); } else { MessageBox.Show("Fail to add, please check again the tracking number"); textBox1.Text = ""; } }
private void ConfirmBtn_Click(object sender, EventArgs e) { const string message = "Confirm start trip? "; const string caption = "Start Trip"; var result = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); // If the no button was pressed ... if (result == DialogResult.No) { // cancel the closure of the form. } else { string carNumber = carNo.Text; ParcelController.StartTransit(branchId, nextBranch, carNumber, trackingNumList); this.Close(); admin.ViewParcelInBranch(); } }
private void UpdateBtn_Click(object sender, EventArgs e) { const string message = "Are you confirm to update the parcel infomation? "; const string caption = "Update Information"; var result = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); // If the no button was pressed ... if (result == DialogResult.Yes) { PersonInfo senderUpdated = new PersonInfo(tbSenderName.Text, tbSenderEmail.Text, tbSenderContactNo.Text, tbSenderAddress.Text, tbSenderPosCode.Text, cbSenderLocation.Text, tbSenderCity.Text, tbSenderState.Text); PersonInfo receiverUpdated = new PersonInfo(tbReceiverName.Text, tbReceiverEmail.Text, tbReceiverContactNo.Text, tbReceiverAddress.Text, tbReceiverPosCode.Text, cbReceiverLocation.Text, tbReceiverCity.Text, tbReceiverState.Text); ParcelController.Update(trackNo, Convert.ToByte((cbIdtype.SelectedIndex) + 1), idNumber.Text, senderUpdated, receiverUpdated); MessageBox.Show("Update Success!"); // cancel the closure of the form. this.Close(); admin.registerHereLoad(); } }
private void ConfirmBtn_Click(object sender, EventArgs e) { const string message = "Confirm end trip? "; const string caption = "End Trip"; var result = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); List <int> list = new List <int>(); for (int i = 0; i < dataGridView.Rows.Count; i++) { if (dataGridView.Rows[i].Cells[2].Value.ToString() == carNo.Text) { list.Add(Convert.ToInt32(dataGridView.Rows[i].Cells[1].Value)); } } // If the no button was pressed ... if (result == DialogResult.No) { // cancel the closure of the form. this.Close(); } else if (route == null) { string carNumber = carNo.Text; ParcelController.EndTransit(branchId, route, carNumber, list); this.Close(); admin.ViewOutGoingParcel(); } else { string carNumber = carNo.Text; ParcelController.EndTransit(branchId, route, carNumber, list); this.Close(); admin.ViewIncomingParcel(); } }
public void ViewOnlinePickUpRequest() { if (pickUpRB.Checked) { branchId = staff.BranchId; button1.Enabled = true; DataTable dt = ParcelController.GetAllParcelsToPickUp(); DataTable dt1 = new DataTable(); dt1 = dt.DefaultView.ToTable( true, "tracking_number", "pieces", "weight", "date_created", "sender_name", "sender_phone", "sender_address", "sender_location", "sender_postcode", "receiver_name", "receiver_phone", "receiver_address", "receiver_location", "receiver_postcode"); dataGridView1.DataSource = dt1; } else { button1.Enabled = false; } }
public void ViewIncomingParcel() { branchId = staff.BranchId; list = RouteController.GetRoutesForBranch(branchId); for (int i = 0; i < list.Count; i++) { if (comboBox2.SelectedIndex == i) { DataTable dt = ParcelController.GetAllIncomingParcels(branchId, list[i].Id); DataTable dt1 = new DataTable(); dt1 = dt.DefaultView.ToTable( true, "tracking_number", "plate_number", "pieces", "weight", "date_created", "sender_name", "sender_phone", "receiver_name", "receiver_phone", "receiver_address", "receiver_location", "receiver_postcode"); dataGridView1.DataSource = dt1; dataGridView1.Columns["plate_number"].DisplayIndex = 2; } } }
protected void QuoteBtn_Click(object sender, EventArgs e) { Debug.WriteLine("hello"); try { decimal PickupPrice = 0, deliveryfee; bool serviceType = true; if (LodgeUpBtn.Checked) { serviceType = false; PickupPrice = 0; } else if (PickUpBtn.Checked) { serviceType = true; PickupPrice = 5; } bool parcelType = true; if (TypeofParcel.SelectedItem.ToString() == "Parcel") { parcelType = false; } else { parcelType = true; } ParcelInfo parcelInfo = new ParcelInfo(serviceType, parcelType, Convert.ToByte(Pieces.Text), Content.Text, Convert.ToDecimal(ValueofContent.Text), Convert.ToSingle(Weight.Text), 0, PickupPrice); if (LodgeUpBtn.Checked) { deliveryfee = ParcelController.Quote(SenderLocation.Text, SenderPostal.Text, ReceiverLocation.Text, ReceiverPostal.Text, parcelInfo, null); } else { PickUpInfo pickupInfo = new PickUpInfo(Convert.ToDateTime(dbPickUpDate.Text), Convert.ToDateTime(ParcelRTime.Text), remarksNote.Text, true); deliveryfee = ParcelController.Quote(SenderLocation.Text, SenderPostal.Text, ReceiverLocation.Text, ReceiverPostal.Text, parcelInfo, pickupInfo); } //Response.Redirect("Checkout.aspx"); HttpContext.Current.Items.Add("DeliveryFee", deliveryfee); HttpContext.Current.Items.Add("PickUpFee", PickupPrice); HttpContext.Current.Items.Add("SenderName", SenderName.Text); HttpContext.Current.Items.Add("SenderContactNo", SenderContactNo.Text); HttpContext.Current.Items.Add("IDType", IDType.Text); HttpContext.Current.Items.Add("SenderIDNo", SenderIDNo.Text); HttpContext.Current.Items.Add("SenderAddress", SenderAdd.Text); HttpContext.Current.Items.Add("SenderPostal", SenderPostal.Text); HttpContext.Current.Items.Add("SenderLocation", SenderLocation.Text); HttpContext.Current.Items.Add("SenderCity", SenderCity.Text); HttpContext.Current.Items.Add("SenderState", SenderState.Text); HttpContext.Current.Items.Add("SenderEmail", SenderEmail.Text); HttpContext.Current.Items.Add("ServiceType", serviceType); if (serviceType == true) { HttpContext.Current.Items.Add("PickUpDate", dbPickUpDate.Text); HttpContext.Current.Items.Add("PickUpTime", ParcelRTime.Text); HttpContext.Current.Items.Add("Remarks", remarksNote.Text); } HttpContext.Current.Items.Add("ReceiverName", ReceiverName.Text); HttpContext.Current.Items.Add("ReceiverContactNo", ReceiverContactNo.Text); HttpContext.Current.Items.Add("ReceiverAddress", ReceiverAdd.Text); HttpContext.Current.Items.Add("ReceiverPostal", ReceiverPostal.Text); HttpContext.Current.Items.Add("ReceiverLocation", ReceiverLocation.Text); HttpContext.Current.Items.Add("ReceiverCity", ReceiverCity.Text); HttpContext.Current.Items.Add("ReceiverState", ReceiverState.Text); HttpContext.Current.Items.Add("ReceiverEmail", ReceiverEmail.Text); HttpContext.Current.Items.Add("ParcelType", parcelType); HttpContext.Current.Items.Add("Pieces", Pieces.Text); HttpContext.Current.Items.Add("Content", Content.Text); HttpContext.Current.Items.Add("ValueofContent", ValueofContent.Text); HttpContext.Current.Items.Add("Weight", Weight.Text); } catch (NullReferenceException) { } try { Server.Transfer("Checkout.aspx", true); } catch (ThreadAbortException) { // Exception ignored: Thread Abort = discontinue processing on the current page } }