예제 #1
0
 //---------------------------------------------------------------------------------------------------------//
 public static void Insert(ESANPHAM OSANPHAM)
 {
     SqlParameter[] pr = new SqlParameter[5];
     pr[0] = new SqlParameter(@"MASP", OSANPHAM.MASP);
     pr[1] = new SqlParameter(@"TENSP", OSANPHAM.TENSP);
     pr[2] = new SqlParameter(@"MAL", OSANPHAM.MAL);
     pr[3] = new SqlParameter(@"DONGIA", OSANPHAM.DONGIA);
     pr[4] = new SqlParameter(@"MOTA", OSANPHAM.MOTA);
     SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure, "SANPHAM_Insert", pr);
 }
예제 #2
0
        public ESANPHAM(string vMASP)
        {
            ESANPHAM OSANPHAM = BSANPHAM.SelectByID(vMASP);

            this.MASP   = OSANPHAM.MASP;
            this.TENSP  = OSANPHAM.TENSP;
            this.MAL    = OSANPHAM.MAL;
            this.DONGIA = OSANPHAM.DONGIA;
            this.MOTA   = OSANPHAM.MOTA;
        }
예제 #3
0
 private void btnThem_Click(object sender, EventArgs e)
 {
     ESANPHAM esp = new ESANPHAM();
     esp.MASP = txtma.Text.Trim();
     esp.TENSP = txtten.Text.Trim();
     esp.MAL = txtmal.Text.Trim();
     esp.DONGIA = float.Parse(txtgia.Text.Trim());
     esp.MOTA = txtmota.Text.Trim();
     BSANPHAM.Insert(esp);
     FormSanPham_Load(sender, e);
 }
예제 #4
0
 //---------------------------------------------------------------------------------------------------------//
 private static ESANPHAM GetOneSANPHAM(IDataReader idr)
 {
     ESANPHAM OSANPHAM = new ESANPHAM();
         if (idr["MASP"] != DBNull.Value)
             OSANPHAM.MASP = (string)idr["MASP"];
         if (idr["TENSP"] != DBNull.Value)
             OSANPHAM.TENSP = (string)idr["TENSP"];
         if (idr["MAL"] != DBNull.Value)
             OSANPHAM.MAL = (string)idr["MAL"];
         if (idr["DONGIA"] != DBNull.Value)
             OSANPHAM.DONGIA = (float)idr["DONGIA"];
         if (idr["MOTA"] != DBNull.Value)
             OSANPHAM.MOTA = (string)idr["MOTA"];
     return OSANPHAM;
 }
예제 #5
0
 public static ESANPHAM SelectByID(string MASP)
 {
     ESANPHAM OSANPHAM = new ESANPHAM();
     SqlParameter[] pr = new SqlParameter[1];
     pr[0] = new SqlParameter(@"MASP", MASP);
     IDataReader idr = SqlHelper.ExecuteReader(CommandType.StoredProcedure, "SANPHAM_SelectByID", pr);
     if (idr.Read())
         OSANPHAM = GetOneSANPHAM(idr);
     idr.Close();
     idr.Dispose();
     return OSANPHAM;
 }
예제 #6
0
 public static void Update(ESANPHAM OSANPHAM)
 {
     SqlParameter[] pr = new SqlParameter[5];
     pr[0] = new SqlParameter(@"MASP", OSANPHAM.MASP);
     pr[1] = new SqlParameter(@"TENSP", OSANPHAM.TENSP);
     pr[2] = new SqlParameter(@"MAL", OSANPHAM.MAL);
     pr[3] = new SqlParameter(@"DONGIA", OSANPHAM.DONGIA);
     pr[4] = new SqlParameter(@"MOTA", OSANPHAM.MOTA);
     DataAccseL.ExecuteNonQuery(CommandType.StoredProcedure, "SANPHAM_Update", pr);
 }