Пример #1
0
 private void update()
 {
     if (this.txtNewName.TextLength <= 0 || MessageBox.Show("Güncellenicektir!!! Emin misiniz?", "Uyarı", MessageBoxButtons.YesNo) != DialogResult.Yes)
     return;
       ProductType productType = (ProductType)this.cbValues.SelectedItem;
       if (productType == null)
       {
     productType = new ProductType();
     productType.ID = 0;
       }
       ProductType.ProductTypes_Update(productType.ID, this.txtNewName.Text, this.txtUnit.Text);
       this.Fill();
 }
Пример #2
0
        public static List<ProductType> ProductTypes_GetAll()
        {
            string query = "ProductTypes_GetAll";

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

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

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

            tmp.ID = Convert.ToInt32(dt.Rows[i]["ID"].ToString());
            tmp.Name = dt.Rows[i]["Name"].ToString();
            tmp.UnitType = dt.Rows[i]["UnitType"].ToString();

            res.Add(tmp);
              }
              return res;
        }
Пример #3
0
        public static ProductType ProductTypes_getByID(int id)
        {
            string query = "ProductTypes_getByID";

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

              prms.Add(new SqlParameter("@ID", id));

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

              ProductType res = new ProductType();

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

            tmp.ID = Convert.ToInt32(dt.Rows[i]["ID"].ToString());
            tmp.Name = dt.Rows[i]["Name"].ToString();
            tmp.UnitType = dt.Rows[i]["UnitType"].ToString();

            res = tmp;
              }
              return res;
        }