private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Shipper shipper = new Shipper();
                int nextIden = ShipperBLL.GetCurrentIden() + 1;
                shipper.ShipperID = nextIden;
                shipper.Name = txtName.Text;
                int PlaceID = ((District)cbbPlace.SelectedItem).DistrictID;
                shipper.PlaceID = PlaceID;
                shipper.Phone = txtPhone.Text;
                ShipperBLL.AddShipper(shipper);
                System.Windows.Forms.MessageBox.Show("Successfully");
                if (AddFinished != null)
                {
                    AddFinished(shipper);
                }

            }
            catch (Exception g)
            {
                System.Windows.Forms.MessageBox.Show("Error: " + g.Message);
            }
            finally
            {
                this.Close();
            }
        }
Beispiel #2
0
 public static bool AddShipperName(Shipper shipper)
 {
     string sql = "spAddShipper";
     SqlParameter Name = new SqlParameter("Name", shipper.Name);
     SqlParameter PlaceID = new SqlParameter("PlaceID", shipper.PlaceID);
     SqlParameter Phone = new SqlParameter("Phone", shipper.Phone);
     return DataProvider.ExecuteNonQuery(sql, System.Data.CommandType.StoredProcedure,Name,PlaceID,Phone);
 }
Beispiel #3
0
 public static List<Shipper> SelectAllShipper()
 {
     List<Shipper> list = new List<Shipper>();
     string sql = "spSelectAllShipper";
     SqlDataReader rd=  DataProvider.ExecuteQueryWithDataReader(sql, System.Data.CommandType.StoredProcedure);
     DataTable dt = new DataTable();
     if (rd.HasRows)
     {
         while (rd.Read())
         {
             Shipper a = new Shipper();
             a.ShipperID = rd.GetInt32(0);
             a.Name = rd.GetString(1);
             a.PlaceID = rd.GetInt32(2);
             a.Phone = rd.GetString(3);
             list.Add(a);
         }
     }
     return list;
 }
Beispiel #4
0
 public static bool AddShipper(Shipper shipper)
 {
     return ShipperData.AddShipperName(shipper);
 }
        public void UpdateTable(Shipper shipper)
        {
            dt.Rows.Add(shipper.ShipperID, shipper.Name, shipper.PlaceID, shipper.Phone, true);

        }