Beispiel #1
0
 public bool InsertTraHang(DonTraHang DTH)
 {
     try
     {
         SqlConnection conn = DBUtils.GetDBConnection();
         SqlCommand    com  = new SqlCommand("insert into LICHSU_TRA_NHACUNGCAP (MASP, NGAYTRA, SOLUONG, NVPHUTRACH, XACNHAN, NCC,LYDOTRA,QUANLY) values (@MASP,@NGAYTRA,@SOLUONG,@NVPHUTRACH,@XACNHAN,@NCC,@LYDOTRA,NULL)", conn);
         conn.Open();
         com.Parameters.AddWithValue("@MaSP", DTH.MaSp);
         com.Parameters.AddWithValue("@NGAYTRA", DTH.NgayTra);
         com.Parameters.AddWithValue("@SOLUONG", DTH.SoLuong);
         com.Parameters.AddWithValue("@NVPHUTRACH", DTH.NVPHUTRACH);
         com.Parameters.AddWithValue("@XACNHAN", DTH.XACNHAN);
         com.Parameters.AddWithValue("@NCC", DTH.NCC);
         com.Parameters.AddWithValue("@LYDOTRA", DTH.LydoTra);
         com.ExecuteNonQuery();
         conn.Close();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
        public bool CapNhatTinQuangCao(TinQC pTinQC)
        {
            string        query = "UPDATE dbo.TINDANG_QUANGCAO SET NOIDUNG = @noidung, NGAYSUA=@ngaysua WHERE ID=@id";
            SqlConnection conn  = DBUtils.GetDBConnection();

            try
            {
                conn.Open();
                DateTime   dtDate = DateTime.Today;
                SqlCommand cmd    = new SqlCommand(query, conn);
                cmd.Parameters.Add("@id", SqlDbType.Int).Value       = pTinQC.ID;
                cmd.Parameters.Add("@noidung", SqlDbType.Text).Value = pTinQC.NoiDung;
                cmd.Parameters.Add("@ngaysua", SqlDbType.Date).Value = dtDate.Date;

                cmd.ExecuteNonQuery();
                conn.Close();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Beispiel #3
0
 public bool InsertNhapHang(DonNhapHang DNH)
 {
     try
     {
         SqlConnection conn = DBUtils.GetDBConnection();
         SqlCommand    com  = new SqlCommand("insert into LICHSU_NHAP_NHACUNGCAP (MASP, NGAYNHAP, SOLUONG, NVPHUTRACH, XACNHAN, NCC,LYDONHAPHANG,QUANLY) values (@MASP,@NGAYNHAP,@SOLUONG,@NVPHUTRACH,@XACNHAN,@NCC,@LYDO,NULL)", conn);
         conn.Open();
         com.Parameters.AddWithValue("@MASP", DNH.Masp);
         com.Parameters.AddWithValue("@NGAYNHAP", DNH.NgayNhap);
         com.Parameters.AddWithValue("@SOLUONG", DNH.Soluong);
         com.Parameters.AddWithValue("@NVPHUTRACH", DNH.NVPhuTrach);
         com.Parameters.AddWithValue("@XACNHAN", DNH.XacNhan);
         com.Parameters.AddWithValue("@NCC", DNH.NCC);
         com.Parameters.AddWithValue("@LYDO", DNH.Lydo);
         com.ExecuteNonQuery();
         conn.Close();
         return(true);
     }
     catch
     {
         return(false);
     }
 }