示例#1
0
 private void btnAdressSave_Click(object sender, EventArgs e)
 {
     if (this.customerID == 0L)
       {
     Addresses addresses = new Addresses();
     addresses.Adress = this.txtAddress.Text;
     int num1 = 0;
     if (cbArea.SelectedItem == "Avrupa")
       num1 = 0;
     else if (cbArea.SelectedItem == "Anadolu")
       num1 = 1;
     addresses.Area = num1;
     addresses.CustomerID = 0;
     addresses.District = this.txtSemt.Text;
     if (this.lbAddressTypes.SelectedItems.Count == 0)
     {
       int num2 = (int)MessageBox.Show("Adres Tipi seçiniz");
     }
     else
     {
       addresses.Type = ((AddressType)this.lbAddressTypes.SelectedItem).ID;
       for (int index = 0; index < this.addresses.Count; ++index)
       {
     if (addresses.Type == this.addresses[index].Type)
       this.addresses.RemoveAt(index);
       }
       this.addresses.Add(addresses);
     }
       }
       else
       {
     int area = 0;
     if (cbArea.SelectedItem == "Avrupa")
       area = 0;
     else if (cbArea.SelectedItem == "Anadolu")
       area = 1;
     if (this.lbAddressTypes.SelectedItems.Count == 0)
     {
       int num = (int)MessageBox.Show("Adres Tipi seçiniz");
     }
     else
       Addresses.Addresses_Insert(this.customerID, ((AddressType)this.lbAddressTypes.SelectedItem).ID, this.txtAddress.Text, this.txtSemt.Text, area);
       }
 }
示例#2
0
        public static List<Addresses> Addresses_GetAll()
        {
            string query = "Addresses_GetAll";

              DataTable dt = Connection.runQuery(query, new SqlParameter[0]);

              List<Addresses> res = new List<Addresses>();

              for (int i = 0; i < dt.Rows.Count; i++)
              {
            Addresses tmp = new Addresses();

            tmp.CustomerID  = Convert.ToInt32(dt.Rows[i]["CustomerID"].ToString());
            tmp.District    = dt.Rows[i]["District"].ToString();
            tmp.Type        = Convert.ToInt32(dt.Rows[i]["Type"].ToString());
            tmp.Adress      = dt.Rows[i]["Adress"].ToString();
            tmp.Area        = Convert.ToInt32(dt.Rows[i]["Area"].ToString());

            res.Add(tmp);
              }

              return res;
        }
示例#3
0
        public static List<Addresses> Addresses_GetByCustomerID(long customerID)
        {
            string query = "Addresses_GetByCustomerID";

              List<SqlParameter> prms = new List<SqlParameter>();

              prms.Add(new SqlParameter("@CustomerID", customerID));

              DataTable dt = Connection.runQuery(query, prms.ToArray());

              List<Addresses> res = new List<Addresses>();

              for (int i = 0; i < dt.Rows.Count; i++)
              {
            Addresses tmp = new Addresses();

            tmp.CustomerID = Convert.ToInt32(dt.Rows[i]["CustomerID"].ToString());
            tmp.District = dt.Rows[i]["District"].ToString();
            tmp.Type = Convert.ToInt32(dt.Rows[i]["Type"].ToString());
            tmp.Adress = dt.Rows[i]["Adress"].ToString();
            tmp.Area = Convert.ToInt32(dt.Rows[i]["Area"].ToString());

            res.Add(tmp);
              }

              return res;
        }