This is a migrated thread and some comments may be shown as answers.

Can't find XXXCompletedEventArgs in Reference.cs in Radcontrol WPF Application

0 Answers 19 Views
DataServiceDataSource
This is a migrated thread and some comments may be shown as answers.
Berrabah
Top achievements
Rank 1
Berrabah asked on 20 Aug 2012, 06:28 PM

Hi, I am not sure that's true cause I Use this WCF : 

Interface : 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace WcfServiceHotel
{
[ServiceContract]
public interface IServiceHotel
{

[OperationContract]
List<UserDetail> GetUserDetail(int id);

[OperationContract]
String InsertUserDetail(UserDetail userinfo);

[OperationContract]
List<UserDetail> GetAllHotel();

}

[DataContract]
public class UserDetail
{
int _id = 0;
string _Nom = String.Empty;
string _Ville = String.Empty;

[DataMember]
public int Id
{
get { return _id; }
/*private*/ set { _id = value; }
}

[DataMember]
public string Nom
{
get { return _Nom; }
set { _Nom = value; }

}

[DataMember]
public string Ville
{
get { return _Ville; }
set { _Ville = value; }
}

}

}

Class : 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.Data.SqlClient;
using System.Data;

namespace WcfServiceHotel
{
public class ServiceHotel2 : IServiceHotel
{
SqlConnection con = new SqlConnection("Data Source=.\\SqlEXPRESS;Initial Catalog=GestionHotel;Integrated Security=True");

public List<UserDetail> GetUserDetail(int id)
{
List<UserDetail> userdetail = new List<UserDetail>();
{
con.Open();
SqlCommand cmd = new SqlCommand("Select * from HotelIdentite where Id = @id", con);
// SqlCommand cmd = new SqlCommand("Select * from HotelIdentite where Id like '%'+@id+'%'", con);
cmd.Parameters.AddWithValue("@id", id);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
UserDetail userInfo = new UserDetail();
userInfo.Nom = dt.Rows[i]["Nom"].ToString();
userInfo.Ville = dt.Rows[i]["Ville"].ToString();
userdetail.Add(userInfo);
}
}
con.Close();
}
return userdetail;
}

public List<UserDetail> GetAllHotel()
{
List<UserDetail> usd = new List<UserDetail>();
{
con.Open();
SqlCommand cmd = new SqlCommand("Select Id,Nom,Ville From HotelIdentite", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
UserDetail ud = new UserDetail();
ud.Id = int.Parse(dt.Rows[i]["Id"].ToString());
ud.Nom = dt.Rows[i]["Nom"].ToString();
ud.Ville = dt.Rows[i]["Ville"].ToString();
usd.Add(ud);
}
}
con.Close();
}
return usd;
}

public string InsertUserDetail(UserDetail userinfo)
{
string strMessage = string.Empty;
con.Open();
SqlCommand cmd = new SqlCommand("Insert into HotelIdentite (Nom,Ville) Values (@Nom,@Ville)", con);
cmd.Parameters.AddWithValue("@Nom", userinfo.Nom);
cmd.Parameters.AddWithValue("@Ville", userinfo.Ville);
int result = cmd.ExecuteNonQuery();
if (result == 1)
{
strMessage = userinfo.Id + " Details inserted successfully";
}
else
{
strMessage = userinfo.Id + " Details not inserted successfully";
}
con.Close();
return strMessage;
}

//public override string ToString(int index, [OptionalField] int id,[OptionalField] UserDetail userinfo)
//{
// string result;
// switch (index)
// {
// case 1:
// GetUserDetail(id);
// break; 
// case 2 :
// InsertUserDetail(userinfo);
// break;
// }

// return result;
//}
}
}

So for implemente I use two client : a Windows phone and WPF

for the WPF client the GetAllHotelCompletedEventArgs is missing and the same thing for the others methods and all the methods are not VOID :

Help me please 
Tahnk you 

No answers yet. Maybe you can help?

Tags
DataServiceDataSource
Asked by
Berrabah
Top achievements
Rank 1
Share this question
or