/// <summary> /// Creates a new instance of the Sol_WS_Carriers class and populates it with data from the specified SqlDataReader. /// </summary> protected virtual Sol_WS_Carrier MakeSol_WS_Carrier(SqlDataReader dataReader) { Sol_WS_Carrier sol_WS_Carrier = new Sol_WS_Carrier(); sol_WS_Carrier.CarrierID = SqlClientUtility.GetInt32(dataReader, "CarrierID", 0); sol_WS_Carrier.Carrier = SqlClientUtility.GetString(dataReader, "Carrier", String.Empty); return(sol_WS_Carrier); }
/// <summary> /// Updates a record in the Sol_WS_Carriers table. /// </summary> public virtual void Update(Sol_WS_Carrier sol_WS_Carrier) { ValidationUtility.ValidateArgument("sol_WS_Carrier", sol_WS_Carrier); SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@CarrierID", sol_WS_Carrier.CarrierID), new SqlParameter("@Carrier", sol_WS_Carrier.Carrier) }; SqlClientUtility.ExecuteNonQuery(connectionStringName, CommandType.StoredProcedure, "Sol_WS_Carriers_Update", parameters); }
/// <summary> /// Selects all records from the Sol_WS_Carriers table. /// </summary> public virtual List <Sol_WS_Carrier> SelectAll() { using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader(connectionStringName, CommandType.StoredProcedure, "Sol_WS_Carriers_SelectAll")) { List <Sol_WS_Carrier> sol_WS_CarrierList = new List <Sol_WS_Carrier>(); while (dataReader.Read()) { Sol_WS_Carrier sol_WS_Carrier = MakeSol_WS_Carrier(dataReader); sol_WS_CarrierList.Add(sol_WS_Carrier); } return(sol_WS_CarrierList); } }
private void buttonPrintRBill_Click(object sender, EventArgs e) { dataGridViewCurrentShipment.Focus(); if (dataGridViewCurrentShipment.SelectedRows.Count < 1) { MessageBox.Show("Please select a Shipment to print", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } RBillNumber = dataGridViewCurrentShipment.SelectedRows[0].Cells[0].Value.ToString(); string status = dataGridViewCurrentShipment.SelectedRows[0].Cells[3].Value.ToString(); string strShipmentId = dataGridViewCurrentShipment.SelectedRows[0].Cells[5].Value.ToString(); string agencyName = dataGridViewCurrentShipment.SelectedRows[0].Cells[1].Value.ToString(); string rBillDate = dataGridViewCurrentShipment.SelectedRows[0].Cells[2].Value.ToString(); if (status != "S") { MessageBox.Show("Only shipped Shipments can be printed.", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } this.Cursor = Cursors.WaitCursor; if (agencyName.Trim().ToLower() == "abcrc") { int shipmentId = 0; Int32.TryParse(strShipmentId, out shipmentId); if (sol_Shipment_Sp == null) { sol_Shipment_Sp = new Sol_Shipment_Sp(Properties.Settings.Default.WsirDbConnectionString); } sol_Shipment = sol_Shipment_Sp.Select(shipmentId); if (sol_WS_Carrier_Sp == null) { sol_WS_Carrier_Sp = new Sol_WS_Carrier_Sp(Properties.Settings.Default.WsirDbConnectionString); } sol_WS_Carrier = sol_WS_Carrier_Sp.Select(sol_Shipment.CarrierID); if (sol_WS_Carrier == null) { sol_WS_Carrier = new Sol_WS_Carrier(); sol_WS_Carrier.CarrierID = 0; sol_WS_Carrier.Carrier = String.Empty; } ShippingShipments.UpdateDataSetBol2(shipmentId, RBillNumber); ShippingShipments.PrintBol2( shipmentId, RBillNumber, sol_Shipment.ShippedDate.ToString(), sol_WS_Carrier.Carrier, sol_Shipment.TrailerNumber, sol_Shipment.ProBillNumber ); } else { ShippingShipments.PrintRBill(strShipmentId); } this.Cursor = Cursors.Default; }