/// <summary> /// This function initiate order and send to the planner for further process /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CreateOrder_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrEmpty(ClientName.Text) || !string.IsNullOrEmpty(txtDestinationCity.Text) || !string.IsNullOrEmpty(txtOriginCity.Text) || !string.IsNullOrEmpty(JobType.Text) || !string.IsNullOrEmpty(vanType.Text)) { TMS.Data.City city = (TMS.Data.City)Enum.Parse(typeof(TMS.Data.City), txtDestinationCity.Text); contract.Destination = city; contract.Customer = new Customer(); contract.Customer.Name = ClientName.Text; tms.CreateCustomer(contract.Customer); city = (TMS.Data.City)Enum.Parse(typeof(TMS.Data.City), txtOriginCity.Text); contract.Origin = city; JobType job = (JobType)Enum.Parse(typeof(JobType), JobType.Text); contract.JobType = job; VanType van = (VanType)Enum.Parse(typeof(VanType), vanType.Text); contract.VanType = van; contract.Quantity = Convert.ToInt32(Quantity.Text); TMS.Data.Status status = (TMS.Data.Status)Enum.Parse(typeof(TMS.Data.Status), Status.PENDING.ToString()); contract.Status = status; tms.CreateContract(contract); MessageBox.Show("Order Started", "Done", MessageBoxButton.OK, MessageBoxImage.Information); MakeFileEmpty(); Invoice.GenerateInvoice(contract); } else { MessageBox.Show("Please Select an order first !!", "Empty Selection", MessageBoxButton.OK, MessageBoxImage.Error); } }
/// <summary> /// this function will grab completed data from the databse and load it to the data grid so buyer can select it and proceed for invoice /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCompleteOrders_Click(object sender, RoutedEventArgs e) { contracts = new List <Contract>(); TMS.Data.Status status = (TMS.Data.Status)Enum.Parse(typeof(TMS.Data.Status), Status.FINISHED.ToString()); contracts = tms.GetContractsByStatus(status); orderData.ItemsSource = contracts; }