Esempio n. 1
0
        void LoadData()
        {
            //IdItem = "3";
            ColorData();
            cbbGroupItem.DataSource    = _groupItem.GetDataGroupItem();
            cbbGroupItem.DisplayMember = "NAMEGROUP";
            cbbGroupItem.ValueMember   = "ID";

            cbbUnit.DataSource    = _unit.GetDataUnit();
            cbbUnit.DisplayMember = "NAME";
            cbbUnit.ValueMember   = "ID";
            if (IdItem != null)
            {
                DataTable item = _item.GetListItemFull_ToIdItem(IdItem); //Lay du lieu day du cua mot mat hang
                DataTable temp = _item.GetListContentItem_toId(IdItem);  //Lay chi tiet cua mat hang do
                for (int i = 0; i < temp.Rows.Count; i++)
                {
                    string   id     = temp.Rows[i][0].ToString();
                    string   name   = temp.Rows[i][1].ToString();
                    string   unit   = temp.Rows[i][2].ToString();
                    string   number = temp.Rows[i][3].ToString();
                    string[] row    = new string[] { id, name, unit, number };
                    dgv_ContentItem.Rows.Add(row);
                }
                txtID.Text        = item.Rows[0][1].ToString();
                txtName.Text      = item.Rows[0][4].ToString();
                txtPriceOut.Text  = item.Rows[0][6].ToString();
                txtRose.Text      = item.Rows[0][8].ToString();
                txtRoseRate.Text  = item.Rows[0][9].ToString();
                cbbGroupItem.Text = item.Rows[0][0].ToString();
                cbbUnit.Text      = item.Rows[0][5].ToString();
            }
            else
            {
                txtID.Text = (int.Parse(_item.CountIdItem()) + 1).ToString();
            }
        }