Ejemplo n.º 1
0
        /// <summary>
        /// Hàm cập nhật kíp nổ
        /// </summary>
        /// <param name="value">kíp nổ cần cập nhật</param>
        /// <returns>bool</returns>
        public static bool CapNhatKipNo(KipNo value)
        {
            String     sql  = "UPDATE KipNo SET TenKipNo = '" + value.TenKipNo + "', ThoiGianViSai = '" + value.ThoiGianViSai + "', DonViTinh_KN = '" + value.DonViTinh_KN + "', GiaThanh_KN = '" + value.GiaThanh_KN + "' WHERE MaKipNo = '" + value.MaKipNo + "'";
            Connection conn = new Connection();

            return(conn.SetData(sql));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Hàm thêm kíp nổ
        /// </summary>
        /// <param name="value">kíp nổ cần thêm</param>
        /// <returns>bool</returns>
        public static bool ThemKipNo(KipNo value)
        {
            String     sql  = "INSERT INTO KipNo (MaKipNo, TenKipNo, ThoiGianViSai, DonViTinh_KN, GiaThanh_KN) VALUES ('" + value.MaKipNo + "', '" + value.TenKipNo + "', '" + value.ThoiGianViSai + "', '" + value.DonViTinh_KN + "', '" + value.GiaThanh_KN + "')";
            Connection conn = new Connection();

            return(conn.SetData(sql));
        }
 /// <summary>
 /// Hàm lấy thông tin kíp nổ
 /// </summary>
 /// <param name="id">mã kíp nổ</param>
 /// <returns>KipNo</returns>
 public static KipNo KipNo(String id)
 {
     KipNo kipNo = new KipNo();
     Connection conn = new Connection();
     string sql = "SELECT * FROM KipNo WHERE MaKipNo = '" + id + "'";
     SQLiteDataReader dr = conn.GetData(sql);
     while (dr.Read())
     {
         kipNo = new KipNo(dr["MaKipNo"].ToString(), dr["TenKipNo"].ToString(), dr["ThoiGianViSai"].ToString(), dr.GetDouble(3), dr.GetDouble(4));
     }
     return kipNo;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Hàm lấy thông tin kíp nổ
        /// </summary>
        /// <param name="id">mã kíp nổ</param>
        /// <returns>KipNo</returns>
        public static KipNo KipNo(String id)
        {
            KipNo            kipNo = new KipNo();
            Connection       conn  = new Connection();
            string           sql   = "SELECT * FROM KipNo WHERE MaKipNo = '" + id + "'";
            SQLiteDataReader dr    = conn.GetData(sql);

            while (dr.Read())
            {
                kipNo = new KipNo(dr["MaKipNo"].ToString(), dr["TenKipNo"].ToString(), dr["ThoiGianViSai"].ToString(), dr.GetDouble(3), dr.GetDouble(4));
            }
            return(kipNo);
        }
 private void buttonInsert_Click(object sender, EventArgs e)
 {
     KipNo insert = new KipNo();
     insert.MaKipNo = textBoxMaKipNo2.Text;
     insert.TenKipNo = textBoxTenKipNo2.Text;
     insert.ThoiGianViSai = textBoxThoiGianViSai2.Text;
     if (textBoxDonViTinh2.Text != String.Empty) { insert.DonViTinh_KN = double.Parse(textBoxDonViTinh2.Text); }
     if (textBoxGiaThanh2.Text != String.Empty) { insert.GiaThanh_KN = double.Parse(textBoxGiaThanh2.Text); }
     try
     {
         BS_KipNo.ThemKipNo(insert);
     }
     catch (Exception exc)
     {
         MessageBox.Show("Lỗi - " + exc.Message);
     }
     ShowPanel(1);
     HienThiDuLieu_KipNo();
 }
 /// <summary>
 /// Hàm cập nhật kíp nổ
 /// </summary>
 /// <param name="value">kíp nổ cần cập nhật</param>
 /// <returns>bool</returns>
 public static bool CapNhatKipNo(KipNo value)
 {
     String sql = "UPDATE KipNo SET TenKipNo = '" + value.TenKipNo + "', ThoiGianViSai = '" + value.ThoiGianViSai + "', DonViTinh_KN = '" + value.DonViTinh_KN + "', GiaThanh_KN = '" + value.GiaThanh_KN + "' WHERE MaKipNo = '" + value.MaKipNo + "'";
     Connection conn = new Connection();
     return conn.SetData(sql);
 }
 /// <summary>
 /// Hàm thêm kíp nổ
 /// </summary>
 /// <param name="value">kíp nổ cần thêm</param>
 /// <returns>bool</returns>
 public static bool ThemKipNo(KipNo value)
 {
     String sql = "INSERT INTO KipNo (MaKipNo, TenKipNo, ThoiGianViSai, DonViTinh_KN, GiaThanh_KN) VALUES ('" + value.MaKipNo + "', '" + value.TenKipNo + "', '" + value.ThoiGianViSai + "', '" + value.DonViTinh_KN + "', '" + value.GiaThanh_KN + "')";
     Connection conn = new Connection();
     return conn.SetData(sql);
 }