Esempio n. 1
0
        public List <PhieuXuat_DTO> TimKiemPX(string mapx)
        {
            List <PhieuXuat_DTO> ttpx = new List <PhieuXuat_DTO>();

            OpenConnection();
            SqlCommand cmd = new SqlCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "select * from PHIEUXUAT where MA_PX like N'%'+@MaPX+'%'";
            cmd.Connection  = conn;
            cmd.Parameters.Add("@MaPN", SqlDbType.VarChar).Value = mapx;
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                PhieuXuat_DTO px = new PhieuXuat_DTO();
                px.MaPX       = reader.GetString(0);
                px.NguoiNhan  = reader.GetString(1);
                px.NgayXuat   = reader.GetDateTime(2);
                px.DiaChi     = reader.GetString(3);
                px.GhiChuXuat = reader.GetString(4);
                ttpx.Add(px);
            }
            reader.Close();
            return(ttpx);
        }
Esempio n. 2
0
        public List <PhieuXuat_DTO> ThongTinPhieuXuat()
        {
            List <PhieuXuat_DTO> ttpx = new List <PhieuXuat_DTO>();

            OpenConnection();
            SqlCommand cmd = new SqlCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "select * from PHIEUXUAT";
            cmd.Connection  = conn;
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                PhieuXuat_DTO px = new PhieuXuat_DTO();
                px.MaPX       = reader.GetString(0);
                px.NguoiNhan  = reader.GetString(1);
                px.NgayXuat   = reader.GetDateTime(2);
                px.DiaChi     = reader.GetString(3);
                px.GhiChuXuat = reader.GetString(4);

                ttpx.Add(px);
            }
            if (reader != null)
            {
                reader.Close();
            }
            return(ttpx);
        }
        private void ktSuaPX()
        {
            try
            {
                PhieuXuat_DTO px = new PhieuXuat_DTO();
                px.MaPX       = txtMaPX.Text.Trim();
                px.NgayXuat   = DateTime.Parse(dtpNgayXuat.Text.ToString());
                px.NguoiNhan  = txtNguoiNhan.Text.Trim();
                px.DiaChi     = txtDiaChi.Text.Trim();
                px.GhiChuXuat = txtGhiChuXuat.Text.Trim();
                kiemtra_rong();

                if (pxBLL.SuaPhieuXuat(px))
                {
                    MessageBox.Show("Sửa thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Sửa không thành công!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                Load_PhieuXuat();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 public List <PhieuXuat_DTO> LayPhieuXuat()
 {
     try
     {
         List <PhieuXuat_DTO> listXuatHang = new List <PhieuXuat_DTO>();
         DataTable            data         = DataProvider.Instance.ExecuteQuery("LayPhieuXuat");
         foreach (DataRow item in data.Rows)
         {
             PhieuXuat_DTO xuatHang = new PhieuXuat_DTO(item);
             listXuatHang.Add(xuatHang);
         }
         return(listXuatHang);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
Esempio n. 5
0
        public bool SuaPhieuXuat(PhieuXuat_DTO pn)
        {
            OpenConnection();
            SqlCommand cmd = new SqlCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "update PHIEUXUAT set  NGUOI_NHAN=@NguoiNhan, NGAY_XUAT=@NgayXuat, DIA_CHI=@DiaChi, GHI_CHU_XUAT= @GhiChuXuat where MA_PX=@MaPX";
            cmd.Connection  = conn;
            cmd.Parameters.Add("@MaPX", SqlDbType.VarChar).Value        = pn.MaPX;
            cmd.Parameters.Add("@NguoiNhan", SqlDbType.NVarChar).Value  = pn.NguoiNhan;
            cmd.Parameters.Add("@NgayXuat", SqlDbType.DateTime).Value   = pn.NgayXuat;
            cmd.Parameters.Add("@DiaChi", SqlDbType.NVarChar).Value     = pn.DiaChi;
            cmd.Parameters.Add("@GhiChuXuat", SqlDbType.NVarChar).Value = pn.GhiChuXuat;
            int kq = cmd.ExecuteNonQuery();

            if (kq > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 6
0
        public bool ThemPhieuXuat(PhieuXuat_DTO pn)
        {
            OpenConnection();
            SqlCommand cmd = new SqlCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "insert into PHIEUXUAT values(@MaPX, @NguoiNhan, @NgayXuat, @DiaChi, @GhiChuXuat)";
            cmd.Connection  = conn;
            cmd.Parameters.Add("@MaPX", SqlDbType.VarChar).Value        = pn.MaPX;
            cmd.Parameters.Add("@NguoiNhan", SqlDbType.NVarChar).Value  = pn.NguoiNhan;
            cmd.Parameters.Add("@NgayXuat", SqlDbType.DateTime).Value   = pn.NgayXuat;
            cmd.Parameters.Add("@DiaChi", SqlDbType.NVarChar).Value     = pn.DiaChi;
            cmd.Parameters.Add("@GhiChuXuat", SqlDbType.NVarChar).Value = pn.GhiChuXuat;
            int kq = cmd.ExecuteNonQuery();

            if (kq > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 public bool SuaPhieuXuat(PhieuXuat_DTO px)
 {
     return(pxDAL.SuaPhieuXuat(px));
 }
 public bool ThemPhieuXuat(PhieuXuat_DTO px)
 {
     return(pxDAL.ThemPhieuXuat(px));
 }