private void c1Combo2_SelectedValueChanged(object sender, EventArgs e) { if (txMode == DataEntryModes.Add) { try { // get data dsCore ds = new dsCore(); OrdersTableAdapter od = new OrdersTableAdapter(); OrderDetailsTableAdapter ta = new OrderDetailsTableAdapter(); ds.EnforceConstraints = false; od.Connection = AppHelper.GetDbConnection(); od.FillByID(ds.Orders, (int)c1Combo2.SelectedValue); ta.Connection = AppHelper.GetDbConnection(); ta.FillNotCompleted(ds.OrderDetails, (int)c1Combo2.SelectedValue); // clear grid dsCore1.OrderDetails.Clear(); // fill grid with new data _grid.Redraw = false; DataRowView dv = (DataRowView)this.BindingContext[dsCore1, "Orders"].Current; dv["CompanyID"] = ds.Orders[0].CompanyID; dv["CurrencyID"] = ds.Orders[0].CurrencyID; if (!ds.Orders[0].IsCompanyIDNull()) { c1Combo1.SelectedValue = ds.Orders[0].CompanyID; } if (!ds.Orders[0].IsCurrencyIDNull()) { c1Combo3.SelectedValue = ds.Orders[0].CurrencyID; } foreach (dsCore.OrderDetailsRow src in ds.OrderDetails.Rows) { dsCore.OrderDetailsRow row = dsCore1.OrderDetails.NewOrderDetailsRow(); row.OrderID = (int)dv["ID"]; row.ItemID = src.ItemID; row.ItemCode = src.ItemCode; row.ItemName = src.ItemName; row.Quantity = src.Quantity; row.UnitPrice = src.UnitPrice; row.TaxPct = src.TaxPct; row.Remarks = src.Remarks; row.MeasureCode = src.MeasureCode; dsCore1.OrderDetails.AddOrderDetailsRow(row); } // redraw grid _grid.Redraw = true; _grid.Refresh(); // recalculate order value c1Label1.Value = CountDetails(); } catch (Exception ex) { // textfile logging Logger.ErrorRoutine(ex); // screen logging RibbonMessageBox.Show("ERROR Retrieving Detail Data: \n" + ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }
/// <summary> /// GetOrdersAssignedToDriver /// Function to Get Orders Assigned To Driver /// </summary> /// <param name="loadNo">Load number</param> /// <param name="session">Session object</param> /// <returns>List of Order Assigned</returns> public static List <DAL.OrderDetailsRow> GetOrdersAssignedToDriver(String loadNo, ISession session, String VersionNo = "") { try { OrderDetailsTableAdapter ta = new OrderDetailsTableAdapter(); ta.CurrentConnection = session; return(ta.GetOrdersAssignedToDriver(loadNo).Select().Cast <DAL.OrderDetailsRow>().ToList()); } catch (Exception ex) { throw; } }
protected void Page_Load(object sender, EventArgs e) { btnDelete.PostBackUrl = "OrderingDelete.aspx/?id=" + Request.QueryString["id"]; btnEdit.PostBackUrl = "OrderingEdit.aspx/?id=" + Request.QueryString["id"]; try { OrderDetailsTableAdapter daOrd = new OrderDetailsTableAdapter(); daOrd.Fill(dsOrd.OrderDetails, Convert.ToInt32(Request.QueryString["id"])); DataRow row = dsOrd.OrderDetails.Rows[0]; txtNum.Text = row.ItemArray[1].ToString(); txtDate.Text = ((DateTime)row.ItemArray[2]).ToShortDateString(); txtPaid.Text = (bool)row.ItemArray[3] ? "Yes" : "No"; txtArrive.Text = ((DateTime)row.ItemArray[4]).ToShortDateString(); } catch { } }