Exemple #1
0
        public bool delete(tonkhodto tonkho)
        {
            string delete = string.Format("delete from TONKHO where MANHAPHANG= @manh");

            SqlParameter[] sqlParameters = new SqlParameter[1];
            sqlParameters[0]       = new SqlParameter("@manh", SqlDbType.NVarChar, 15);
            sqlParameters[0].Value = tonkho.Manhaphang;
            return(conn.executeDeleteQuery(delete, sqlParameters));
        }
        private void luutonkhobtn_Click(object sender, EventArgs e)
        {
            tonkhodto tkdto = new tonkhodto();

            tkdto.Manhaphang  = madonnhaplbl.Text;
            tkdto.Mavp        = masplbl.Text;
            tkdto.Ngayhethan  = ngayhethan.Value.Date.ToShortDateString();
            tkdto.Soluongnhap = Convert.ToInt32(soluongnhap.Value);
            tkdto.Soluongton  = tkdto.Soluongnhap;
            tonkhobus tkbus = new tonkhobus();

            tkbus.add(tkdto);
            thongtindonnhapdgv.DataSource = tkbus.listtonkho(tkdto.Manhaphang);
        }
Exemple #3
0
        public bool update(tonkhodto tonkho)
        {
            string update = string.Format("update TONKHO SET MAVP= @mavp, NGAYHETHAN= @ngayhethan, SOLUONGNHAP= @slnhap, SOLUONGTON= @slton WHERE MANHAPHANG = @manh");

            SqlParameter[] sqlParameters = new SqlParameter[5];
            sqlParameters[0]       = new SqlParameter("@mavp", SqlDbType.Int);
            sqlParameters[0].Value = Convert.ToString(tonkho.Mavp);
            sqlParameters[1]       = new SqlParameter("@ngayhethan", SqlDbType.Date);
            sqlParameters[1].Value = Convert.ToString(tonkho.Ngayhethan);
            sqlParameters[2]       = new SqlParameter("@slnhap", SqlDbType.Int);
            sqlParameters[2].Value = Convert.ToString(tonkho.Soluongnhap);
            sqlParameters[3]       = new SqlParameter("@slton", SqlDbType.Int);
            sqlParameters[3].Value = Convert.ToString(tonkho.Soluongton);
            sqlParameters[4]       = new SqlParameter("@manh", SqlDbType.NVarChar, 15);
            sqlParameters[4].Value = Convert.ToString(tonkho.Manhaphang);
            return(conn.executeUpdateQuery(update, sqlParameters));
        }
Exemple #4
0
        public bool add(tonkhodto tonkho)
        {
            string insert = string.Format("insert into TONKHO (MANHAPHANG,MAVP,NGAYHETHAN,SOLUONGNHAP,SOLUONGTON) values (@manh,@mavp,@ngayhethan,@slnhap,@slton)");

            SqlParameter[] sqlParameters = new SqlParameter[5];
            sqlParameters[0]       = new SqlParameter("@manh", SqlDbType.NVarChar, 15);
            sqlParameters[0].Value = Convert.ToString(tonkho.Manhaphang);
            sqlParameters[1]       = new SqlParameter("@mavp", SqlDbType.Int);
            sqlParameters[1].Value = Convert.ToString(tonkho.Mavp);
            sqlParameters[2]       = new SqlParameter("@ngayhethan", SqlDbType.Date);
            sqlParameters[2].Value = Convert.ToString(tonkho.Ngayhethan);
            sqlParameters[3]       = new SqlParameter("@slnhap", SqlDbType.Int);
            sqlParameters[3].Value = Convert.ToString(tonkho.Soluongnhap);
            sqlParameters[4]       = new SqlParameter("@slton", SqlDbType.Int);
            sqlParameters[4].Value = Convert.ToString(tonkho.Soluongton);
            return(conn.executeInsertQuery(insert, sqlParameters));
        }
 public bool delete(tonkhodto tonkho)
 {
     return(tkd.delete(tonkho));
 }
 public bool update(tonkhodto tonkho)
 {
     return(tkd.update(tonkho));
 }
 public bool add(tonkhodto tonkho)
 {
     return(tkd.add(tonkho));
 }