Exemplo n.º 1
0
        public static List<Telephones> Telephones_GetAll()
        {
            string query = "Telephones_GetAll";

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

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

              for (int i = 0; i < dt.Rows.Count; i++)
              {
            Telephones tmp = new Telephones();
            tmp.ID            = Convert.ToInt32(dt.Rows[i]["ID"].ToString());
            tmp.CustomerID    = Convert.ToInt32(dt.Rows[i]["CustomerID"].ToString());
            tmp.TelType       = Convert.ToInt32(dt.Rows[i]["TelType"].ToString());
            tmp.TelNo         = dt.Rows[i]["TelNo"].ToString();
            tmp.Status        = (Status)Convert.ToInt32(dt.Rows[i]["Status"].ToString());

            res.Add(tmp);
              }

              return res;
        }
Exemplo n.º 2
0
        public static List<Telephones> Telephones_GetByCustomerID(long customerID)
        {
            string query = "Telephones_GetByCustomerID";

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

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

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

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

              for (int i = 0; i < dt.Rows.Count; i++)
              {
            Telephones tmp = new Telephones();
            tmp.ID = Convert.ToInt32(dt.Rows[i]["ID"].ToString());
            tmp.CustomerID = Convert.ToInt32(dt.Rows[i]["CustomerID"].ToString());
            tmp.TelType = Convert.ToInt32(dt.Rows[i]["TelType"].ToString());
            tmp.TelNo = dt.Rows[i]["TelNo"].ToString();
            tmp.Status = (Status)Convert.ToInt32(dt.Rows[i]["Status"].ToString());

            res.Add(tmp);
              }

              return res;
        }
Exemplo n.º 3
0
 private void btnTelSave_Click(object sender, EventArgs e)
 {
     if (this.customerID == 0L)
       {
     Telephones telephones = new Telephones();
     telephones.CustomerID = 0L;
     telephones.Status = Status.Active;
     telephones.TelNo = this.txtTel.Text;
     if (this.lbTelephoneTypes.SelectedItems.Count == 0)
     {
       int num = (int)MessageBox.Show("Telefon Tipi Seçiniz");
     }
     else
     {
       telephones.TelType = ((TelTypes)this.lbTelephoneTypes.SelectedItem).ID;
       for (int index = 0; index < this.tels.Count; ++index)
       {
     if (telephones.TelType == this.tels[index].TelType)
       this.tels.RemoveAt(index);
       }
       this.tels.Add(telephones);
     }
       }
       else
     Telephones.Telephones_Insert(this.customerID, ((TelTypes)this.lbTelephoneTypes.SelectedItem).ID, this.txtTel.Text, 2);
 }