/// <summary> /// Deprecated Method for adding a new object to the Deliveries EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToDeliveries(Delivery delivery) { base.AddObject("Deliveries", delivery); }
/// <summary> /// Create a new Delivery object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="customerId">Initial value of the CustomerId property.</param> /// <param name="driverId">Initial value of the DriverId property.</param> /// <param name="vehicleId">Initial value of the VehicleId property.</param> /// <param name="fromLocation">Initial value of the FromLocation property.</param> /// <param name="destination">Initial value of the Destination property.</param> /// <param name="cost">Initial value of the Cost property.</param> /// <param name="dispatchTime">Initial value of the DispatchTime property.</param> /// <param name="arrivalTime">Initial value of the ArrivalTime property.</param> /// <param name="returnTime">Initial value of the ReturnTime property.</param> public static Delivery CreateDelivery(global::System.Int32 id, global::System.Int32 customerId, global::System.Int32 driverId, global::System.String vehicleId, global::System.String fromLocation, global::System.String destination, global::System.Single cost, global::System.DateTime dispatchTime, global::System.DateTime arrivalTime, global::System.DateTime returnTime) { Delivery delivery = new Delivery(); delivery.Id = id; delivery.CustomerId = customerId; delivery.DriverId = driverId; delivery.VehicleId = vehicleId; delivery.FromLocation = fromLocation; delivery.Destination = destination; delivery.Cost = cost; delivery.DispatchTime = dispatchTime; delivery.ArrivalTime = arrivalTime; delivery.ReturnTime = returnTime; return delivery; }
private void SaveOrders(Delivery delivery) { var biz = new DeliveryDetailBiz(); biz.RemoveItemsByDeliveryId(delivery.Id); foreach (DataGridViewRow row in dataGridView.Rows) { var item = row.DataBoundItem as SearchOrder; var detail = new DeliveryDetail(); detail.DeliveryId = delivery.Id; detail.OrderId = item.Id; if (item.DeliveryTime.HasValue) { detail.Time = item.DeliveryTime.Value; } detail.Index = row.Index; biz.SaveItem(detail); } }
private void SaveItem(object sender, EventArgs e) { if (CheckSecurity(itemId)) { var parent = this.Parent as SplitterPanel; parent.Controls.Clear(); var orderView = new MainView(currentUser) { Dock = DockStyle.Fill, TopLevel = false }; parent.Controls.Add(orderView); orderView.Show(); this.Close(); } else { if (CustomValidation()) { var item = new Delivery(); SaveDelivery(item); var parent = this.Parent as SplitterPanel; parent.Controls.Clear(); var deliveryView = new MainView(currentUser) { Dock = DockStyle.Fill, TopLevel = false }; parent.Controls.Add(deliveryView); deliveryView.Show(); this.Close(); } else { this.DialogResult = System.Windows.Forms.DialogResult.None; } } }
private Delivery SaveDelivery(Delivery item) { item.DeliveryDate = dateStartDate.Value; item.StartTime = TimeSpan.Parse(dateTimeStartTime.Value.ToString(@"hh\:mm")); item.OtherInformation = textOtherInformation.Text; item.VehicleId = Convert.ToInt32(drlVehicle.SelectedValue); item.StaffId = Convert.ToInt32(drlUser.SelectedValue); if (itemId > 0) { item.Id = itemId; item.Created = created; item.CreatedByUserId = createdBy; if (string.IsNullOrEmpty(item.IsSendEmail)) { item.IsSendEmail = labelSendEmail.Text; } if (string.IsNullOrEmpty(item.IsSendSms)) { item.IsSendSms = labelSendSms.Text; } item.DeliveryNo = labelDeliveryNo.Text; item.Status = labelStatus.Text; item.Modified = DateTime.Now; item.ModifiedByUserId = currentUser.Id; var biz = new DeliveryBiz(); biz.UpdateItem(item); } else { item.Status = Constants.DeliveryStatusDraft; item.Created = DateTime.Now; item.CreatedByUserId = currentUser.Id; if (string.IsNullOrEmpty(item.IsSendEmail)) { item.IsSendEmail = Constants.DeliverySendEmail; } if (string.IsNullOrEmpty(item.IsSendSms)) { item.IsSendSms = Constants.DeliverySendSms; } item.Modified = DateTime.Now; item.ModifiedByUserId = currentUser.Id; var biz = new DeliveryBiz(); biz.SaveItem(item); } SaveOrders(item); return item; }
private void SaveAndSendMessages(object sender, EventArgs e) { if (CustomValidation()) { var delivery = new Delivery(); delivery.IsSendSms = Constants.DeliverySentSms; var item = SaveDelivery(delivery); var parent = this.Parent as SplitterPanel; parent.Controls.Clear(); var deliveryView = new MainView(currentUser, false, true, item.Id) { Dock = DockStyle.Fill, TopLevel = false }; parent.Controls.Add(deliveryView); deliveryView.Show(); this.Close(); } else { this.DialogResult = DialogResult.None; } }
private void LoadOrders(Delivery delivery) { if (delivery.Details.Count == 0) return; listOrder = new List<SearchOrder>(); foreach (var detail in delivery.Details) { var searchOrder = new SearchOrder(); searchOrder.DeliveryTime = detail.Time; searchOrder.Status = detail.Order.Status; searchOrder.CustomerName = detail.Order.CustomerName; searchOrder.OrderNo = detail.Order.OrderNo; searchOrder.Id = detail.Order.Id; searchOrder.DeliveryInternal = detail.Order.DeliveryInternal; listOrder.Add(searchOrder); } dataGridView.DataSource = null; dataGridView.DataSource = listOrder; dataGridView.Refresh(); }