/// <summary>
 /// khoi tao gia tri
 /// </summary>
 public TraLaiNhaCungCap()
 {
     tlncc = null;
     Sql = null;
     conn = null;
     cmd = null;
     arr = null;
     dr = null;
     tralainhacungcap = null;
     cn = null;
 }
Beispiel #2
0
        public Entities.TraLaiNCC[] SelectTLNCCTheoMaKho(string MaKho)
        {
            Entities.TraLaiNCC[] arrC = null;
            try
            {
                tlncc = new Constants.TraLaiNhaCungCap();

                string sql = "";
                sql = "Select * from TraLaiNCC where MaKho='" + MaKho + "' and Deleted=0";
                conn = new Connection();
                cn = conn.openConnection();
                cmd = new SqlCommand(sql, cn);
                dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                arr = new ArrayList();
                while (dr.Read())
                {
                    tralainhacungcap = new Entities.TraLaiNCC();
                    tralainhacungcap.TraLaiNCCID = Convert.ToInt32(dr[tlncc.TraLaiNCCID].ToString());
                    tralainhacungcap.MaHDTraLaiNCC = dr[tlncc.MaHDTraLaiNCC].ToString();
                    tralainhacungcap.Ngaytra = Convert.ToDateTime(dr[tlncc.Ngaytra].ToString());
                    tralainhacungcap.MaNCC = dr[tlncc.MaNCC].ToString();
                    tralainhacungcap.NoHienThoi = dr[tlncc.NoHienThoi].ToString();
                    tralainhacungcap.NguoiNhanHang = dr[tlncc.NguoiNhanHang].ToString();
                    tralainhacungcap.HinhThucThanhToan = dr[tlncc.HinhThucThanhToan].ToString();
                    tralainhacungcap.MaHoaDonNhap = dr[tlncc.MaHoaDonNhap].ToString();
                    tralainhacungcap.MaKho = dr[tlncc.MaKho].ToString();
                    tralainhacungcap.MaTienTe = dr[tlncc.MaTienTe].ToString();
                    tralainhacungcap.TienBoiThuong = dr[tlncc.TienBoiThuong].ToString();
                    tralainhacungcap.ThanhToanNgay = dr[tlncc.ThanhToanNgay].ToString();
                    tralainhacungcap.ThueGTGT = dr[tlncc.ThueGTGT].ToString();
                    tralainhacungcap.GhiChu = dr[tlncc.GhiChu].ToString();
                    tralainhacungcap.Deleted = Convert.ToBoolean(dr[tlncc.Deleted].ToString());
                    arr.Add(tralainhacungcap);
                }
                int n = arr.Count;
                if (n == 0) { return null; }
                arrC = new Entities.TraLaiNCC[n];
                for (int i = 0; i < n; i++)
                {
                    arrC[i] = (Entities.TraLaiNCC)arr[i];
                }
            }
            catch (Exception ex)
            { string s = ex.Message.ToString(); }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
            return arrC;
        }
 /// <summary>
 /// vuong hung =================xu ly don dat hang================
 /// </summary>
 /// <returns></returns>
 public int sp_XuLy_TraLaiNhaCungCap(Entities.TraLaiNCC ncc)
 {
     int Trave = 0;
     try
     {
         tlncc = new Constants.TraLaiNhaCungCap();
         Sql = new Constants.Sql();
         string sql = Sql.sp_XuLy_TraLaiNhaCungCap;
         conn = new Connection();
         cn = conn.openConnection();
         cmd = new SqlCommand(sql, cn);
         cmd.Parameters.Add(tlncc.HanhDong, SqlDbType.NVarChar, 20).Value = ncc.Hanhdong;
         cmd.Parameters.Add(tlncc.TraLaiNCCID, SqlDbType.Int).Value = ncc.TraLaiNCCID;
         cmd.Parameters.Add(tlncc.MaHDTraLaiNCC, SqlDbType.NVarChar, 20).Value = ncc.MaHDTraLaiNCC;
         cmd.Parameters.Add(tlncc.Ngaytra, SqlDbType.DateTime).Value = ncc.Ngaytra;
         cmd.Parameters.Add(tlncc.MaNCC, SqlDbType.NVarChar, 20).Value = ncc.MaNCC;
         cmd.Parameters.Add(tlncc.NoHienThoi, SqlDbType.Float).Value = ncc.NoHienThoi;
         cmd.Parameters.Add(tlncc.NguoiNhanHang, SqlDbType.NVarChar, 200).Value = ncc.NguoiNhanHang;
         cmd.Parameters.Add(tlncc.HinhThucThanhToan, SqlDbType.NVarChar, 200).Value = ncc.HinhThucThanhToan;
         cmd.Parameters.Add(tlncc.MaHoaDonNhap, SqlDbType.NVarChar, 20).Value = ncc.MaHoaDonNhap;
         cmd.Parameters.Add(tlncc.MaKho, SqlDbType.NVarChar, 20).Value = ncc.MaKho;
         cmd.Parameters.Add(tlncc.MaTienTe, SqlDbType.NVarChar, 20).Value = ncc.MaTienTe;
         cmd.Parameters.Add(tlncc.TienBoiThuong, SqlDbType.Float).Value = ncc.TienBoiThuong;
         cmd.Parameters.Add(tlncc.ThanhToanNgay, SqlDbType.Float).Value = ncc.ThanhToanNgay;
         cmd.Parameters.Add(tlncc.ThueGTGT, SqlDbType.Float).Value = ncc.ThueGTGT;
         cmd.Parameters.Add(tlncc.GhiChu, SqlDbType.NVarChar, 100).Value = ncc.GhiChu;
         cmd.Parameters.Add(tlncc.Deleted, SqlDbType.Bit).Value = ncc.Deleted;
         Trave = cmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     { string s = ex.Message.ToString(); }
     finally
     {
         cmd.Connection.Dispose();
         cn.Close();
         conn.closeConnection();
     }
     return Trave;
 }
 /// <summary>
 /// vuong hung =================================
 /// </summary>
 /// <param name="HanhDong"></param>
 /// <param name="PhieuThuID"></param>
 public int sp_Xoa_TraLaiNhaCungCap(Entities.TraLaiNCC ncc)
 {
     int Trave = 0;
     try
     {
         tlncc = new Constants.TraLaiNhaCungCap();
         Sql = new Constants.Sql();
         string sql = Sql.sp_Xoa_TraLaiNhaCungCap;
         conn = new Connection();
         cn = conn.openConnection();
         cmd = new SqlCommand(sql, cn);
         cmd.Parameters.Add(tlncc.HanhDong, SqlDbType.NVarChar, 20).Value = ncc.Hanhdong;
         cmd.Parameters.Add(tlncc.MaHDTraLaiNCC, SqlDbType.VarChar, 20).Value = ncc.MaHDTraLaiNCC;
         Trave = cmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     { string s = ex.Message.ToString(); }
     finally
     {
         cmd.Connection.Dispose();
         cn.Close();
         conn.closeConnection();
     }
     return Trave;
 }