//-------------------------------------------------------------- //Get_ValidarCondicion.- Verifica si Hay registro en una tabla //-------------------------------------------------------------- public int Get_CountFila(string Table, string campo, string condicion) { BE_ReqValidaCondicion Request = new BE_ReqValidaCondicion(); DA_Sistema da = new DA_Sistema(); Request.Table = Table; Request.campo = campo; Request.condicion = condicion; return da.Get_ValidarCondicion(Request); }
//Get_ValidarCondicion public bool Get_ValidarCondicion(string Table, string campo, string condicion) { bool exito=false; BE_ReqValidaCondicion Request = new BE_ReqValidaCondicion(); DA_Sistema da = new DA_Sistema(); Request.Table = Table; Request.campo = campo; Request.condicion = condicion; if (da.Get_ValidarCondicion(Request) > 0) { exito = false; } else exito = true; return exito; }
//------------------------------------------------------------------------ //VERIFICANDO SI EXISTE DATA - VALIDANDO SI EXISTE REGISTRO FOR CONDICION //------------------------------------------------------------------------ public Int32 Get_ValidarCondicion(BE_ReqValidaCondicion Request) { Int32 nRegCant = 0; try { clsConection Obj = new clsConection(); string Cadena = Obj.GetConexionString("Naylamp"); using (SqlConnection cn = new SqlConnection(Cadena)) { cn.Open(); using (SqlCommand cm = new SqlCommand()) { cm.CommandText = "[usp_Get_ValidarCondicion]"; cm.CommandType = CommandType.StoredProcedure; cm.Parameters.AddWithValue("Table", Request.Table); cm.Parameters.AddWithValue("campo", Request.campo); cm.Parameters.AddWithValue("condicion", Request.condicion); cm.Connection = cn; SqlParameter pCount = new SqlParameter(); pCount.ParameterName = "nResultadof"; pCount.DbType = DbType.Int32; pCount.Direction = ParameterDirection.Output; cm.Parameters.Add(pCount); cm.ExecuteNonQuery(); nRegCant = Convert.ToInt32(cm.Parameters["nResultadof"].Value); } } } catch (Exception) { throw; } return nRegCant; }