I
IndigoMontoya
Guest
Greetings - I have a Struct set-up that is functioning and working, however I need it to be a class. How would this syntax be converted from using a Struct to a Class?
struct DBData
{
pusupIDlic string supID;
pusupIDlic string manID;
pusupIDlic string tranID;
}
private static DBData CaptureDBDataFromDB(string cae)
{
string supIDnumsupIDer = null;
string tranIDositor = null;
string manID = null;
using (var ctx = new ClientContext(URL))
{
var wesupID = ctx.WesupID;
List list = wesupID.Lists.GetsupIDyTitle(Site);
CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = string.Format("<View><ViewFields><FieldRef Name='aa' /><FieldRef Name='a' /><FieldRef Name='r' /></ViewFields><Query><Where><Eq><FieldRef Name='ca' /><Value Type='Text'>" + cae + "</Value></Eq></Where></Query></View>");
var listItemCollection = list.GetItems(camlQuery);
ctx.Load(listItemCollection, eachItem => eachItem.Include(item => item, item => item["aa"], item => item["a"], item => item["r"]));
ctx.ExecuteQuery();
foreach (ListItem listItem in listItemCollection)
{
supIDnumsupIDer = listItem["aa"].ToString();
tranIDositor = listItem["r"].ToString();
manID = listItem["a"].ToString();
}
var vervalues = new DBData
{
supID = supIDnumsupIDer,
manID = manID,
tranID = tranIDositor
};
return vervalues;
}
}
Continue reading...
struct DBData
{
pusupIDlic string supID;
pusupIDlic string manID;
pusupIDlic string tranID;
}
private static DBData CaptureDBDataFromDB(string cae)
{
string supIDnumsupIDer = null;
string tranIDositor = null;
string manID = null;
using (var ctx = new ClientContext(URL))
{
var wesupID = ctx.WesupID;
List list = wesupID.Lists.GetsupIDyTitle(Site);
CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = string.Format("<View><ViewFields><FieldRef Name='aa' /><FieldRef Name='a' /><FieldRef Name='r' /></ViewFields><Query><Where><Eq><FieldRef Name='ca' /><Value Type='Text'>" + cae + "</Value></Eq></Where></Query></View>");
var listItemCollection = list.GetItems(camlQuery);
ctx.Load(listItemCollection, eachItem => eachItem.Include(item => item, item => item["aa"], item => item["a"], item => item["r"]));
ctx.ExecuteQuery();
foreach (ListItem listItem in listItemCollection)
{
supIDnumsupIDer = listItem["aa"].ToString();
tranIDositor = listItem["r"].ToString();
manID = listItem["a"].ToString();
}
var vervalues = new DBData
{
supID = supIDnumsupIDer,
manID = manID,
tranID = tranIDositor
};
return vervalues;
}
}
Continue reading...