/// <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); } }
public void TestCreateContract() { TmsDal dal = new TmsDal(); Customer customer = new Customer(); customer.Name = "TestCustomer"; customer = dal.CreateCustomer(customer); Contract contract = new Contract(); contract.Carrier = dal.GetCarrier(1); contract.Customer = customer; contract.JobType = JobType.FTL; contract.VanType = VanType.Dry; contract.Quantity = 1; contract.Status = Status.STARTED; contract.Origin = City.Windsor; contract.Destination = City.Toronto; contract = dal.CreateContract(contract); }