Exemplo n.º 1
0
        public bool addVP(ViPham_DTO VP)
        {
            string[] param  = { "@id_HocVien", "@id_NguoiGhi", "@ThoiGian", "@ChiTietLoi" };
            object[] values = { VP.Id_hocVien, VP.Id_nguoiGhi, VP.ThoiGian, VP.ChiTietLoi };
            string   query  = "insert into ViPham values(@id_HocVien,@id_NguoiGhi,@ThoiGian,@ChiTietLoi)";

            return(db.ExecuteNonQueryPara(query, param, values));
        }
Exemplo n.º 2
0
        private ViPham_DTO getdataVP()
        {
            ViPham_DTO vp = new ViPham_DTO();

            vp.Id_hocVien  = id_HV;
            vp.Id_nguoiGhi = id_NguoiGhi;
            vp.ThoiGian    = DateTime.Now;
            vp.ChiTietLoi  = rTxtChiTietLoi.Text;
            return(vp);
        }
Exemplo n.º 3
0
        public List <ViPham_DTO> LoadTatCaViPham()
        {
            try
            {
                List <ViPham_DTO> listViPham = new List <ViPham_DTO>();

                string query = "SELECT * FROM ViPham";

                DataTable data = DataProvider.Instance.ExecuteQuery(query);

                foreach (DataRow item in data.Rows)
                {
                    ViPham_DTO vp = new ViPham_DTO(item);
                    listViPham.Add(vp);
                }

                return(listViPham);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Exemplo n.º 4
0
 private void btnXacNhan_Click(object sender, EventArgs e)
 {
     if (rTxtChiTietLoi.Text == "")
     {
         MessageBox.Show("Bạn chưa nhập lỗi!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         ViPham_DTO vp = getdataVP();
         if (tLVP.addVP(vp))
         {
             DialogResult result = MessageBox.Show("Thêm lỗi thành công", "Thông báo", MessageBoxButtons.OK);
             if (result == System.Windows.Forms.DialogResult.OK)
             {
                 ThemLoi.ActiveForm.Close();
                 ShowQLHVRN(id_NguoiGhi);
             }
         }
         else
         {
             MessageBox.Show("Thêm lỗi thất bại!");
         }
     }
 }