Ciao a tutti,
ho un problema che mi sta facendo diventare matto...
io ho un'applicazione in SL che legge da un DB....ora devo aggiornarla per fare in modo che scriva anche....quindi ho inserito nel mio servizio la mia nuova classe....aggiorno tutto.... ma la classe nuova non la vedo da nessuna parte!
i file sono questi...
Service1.svc.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.IO;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;
namespace MM_WEBTV_L.Web
{
// NOTE: If you change the class name "Service1" here, you must also update the reference to "Service1" in Web.config.
public class Service1 : IService1
{
#region IService1 Members
public List<String> CaricamentoFile(string _query, bool _file, bool _sede, bool _langITA)
{
List<String> l = new List<String>();
List<String> id = new List<String>();
List<String> nome = new List<String>();
//DirectoryInfo dir = new DirectoryInfo(@"C:\MMTV\video\Input\");
//FileInfo[] files = dir.GetFiles("*.wmv");
//foreach (FileInfo f in files)
// l.Add(f.Name);
//return l;
//l.Add("ciao11");
//return l;
try
{
SqlConnection _sqlConnection = new SqlConnection();
_sqlConnection.ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["SqlConnectionString"].ToString();
//_sqlConnection.ConnectionString = ConfigurationManager.ConnectionStrings["MMTVConnectionString"].ToString();
_sqlConnection.Open();
// EDU
if (!_sede)
{
//--------
SqlCommand select2 = new SqlCommand("SELECT * FROM PROGRAMMI", _sqlConnection);
SqlDataReader reader2 = select2.ExecuteReader();
while (reader2.Read())
{
id.Add(reader2[0].ToString());
nome.Add(reader2[1].ToString());
}
reader2.Close();
SqlCommand select = new SqlCommand(_query, _sqlConnection);
SqlDataReader reader = select.ExecuteReader();
while (reader.Read())
{
if (_file) //file video
{
string pippo = reader[1].ToString();
int index_prg = id.IndexOf(reader[1].ToString());
string prg = nome[index_prg].ToString();
String item;
if(_langITA) item = reader[2].ToString() + "@";
else
{
item = reader[13].ToString() + "@";
}
item += reader[6].ToString() + "@" + reader[9].ToString() + "@" + prg + "@";
if (_langITA) item += reader[3].ToString();
else
{
item += reader[4].ToString();
}
//l.Add(reader[2].ToString() + "@" + reader[6].ToString() + "@" + reader[9].ToString() + "@" + prg + "@" + reader[3].ToString());
l.Add(item);
}
else //programmi
{
l.Add(reader[0].ToString() + "@" + reader[1].ToString());
}
}
return l;
//--------------
}
else
{
SqlCommand select2 = new SqlCommand(_query, _sqlConnection);
SqlDataReader reader2 = select2.ExecuteReader();
while (reader2.Read())
{
l.Add(reader2[0].ToString() + "@" + reader2[1].ToString());
}
reader2.Close();
return l;
}
}
catch
{
return l;
}
}
public bool Caught_Click()
{
string nwConn = System.Configuration.ConfigurationManager.ConnectionStrings["MMTVConnectionString"].ConnectionString;
using (SqlConnection conn = new SqlConnection(nwConn))
{
const string sql = @"SELECT TOP 10 CustomerID, CompanyName, ContactName FROM Customers";
conn.Open();
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
SqlDataReader dr = cmd.ExecuteReader(
CommandBehavior.CloseConnection);
if (dr != null)
while (dr.Read())
{
}
return true;
}
}
}
#endregion
}
}
IService1.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.IO;
namespace MM_WEBTV_L.Web
{
// NOTE: If you change the interface name "IService1" here, you must also update the reference to "IService1" in Web.config.
[ServiceContract]
public interface IService1
{
[OperationContract]
List<String> CaricamentoFile(string query, bool file, bool sede, bool langITA);
[OperationContract]
bool Caught_Click();
}
}
la classe nuova si chiama Caught_Click()..... fatto questo vado sulla cartella "Service References" del progetto silverlight, aggiorno le referencs....va a buon fine.... ma quando poi vado ad esplorare i servizi...la mia classe nuova non la vedo mai...vedo semrpe e solo la classe "CaricamentoFile".... e non la vedo nemmeno quando vado sul servizio direttamente via web... ma dove sbaglio?