WCF Data Service to WinForm

  • Thread starter Thread starter Skrappy
  • Start date Start date
S

Skrappy

Guest
HI all,

Im green to both C# and WCF Data Services but I am trying to Build an application with 2 projects.

  1. WFC Application this is what I have so far:

public interface IService1
{

[OperationContract]
List<AssestsDetails> GetAssetsDetails(string fkUserID);

[OperationContract]
string InsertAsset(AssestsDetails ASSET);
[OperationContract]
string UpdateAsset(AssestsDetails ASSET);
[OperationContract]
string DeleteAsset(AssestsDetails ASSET);

// TODO: Add your service operations here
}


// Use a data contract as illustrated in the sample below to add composite types to service operations.
[DataContract]
public class AssestsDetails
{

int pkAssetID;
string Metadata = string.Empty;
string Name = string.Empty;
string ModelNumber = string.Empty;
string Manufacturer = string.Empty;
string Make = string.Empty;
string SerialNumber = string.Empty;
string Year = string.Empty;
string Asset_Comments = string.Empty;

#region Accessors
[DataMember]
public int AssetID
{
get { return pkAssetID; }
set { pkAssetID = value; }
}

[DataMember]
public string metaData
{
get { return Metadata; }
set { Metadata = value; }
}
[DataMember]
public string name
{
get { return Name; }
set { Name = value; }
}

[DataMember]
public string modelNumber
{
get { return ModelNumber; }
set { ModelNumber = value; }
}
[DataMember]
public string manufacturer
{
get { return Manufacturer; }
set { Manufacturer = value; }
}

[DataMember]
public string make
{
get { return Make; }
set { Make = value; }
}
[DataMember]
public string serialNumber
{
get { return SerialNumber; }
set { SerialNumber = value; }
}

[DataMember]
public string year
{
get { return Year; }
set { Year = value; }
}
[DataMember]
public string asset_comment
{
get { return Asset_Comments; }
set { Asset_Comments = value; }
}
#endregion

#region Constructors
public AssestsDetails(int AssetID, string Metadate, string Name, string ModelNumber, string Manufacturer, string Make,
string SerialNumber, string Year, string asset_comment)
{
this.pkAssetID = AssetID;
this.metaData = Metadata;
this.name = Name;
this.modelNumber = ModelNumber;
this.make = Make;
this.serialNumber = SerialNumber;
this.year = Year;
this.asset_comment = Asset_Comments;

SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ASMCon"].ConnectionString);
con.Open();
SqlCommand cmd = new SqlCommand("InsertAsset2", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@pkAssetID", SqlDbType.Int).Value = pkAssetID;

SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
dr.Read();
}


}
#endregion

#region Methods
public void UpdateAsset()
{

}
public void DeletAsset()
{

}
#endregion

}

service

public class Service1 : IService1
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ASMCon"].ConnectionString);

public List<AssestsDetails> GetAssetsDetails(string fkUserID)
{
List<AssestsDetails> AssetsDetails = new List<AssestsDetails>();
{
con.Open();
SqlCommand cmd = new SqlCommand("InsertAsset2", con);
cmd.CommandType = CommandType.StoredProcedure;
//cmd.Parameters.AddWithValue("@Metadata", Metadata);
}
}

string IService1.InsertAsset(AssestsDetails ASSET)
{
throw new NotImplementedException();
}

string IService1.UpdateAsset(AssestsDetails ASSET)
{
throw new NotImplementedException();
}

string IService1.DeleteAsset(AssestsDetails ASSET)
{
throw new NotImplementedException();
}

}

  1. winform application with;
  • login form with username and pw with validation (clueless here)
  • after the login is validated the application redirects the user to another form where the user can perform CRUD operations.

Thanks in advance


T.O.G.


Jodie

Continue reading...
 
Back
Top