Example #1
0
        public List <nl_DTO> getlistnl()
        {
            List <nl_DTO> group = new List <nl_DTO>();
            DataTable     table = DBconection.Instrance.ExecuteQuery("SELECT * FROM dbo.NGUYENLIEU");

            foreach (DataRow row in table.Rows)
            {
                nl_DTO nhom = new nl_DTO(row);
                group.Add(nhom);
            }
            return(group);
        }
 private void btn_Ghi_Click(object sender, EventArgs e)
 {
     try
     {
         if (txt_macthd.Text == string.Empty)
         {
             MessageBox.Show("Hãy nhập vào mã chi tiết hóa đơn");
         }
         else
         {
             if (textBox3.Text == string.Empty)
             {
                 MessageBox.Show("Hãy nhập vào mã hóa đơn");
             }
             else
             {
                 if (false)
                 {
                 }
                 else
                 {
                     nl_DTO nl = cbo_nguyenlieu.SelectedItem as nl_DTO;
                     if (hdn_DAO.Instance.insertct(int.Parse(txt_macthd.Text), int.Parse(textBox3.Text), nl.Manl, float.Parse(txt_soluong.Text)))
                     {
                         MessageBox.Show("Nhập thành công");
                         loadgridview();
                     }
                     else
                     {
                         MessageBox.Show("Nhập thất bại");
                     }
                 }
             }
         }
     }
     catch
     {
     }
 }