Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DataTable tb = tbBus.GetAll();

            //DataTable ltb = ltbBus.GetAll();
            //DataTable kh = khBus.GetByContact();
            //slcType.Items.Clear();


            //foreach (DataRow ltb_row in ltb.Rows)
            //{
            //    string text = ltb_row.ItemArray[1].ToString();
            //    string val = ltb_row.ItemArray[0].ToString();
            //    slcType.Items.Add(new ListItem(text, val));
            //}
            foreach (DataRow row in tb.Rows)
            {
                HtmlTableRow row2      = new HtmlTableRow();
                string       isDisable = "";
                if (row.ItemArray[4].ToString() == "0")
                {
                    isDisable = "disabled";
                }
                foreach (var item in row.ItemArray)
                {
                    var cell = new HtmlTableCell();

                    //var loai = this.
                    cell.InnerText = item.ToString();
                    if (row2.Cells.Count == 0)
                    {
                        cell.InnerHtml = "<input type='checkbox' runat='server' ID='chkSelected' value='" + item + "' " + isDisable + " />";
                    }
                    if (row2.Cells.Count == 2)
                    {
                        LoaiThietBiDTO loaiThietBiDTO = ltbBus.GetById(Convert.ToInt32(item));
                        cell.InnerText = loaiThietBiDTO.TypeName;
                    }


                    row2.Cells.Add(cell);
                }
                tbl_ThietBi.Controls.Add(row2);
            }
            //MaintainScrollPositionOnPostBack = false;
            //findKH.Attributes.Add("AutoPostback", "false");
            //btnFindKH.Attributes.Add("onclick", "return false");
        }
Esempio n. 2
0
        public void getProduct()
        {
            ThietBiBUS thietBiBus = new ThietBiBUS();
            DataTable  dtTB       = new DataTable();

            dtTB = thietBiBus.GetAll();
            List <string> listLoaiThietBi = getLoaiThietBi();

            foreach (DataRow row in dtTB.Rows)
            {
                int n = grvProduct.Rows.Add();
                grvProduct.Rows[n].Cells[0].Value = row[0].ToString();
                grvProduct.Rows[n].Cells[1].Value = row[1].ToString();

                var cellComboBox = new DataGridViewComboBoxCell();
                cellComboBox.DataSource           = listLoaiThietBi;
                grvProduct.Rows[n].Cells[2]       = cellComboBox;
                grvProduct.Rows[n].Cells[2].Value = listLoaiThietBi[Convert.ToInt32(row[2].ToString()) - 1];

                grvProduct.Rows[n].Cells[3].Value = row[3].ToString();
                grvProduct.Rows[n].Cells[4].Value = row[4].ToString();
            }
        }
Esempio n. 3
0
        public static List <ThietBiDTO> GetByName(string keyword)
        {
            List <ThietBiDTO> rs     = new List <ThietBiDTO>();
            ThietBiBUS        _tbBus = new ThietBiBUS();
            DataTable         tb     = _tbBus.GetAll();

            //if(keyword=="")
            //{
            //    foreach (DataRow row in tb.Rows)
            //    {

            //            int TBId = int.Parse(row.ItemArray[0].ToString());
            //            string TBName = row.ItemArray[1].ToString();
            //            int LTBId = int.Parse(row.ItemArray[2].ToString());
            //            int Price = int.Parse(row.ItemArray[3].ToString());
            //            int Qty = int.Parse(row.ItemArray[4].ToString());
            //            ThietBiDTO temp = new ThietBiDTO(TBId, TBName, LTBId, Price, Qty);
            //            rs.Add(temp);

            //    }
            //    return rs;
            //}
            foreach (DataRow row in tb.Rows)
            {
                if (row.ItemArray[1].ToString().ToUpper().Contains(keyword.ToUpper()))
                {
                    int        TBId   = int.Parse(row.ItemArray[0].ToString());
                    string     TBName = row.ItemArray[1].ToString();
                    int        LTBId  = int.Parse(row.ItemArray[2].ToString());
                    int        Price  = int.Parse(row.ItemArray[3].ToString());
                    int        Qty    = int.Parse(row.ItemArray[4].ToString());
                    ThietBiDTO temp   = new ThietBiDTO(TBId, TBName, LTBId, Price, Qty);
                    rs.Add(temp);
                }
            }
            return(rs);
        }