Esempio n. 1
0
        private async void Register_Click(object sender, EventArgs e)
        {
            if (!(await IsValidTrackingIds()))
            {
                error.SetError(TrackingIdCount, "Some tracking ids already exist in database.");
                return;
            }
            else
            {
                error.SetError(TrackingIdCount, "");
            }
            try
            {
                foreach (var item in TrackingIds)
                {
                    InwardSingleShipment si = new InwardSingleShipment()
                    {
                        CourierName = CourierName.Text, Date = ShipmentDate.Value, ItemCondition = "N/A", ItemName = "N/A", Remarks = Remarks.Text, TrackingId = item, ShipmentType = "Inward", CustomerName = "N/A", Amount = "N/A", PaymentType = "N/A"
                    };
                    ShipmentLibrary.InsertInwardSingleShipment(si);
                }
                Notification.Show("Registered", Notification.Type.Success);
                Clear();
                inwardSingleShipmentBindingSource.DataSource = await ShipmentLibrary.GetInwardShipmentsAsync();

                dg.ClearSelection();
            }
            catch (Exception ex)
            {
                MessageBox.Show($"Failed to register shipments due to:\nException Type:{ex.GetType()}\nMessage:{ex.Message}", ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 private async void ItemName_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter && ItemName.TextLength > 0)
     {
         inwardSingleShipmentBindingSource.DataSource = await ShipmentLibrary.GetShipmentsByTrackingAsync(ItemName.Text);
     }
 }
Esempio n. 3
0
        private async void UC_BulkInward_Load(object sender, System.EventArgs e)
        {
            CourierName.Items.Clear();
            CourierName.Items.AddRange(await ShipmentLibrary.GetCourierNamesAsync());
            inwardSingleShipmentBindingSource.DataSource = await ShipmentLibrary.GetInwardShipmentsAsync();

            dg.ClearSelection();
        }
Esempio n. 4
0
 private async void NewGodown_Click(object sender, System.EventArgs e)
 {
     using (FormNewCourierName f = new FormNewCourierName())
     {
         if (f.ShowDialog() == DialogResult.OK)
         {
             CourierName.Items.Clear();
             CourierName.Items.AddRange(await ShipmentLibrary.GetCourierNamesAsync());
         }
     }
 }
Esempio n. 5
0
 private async Task <bool> IsValidTrackingIds()
 {
     foreach (var item in TrackingIds)
     {
         if (await ShipmentLibrary.IsTrackingIdExistsAsync(item))
         {
             return(false);
         }
     }
     return(true);
 }
Esempio n. 6
0
 private async void Register_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrWhiteSpace(Godown.Text))
     {
         error.SetError(Godown, "Courier name can't be empty.");
         return;
     }
     if (await ShipmentLibrary.IsCourierNameExistsAsync(Godown.Text))
     {
         error.SetError(Godown, "Courier name already exists in database.");
         return;
     }
     error.SetError(Godown, "");
     ShipmentLibrary.InsertCourierName(Godown.Text);
     this.DialogResult = DialogResult.OK;
     MessageBox.Show("Courier name was successfully registered.", ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
Esempio n. 7
0
        private async void Register_Click(object sender, EventArgs e)
        {
            try
            {
                InwardSingleShipment si = new InwardSingleShipment()
                {
                    CourierName = CourierName.Text, Date = ShipmentDate.Value, ItemCondition = ItemCondition.Text, ItemName = ItemName.Text, Remarks = Remarks.Text, TrackingId = TrackingId.Text, ShipmentType = "Inward", CustomerName = "N/A", PaymentType = "N/A", Amount = "N/A"
                };
                ShipmentLibrary.InsertInwardSingleShipment(si);
                Notification.Show("Shipment registered", Notification.Type.Success);
                Clear();
                inwardSingleShipmentBindingSource.DataSource = await ShipmentLibrary.GetInwardShipmentsAsync();

                dg.ClearSelection();
            }
            catch (Exception ex)
            {
                MessageBox.Show($"Failed to register shipment due to:\nException Type:{ex.GetType()}\nMessage:{ex.Message}", ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 8
0
 private async void Search_Click(object sender, EventArgs e)
 {
     inwardSingleShipmentBindingSource.DataSource = await ShipmentLibrary.GetShipmentsAsync(From.Value, To.Value);
 }
 private async void UC_SearchTrackingId_Load(object sender, EventArgs e)
 {
     ItemName.AutoCompleteCustomSource = await ShipmentLibrary.GetTrackingIdsAsync();
 }