public void SetDefaultFieldValues() { textBoxName.Text = ""; textBoxEdIzm.Text = ""; textBoxSrok.Text = ""; textBoxNormaVidachi.Text = ""; if (itemId == 0) { return; } clothesItem = ModelClothes.I().GetItem(itemId.ToString()); if (clothesItem != null) { Console.WriteLine(itemId); textBoxName.Text = clothesItem.Name; textBoxEdIzm.Text = clothesItem.EdIzm; textBoxSrok.Text = clothesItem.SrokNoski; textBoxNormaVidachi.Text = clothesItem.NormaVidachi; } else { MessageBox.Show("Произошла ошибка, обратитесь к админестратоору"); itemId = 0; textBoxName.Text = ""; } SetRubs(); }
public ClothesItem GetItem(string id) { OleDbDataReader item = ModelClothes.I().GetById(id.ToString()); if (item != null) { item.Read(); var rez = new ClothesItem() { Id = id.ToString(), PId = item["p_id"].ToString(), Name = item["name"].ToString(), EdIzm = item["ed_izm"].ToString(), SrokNoski = item["srok_noski"].ToString(), NormaVidachi = item["norma_vidachi"].ToString() }; return(rez); } return(null); }
public ClothesItem GetItemForOrder(string id) { var sql = "c.id = " + id; var sqlRez = GetItemsForOrder(sql); if (sqlRez != null) { sqlRez.Read(); Console.WriteLine(sqlRez["parent_name"].ToString() + " sqlRez[parent_name].ToString(),"); var rez = new ClothesItem() { Id = sqlRez["id"].ToString(), PId = sqlRez["p_id"].ToString(), Name = sqlRez["name"].ToString(), EdIzm = sqlRez["ed_izm"].ToString(), SrokNoski = sqlRez["srok_noski"].ToString(), ParentName = sqlRez["parent_name"].ToString(), NormaVidachi = sqlRez["norma_vidachi"].ToString(), }; return(rez); } return(null); }