Пример #1
0
 public Entities.KiemTraChung KiemTraMa(Entities.KiemTraChung giatri)
 {
     ve = new Entities.KiemTraChung();
     try
     {
         SqlDataReader read = null;
         Common.Constants.BienChung conten = new Common.Constants.BienChung();
         Sql = new Constants.Sql();
         string sql = Sql.sp_KiemTraMa;
         conn = new Connection();
         cn   = conn.openConnection();
         cmd  = new SqlCommand(sql, cn);
         cmd.Parameters.Add("MaHangHoa", SqlDbType.VarChar, 50).Value   = giatri.Khoachinh;
         cmd.Parameters.Add("TenHangHoa", SqlDbType.NVarChar, 50).Value = giatri.Name;
         read = cmd.ExecuteReader();
         while (read.Read())
         {
             ve.Hanhdong = read["ThongBao"].ToString();
         }
         read.Close();
     }
     catch (Exception ex)
     {
         string s = ex.Message.ToString();
     }
     finally
     {
         cmd.Connection.Dispose();
         cn.Close();
         conn.closeConnection();
     }
     return(ve);
 }
Пример #2
0
 /// <summary>
 /// lay ID
 /// </summary>
 /// <param name="giatri"></param>
 /// <returns></returns>
 public Entities.KiemTraChung[] LayCombox(Entities.KiemTraChung giatri)
 {
     Entities.KiemTraChung[] matrave = null;
     try
     {
         SqlDataReader read = null;
         Common.Constants.BienChung conten = new Common.Constants.BienChung();
         Sql = new Constants.Sql();
         string sql = "exec sp_LayCombox @tableName,@columnID,@columnName";
         conn = new Connection();
         cn   = conn.openConnection();
         cmd  = new SqlCommand(sql, cn);
         cmd.Parameters.Add("@tableName", SqlDbType.NVarChar, 20).Value  = giatri.Name;
         cmd.Parameters.Add("@columnID", SqlDbType.NVarChar, 20).Value   = giatri.Khoachinh;
         cmd.Parameters.Add("@columnName", SqlDbType.NVarChar, 20).Value = giatri.Giatri;
         read = cmd.ExecuteReader();
         ArrayList arr = new ArrayList();
         while (read.Read())
         {
             Entities.KiemTraChung kt = new Entities.KiemTraChung();
             kt.Khoachinh = read[0].ToString().ToUpper();
             kt.Giatri    = read[1].ToString();
             arr.Add(kt);
         }
         int n = arr.Count;
         if (n == 0)
         {
             return(null);
         }
         matrave = new Entities.KiemTraChung[n];
         for (int i = 0; i < n; i++)
         {
             matrave[i] = (Entities.KiemTraChung)arr[i];
         }
     }
     catch (Exception ex)
     {
         string s = ex.Message.ToString();
     }
     finally
     {
         cmd.Connection.Dispose();
         cn.Close();
         conn.closeConnection();
     }
     return(matrave);
 }
Пример #3
0
 /// <summary>
 /// lay ID
 /// </summary>
 /// <param name="giatri"></param>
 /// <returns></returns>
 public Entities.KiemTraChung[] LayThongTinTienTe()
 {
     Entities.KiemTraChung[] matrave = null;
     try
     {
         SqlDataReader read = null;
         Common.Constants.BienChung conten = new Common.Constants.BienChung();
         Sql = new Constants.Sql();
         string sql = "exec sp_LayThongTinTienTe";
         conn = new Connection();
         cn   = conn.openConnection();
         cmd  = new SqlCommand(sql, cn);
         read = cmd.ExecuteReader();
         ArrayList arr = new ArrayList();
         while (read.Read())
         {
             Entities.KiemTraChung kt = new Entities.KiemTraChung();
             kt.Khoachinh = read[0].ToString().ToUpper();
             kt.Giatri    = read[1].ToString();
             kt.Giatri2   = read[2].ToString();
             arr.Add(kt);
         }
         int n = arr.Count;
         if (n == 0)
         {
             return(null);
         }
         matrave = new Entities.KiemTraChung[n];
         for (int i = 0; i < n; i++)
         {
             matrave[i] = (Entities.KiemTraChung)arr[i];
         }
     }
     catch (Exception ex)
     {
         string s = ex.Message.ToString();
     }
     finally
     {
         cmd.Connection.Dispose();
         cn.Close();
         conn.closeConnection();
     }
     return(matrave);
 }
Пример #4
0
 /// <summary>
 /// lay ID
 /// </summary>
 /// <param name="giatri"></param>
 /// <returns></returns>
 public Entities.KiemTraChung[] LayThongTinTienTe()
 {
     Entities.KiemTraChung[] matrave = null;
     try
     {
         SqlDataReader read = null;
         Common.Constants.BienChung conten = new Common.Constants.BienChung();
         Sql = new Constants.Sql();
         string sql = "exec sp_LayThongTinTienTe";
         conn = new Connection();
         cn = conn.openConnection();
         cmd = new SqlCommand(sql, cn);
         read = cmd.ExecuteReader();
         ArrayList arr = new ArrayList();
         while (read.Read())
         {
             Entities.KiemTraChung kt = new Entities.KiemTraChung();
             kt.Khoachinh = read[0].ToString().ToUpper();
             kt.Giatri = read[1].ToString();
             kt.Giatri2 = read[2].ToString();
             arr.Add(kt);
         }
         int n = arr.Count;
         if (n == 0) { return null; }
         matrave = new Entities.KiemTraChung[n];
         for (int i = 0; i < n; i++)
         {
             matrave[i] = (Entities.KiemTraChung)arr[i];
         }
     }
     catch (Exception ex)
     {
         string s = ex.Message.ToString();
     }
     finally
     {
         cmd.Connection.Dispose();
         cn.Close();
         conn.closeConnection();
     }
     return matrave;
 }
Пример #5
0
 /// <summary>
 /// lay ID
 /// </summary>
 /// <param name="giatri"></param>
 /// <returns></returns>
 public Entities.KiemTraChung[] LayCombox(Entities.KiemTraChung giatri)
 {
     Entities.KiemTraChung[] matrave=null;
     try
     {
         SqlDataReader read = null;
         Common.Constants.BienChung conten = new Common.Constants.BienChung();
         Sql = new Constants.Sql();
         string sql = "exec sp_LayCombox @tableName,@columnID,@columnName";
         conn = new Connection();
         cn = conn.openConnection();
         cmd = new SqlCommand(sql, cn);
         cmd.Parameters.Add("@tableName", SqlDbType.NVarChar, 20).Value = giatri.Name;
         cmd.Parameters.Add("@columnID", SqlDbType.NVarChar, 20).Value = giatri.Khoachinh;
         cmd.Parameters.Add("@columnName", SqlDbType.NVarChar, 20).Value = giatri.Giatri;
         read = cmd.ExecuteReader();
         ArrayList arr = new ArrayList();
         while (read.Read())
         {
             Entities.KiemTraChung kt = new Entities.KiemTraChung();
             kt.Khoachinh = read[0].ToString().ToUpper();
             kt.Giatri = read[1].ToString();
             arr.Add(kt);
         }
         int n = arr.Count;
         if (n == 0) { return null; }
         matrave = new Entities.KiemTraChung[n];
         for (int i = 0; i < n; i++)
         {
             matrave[i] = (Entities.KiemTraChung)arr[i];
         }
     }
     catch (Exception ex)
     {
         string s = ex.Message.ToString();
     }
     finally
     {
         cmd.Connection.Dispose();
         cn.Close();
         conn.closeConnection();
     }
     return matrave;
 }
Пример #6
0
 public Entities.KiemTraChung KiemTraMa(Entities.KiemTraChung giatri)
 {
     ve = new Entities.KiemTraChung();
     try
     {
         SqlDataReader read = null;
         Common.Constants.BienChung conten = new Common.Constants.BienChung();
         Sql = new Constants.Sql();
         string sql = Sql.sp_KiemTraMa;
         conn = new Connection();
         cn = conn.openConnection();
         cmd = new SqlCommand(sql, cn);
         cmd.Parameters.Add("MaHangHoa", SqlDbType.VarChar, 50).Value = giatri.Khoachinh;
         cmd.Parameters.Add("TenHangHoa", SqlDbType.NVarChar, 50).Value = giatri.Name;
         read = cmd.ExecuteReader();
         while (read.Read())
         {
             ve.Hanhdong = read["ThongBao"].ToString();
         }
         read.Close();
     }
     catch (Exception ex)
     {
         string s = ex.Message.ToString();
     }
     finally
     {
         cmd.Connection.Dispose();
         cn.Close();
         conn.closeConnection();
     }
     return ve;
 }