navigation pane using c++ in blackberry cascades - blackberry

Am using Json web service to get response
When i press a button i have to push to new page when respone is success else have to show a toast -- already registerd
I will get response either "Email id already registered" or "Registered success"
When i get Registered Suceess only i have to push new page
Please help...
CPP FILE
ApplicationUI::ApplicationUI(bb::cascades::Application *app) :
QObject(app)
, m_succeeded(false)
, m_active(false)
{
QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
qml->setContextProperty("app", this);
//qml->setContextProperty("second", m_pane);
m_root = qml->createRootObject<AbstractPane>();
m_pane = new NavigationPane;
app->setScene(m_root);
}
void ApplicationUI::sendRequest()
{
if (m_active)
return;
m_active = true;
emit activeChanged();
m_succeeded = false;
QNetworkAccessManager* networkAccessManager = new QNetworkAccessManager(this);
QNetworkRequest request(m_urllink);
QNetworkReply* reply = networkAccessManager->get(request);
bool ok = connect(reply, SIGNAL(finished()), this, SLOT(onFinished()));
Q_ASSERT(ok);
Q_UNUSED(ok);
}
void ApplicationUI::onFinished()
{
m_succeeded = true;
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
QString response;
if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 200)
{
JsonDataAccess jda;
QVariantMap map = jda.loadFromBuffer(reply->readAll()).toMap();
QVariantList addresses = map["RegistrationResult"].toList();
qDebug() <<"Full Result is = "<<map["RegistrationResult"].toString();
QString m_temperature;
QString result;
result = map["RegistrationResult"].toString();
m_temperature=result.section(':', 0, 0);
m_urlResult = result;
emit urlResultChanged();
qDebug()<<m_urlResult;
qDebug()<<"\n\n\n";
if(result == "EMAIL ID ALREADY EXISTS")
{
qDebug() << " New Registration Result is " <<m_temperature;
qDebug() <<map["RegistrationResult"].toString();
}
else if(result != "EMAIL ID ALREADY EXISTS")
{
QString empid;
QString empid_no;
QString::SectionFlag flag = QString::SectionSkipEmpty;
result = map["RegistrationResult"].toString();
//empid=m_temperature.section(':', 1, 1);
empid_no = map["RegistrationResult"].toString();;
empid_no=empid_no.section(':', 2, 2);
qDebug()<<"Emd ID = "<<empid_no;
qDebug()<<"Company ID"<<result.section(':', 4, 4);
QmlDocument *qml = QmlDocument::create("asset:///second.qml").parent(this);
Page *new_Page = qml->createRootObject<Page>();
m_pane->push(new_Page);
**?????????????????????????????**
}
main.qml
import bb.cascades 1.2
import bb.system 1.2
import "controls"
NavigationPane {
id: navigation
Page {
titleBar: TitleBar {
id: mainPage
title: "ERS"
}
Container
{
id: mainContainer
Button {
id: next
text: "NEXT"
onClicked: {
app.clickedButton(cnametxt.text,hrtxt.text,emailtxt.text,addresstxt.text,phnotxt.text,pwdtxt.text,vhclnotxt.text,vhclmodeltxt.text,urltxt.text);
app.sendRequest();
mainContainer.urlresult(); // to push page am using javascript
}
}
Label {
id: urlresulttxt
text: app.urlResult
visible: app.urlResult=="EMAIL ID ALREADY EXISTS"
textStyle.color: Color.Red
}
function urlresult()
{
if (app.urlResult != "EMAIL ID ALREADY EXISTS" && app.urlResult != null )
{
toast.body = "Success"
toast.show();
var page = nextPage.createObject();
navigation.push(page);
}
else if (app.urlResult == "EMAIL ID ALREADY EXISTS") {
toast.body = "EMAIL ID ALREADY EXISTS"
toast.show();
}
}
attachedObjects: [
ComponentDefinition {
id: nextPage
source: "second.qml"
},
SystemToast {
id: toast
}
]
} //container
} // page
} // nav

Try this:
In your main.qml name a objectname for navigationpane like:
NavigationPane {
id: navigation
objectName: "mynavigation"
In your applicationui.cpp constructor change this lines:
m_root = qml->createRootObject<AbstractPane>();
m_pane = m_root->findChild<NavigationPane*>("mynavigation");
change these lines too after constructing second.qml:
QmlDocument *qml = QmlDocument::create("asset:///second.qml").parent(this);
qml->setContextProperty("app", this);
Page *new_Page = qml->createRootObject<Page>();
m_pane->push(new_Page);
CPP FILE:
ApplicationUI::ApplicationUI(bb::cascades::Application *app) :
QObject(app)
, m_succeeded(false)
, m_active(false)
{
QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
qml->setContextProperty("app", this);
//qml->setContextProperty("second", m_pane);
m_root = qml->createRootObject<AbstractPane>();
m_pane = m_root->findChild<NavigationPane*>("mynavigation"); // changed
app->setScene(m_root);
}
void ApplicationUI::sendRequest()
{
if (m_active)
return;
m_active = true;
emit activeChanged();
m_succeeded = false;
QNetworkAccessManager* networkAccessManager = new QNetworkAccessManager(this);
QNetworkRequest request(m_urllink);
QNetworkReply* reply = networkAccessManager->get(request);
bool ok = connect(reply, SIGNAL(finished()), this, SLOT(onFinished()));
Q_ASSERT(ok);
Q_UNUSED(ok);
}
void ApplicationUI::onFinished()
{
m_succeeded = true;
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
QString response;
if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 200)
{
JsonDataAccess jda;
QVariantMap map = jda.loadFromBuffer(reply->readAll()).toMap();
QVariantList addresses = map["RegistrationResult"].toList();
qDebug() <<"Full Result is = "<<map["RegistrationResult"].toString();
QString m_temperature;
QString result;
result = map["RegistrationResult"].toString();
m_temperature=result.section(':', 0, 0);
m_urlResult = result;
emit urlResultChanged();
qDebug()<<m_urlResult;
qDebug()<<"\n\n\n";
if(result == "EMAIL ID ALREADY EXISTS")
{
qDebug() << " New Registration Result is " <<m_temperature;
qDebug() <<map["RegistrationResult"].toString();
}
else if(result != "EMAIL ID ALREADY EXISTS")
{
QString empid;
QString empid_no;
QString::SectionFlag flag = QString::SectionSkipEmpty;
result = map["RegistrationResult"].toString();
//empid=m_temperature.section(':', 1, 1);
empid_no = map["RegistrationResult"].toString();;
empid_no=empid_no.section(':', 2, 2);
qDebug()<<"Emd ID = "<<empid_no;
qDebug()<<"Company ID"<<result.section(':', 4, 4);
QmlDocument *qml = QmlDocument::create("asset:///second.qml").parent(this);
qml->setContextProperty("app", this); // changed
Page *new_Page = qml->createRootObject<Page>();
m_pane->push(new_Page);
**?????????????????????????????**
}

Related

Youtube Livestream Api LiveChatMessages List

Im trying to get the Messages from a Youtube Livestream, works, but i dont get new Messages. The NextPageToken is included.
Sometimes i get new messages, but it takes arround 5-10min.
Youtube Chat Sending works also fine.
Any Idea?
This is from the Docs: https://developers.google.com/youtube/v3/live/docs/liveChatMessages/list
private async Task GetMessagesAsync(string liveChatId, string nextPageToken, long? pollingIntervalMillis)
{
liveChatId = "EiEKGFVDVUQ3WGNXTk92SlpvaHFMM3dZTi1uZxIFL2xpdmU";
if (!updatingChat)
{
if (!string.IsNullOrEmpty(liveChatId))
{
newMessages = true;
var chatMessages = youTubeService.LiveChatMessages.List(liveChatId, "id,snippet,authorDetails");
var chatResponse = await chatMessages.ExecuteAsync();
PageInfo pageInfo = chatResponse.PageInfo;
newMessages = false;
if (pageInfo.TotalResults.HasValue)
{
if (!prevCount.Equals(pageInfo.TotalResults.Value))
{
prevCount = pageInfo.TotalResults.Value;
newMessages = true;
}
}
if (newMessages)
{
Messages = new List<YouTubeMessage>();
foreach (var chatMessage in chatResponse.Items)
{
string messageId = chatMessage.Id;
string displayName = chatMessage.AuthorDetails.DisplayName;
string displayMessage = chatMessage.Snippet.DisplayMessage;
string NextPagetoken = chatResponse.NextPageToken;
YouTubeMessage message = new YouTubeMessage(messageId, displayName, displayMessage);
if (!Messages.Contains(message))
{
Messages.Add(message);
string output = "[" + displayName + "]: " + displayMessage;
Console.WriteLine(time + output);
}
}
}
await GetMessagesAsync(liveChatId, chatResponse.NextPageToken, chatResponse.PollingIntervalMillis);
}
}
updatingChat = false;
await Task.Delay(100);
}
public async Task YouTubeChatSend(string message)
{
try
{
LiveChatMessage liveMessage = new LiveChatMessage();
liveMessage.Snippet = new LiveChatMessageSnippet()
{
LiveChatId = "EiEKGFVDVUQ3WGNXTk92SlpvaHFMM3dZTi1uZxIFL2xpdmU",
Type = "textMessageEvent",
TextMessageDetails = new LiveChatTextMessageDetails() { MessageText = message }
};
var insert = this.youTubeService.LiveChatMessages.Insert(liveMessage, "snippet");
var response = await insert.ExecuteAsync();
if (response != null)
{
}
}
catch
{
Console.WriteLine("Failed to chat send");
}
}

while sending and receiving telnet stream asynchronously, while loop hangs the telnet emulator

I am working on telnet emulator in web using mvc with signalR, while sending and receiving telnet stream asynchronously while loop hangs the page if kept for long, does not finish. Tried many solution but no luck.
Below is code where it stuck while continuously looking for stream bytes.
/// <summary>
/// Wait for data from the telnet server and send it to the emulation.
/// </summary>
public async Task ReadLoop(string connectionId, BaseDecoder decoder, CancellationToken ct, string PanelId)
{
var client = Get(connectionId);
if (client == null) { return; }
string script = string.Empty;
if (string.IsNullOrWhiteSpace(panelScript))
{
panelScript = objAccn.ExecuteQueryPanelScript(Convert.ToInt32(PanelId)).ToString();
script = panelScript.Replace(#"\n", Environment.NewLine);
commands = Regex.Split(script, "\r\n");
}
string loginPrompt = null;
if (PanelId != "1")
loginPrompt = "login: ";
else
loginPrompt = "name?: ";
var login = commands[0];// WebConfigurationManager.AppSettings["login"];
if (!_panelCommands.ContainsKey(0))
_panelCommands.Add(0, true);
var passwordPrompt = WebConfigurationManager.AppSettings["passwordPrompt"];
var password = commands[1];//WebConfigurationManager.AppSettings["password"];
if (!_panelCommands.ContainsKey(1))
_panelCommands.Add(1, true);
var loginAuto = (!String.IsNullOrEmpty(loginPrompt) && !String.IsNullOrEmpty(login));
var passwordAuto = (!String.IsNullOrEmpty(passwordPrompt) && !String.IsNullOrEmpty(password));
var DefaultCommandsForm60 = false;
var DefaultCommandsForm50 = false;
var DefaultScreenm50 = false;
decoder.ScriptFunc = async (string str) =>
{
if (!String.IsNullOrEmpty(str))
{
if (loginAuto && str.EndsWith(loginPrompt, StringComparison.Ordinal))
{
await client.StreamWriter.WriteAsync(login + "\r\n");
loginAuto = false;
str = str.Remove(str.Length - loginPrompt.Length);
}
if (passwordAuto && str.EndsWith(passwordPrompt, StringComparison.Ordinal))
{
await client.StreamWriter.WriteAsync(password + "\r\n");
passwordAuto = false;
str = str.Remove(str.Length - passwordPrompt.Length);
if (PanelId != "1")
DefaultCommandsForm60 = true;
else
DefaultCommandsForm50 = true;
//System.Threading.Thread.Sleep(1500);
}
if (PanelId != "1")
{
if (DefaultCommandsForm60)
{
System.Threading.Thread.Sleep(1500);
await client.StreamWriter.WriteAsync(commands[2] + "\r\n");
if (commands.Length > 2)
{
System.Threading.Thread.Sleep(1500);
await client.StreamWriter.WriteAsync(commands[3] + "\r\n");
}
if (commands.Length > 3)
{
System.Threading.Thread.Sleep(1500);
await client.StreamWriter.WriteAsync(commands[4] + "\r\n");
}
DefaultCommandsForm60 = false;
}
}
else
{
if (DefaultCommandsForm50)
{
if (commands.Length > 1)
{
// System.Threading.Thread.Sleep(2500);
if (!_panelCommands.ContainsKey(3))
{
// System.Threading.Thread.Sleep(1500);
await client.StreamWriter.WriteAsync(commands[3] + "\r\n");
_panelCommands.Add(3, true);
}
else
{
if (commands.Length > 2)
{
if (!_panelCommands.ContainsKey(4))
{
// System.Threading.Thread.Sleep(1500);
await client.StreamWriter.WriteAsync(commands[3] + "\r\n");
_panelCommands.Add(4, true);
}
DefaultCommandsForm50 = false;
}
}
DefaultScreenm50 = true;
}
}
else
{
if (DefaultScreenm50)
if (str.EndsWith("$ "))
{
await client.StreamWriter.WriteAsync("Screen" + "\r\n");
str = str.Remove(str.Length - ("$ ").Length);
DefaultScreenm50 = false;
}
}
}
}
return str;
};
const int bufferSize = 4096;
//if (ns.CanRead)
//{
// byte[] readBuffer = new byte[1024];
// int numBytesRead = 0;
// do
// {
// numBytesRead = ns.Read(readBuffer, 0, readBuffer.Length);
// //var data = Encoding.UTF8.GetString(readBuffer);
// // ss= Encoding.GetEncoding(1252).GetString(readBuffer.ToArray());
// //sb.Append(readBuffer[0].ToString);
// sb.AppendFormat("{0}", Encoding.ASCII.GetString(readBuffer, 0, numBytesRead));
// sb.Replace(Convert.ToChar(24), ' ');
// sb.Replace(Convert.ToChar(255), ' ');
// sb.Replace('?', ' ');
// //sb.Replace(Environment.NewLine, "<br />").ToString();
// }
// while (ns.DataAvailable);
//}
//if (client._stream.CanRead)
//{
// do
// {
// var inBytes = await client.ReadAsync(bufferSize, ct);
// foreach (var b in inBytes)
// {
// await decoder.AddByte(b);
// }
// await decoder.Flush();
// } while (client.IsConnected );
////}
//Disconnect(connectionId);
//var readTask = client.ReadAsync(bufferSize, ct);
while (client.IsConnected && !ct.IsCancellationRequested)
{
if (client._stream.CanRead)
{
var inBytes = await client.ReadAsync(bufferSize, ct);
foreach (var b in inBytes)
{
await decoder.AddByte(b);
}
await decoder.Flush();
}
}
Disconnect(connectionId);
}
}
In above method here the part of code where it stuck and never comes to an end.
while (client.IsConnected && !ct.IsCancellationRequested)
{
if (client._stream.CanRead)
{
var inBytes = await client.ReadAsync(bufferSize, ct);
foreach (var b in inBytes)
{
await decoder.AddByte(b);
}
await decoder.Flush();
}
}
Disconnect(connectionId);
Any suggestion and help would be appreciable!

How to add text input field in cocos2d.Android cocos sharp?

I am trying to get CCTextFieldTTF to work in cocos sharp with Xamarin for an android application. But can't get hold of this for the life of me. Could not find any documentation on cocos sharp API either. Does anyone know how to use this class to render a text area in an android application? The reason I am asking is in a xamarin forum I saw someone saying that this does not work in the API yet. Any help would be highly appreciated. Thanks in advance.
I have this working in android
Here is the sample code:
Create a node to track the textfield
CCTextField trackNode;
protected CCTextField TrackNode
{
get { return trackNode; }
set
{
if (value == null)
{
if (trackNode != null)
{
DetachListeners();
trackNode = value;
return;
}
}
if (trackNode != value)
{
DetachListeners();
}
trackNode = value;
AttachListeners();
}
}
//create the actual input textfield
var textField = new CCTextField(string.Empty, "Somefont", 25, CCLabelFormat.SystemFont);
textField.IsColorModifiedByOpacity = false;
textField.Color = new CCColor3B(Theme.TextWhite);
textField.BeginEditing += OnBeginEditing;
textField.EndEditing += OnEndEditing;
textField.Position = new CCPoint (0, 0);
textField.Dimensions = new CCSize(VisibleBoundsWorldspace.Size.Width - (160 * sx), vPadding);
textField.PlaceHolderTextColor = Theme.TextYellow;
textField.PlaceHolderText = Constants.TextHighScoreEnterNamePlaceholder;
textField.AutoEdit = true;
textField.HorizontalAlignment = CCTextAlignment.Center;
textField.VerticalAlignment = CCVerticalTextAlignment.Center;
TrackNode = textField;
TrackNode.Position = pos;
AddChild(textField);
// Register Touch Event
var touchListener = new CCEventListenerTouchOneByOne();
touchListener.OnTouchBegan = OnTouchBegan;
touchListener.OnTouchEnded = OnTouchEnded;
AddEventListener(touchListener);
// The events
bool OnTouchBegan(CCTouch pTouch, CCEvent touchEvent)
{
beginPosition = pTouch.Location;
return true;
}
void OnTouchEnded(CCTouch pTouch, CCEvent touchEvent)
{
if (trackNode == null)
{
return;
}
var endPos = pTouch.Location;
if (trackNode.BoundingBox.ContainsPoint(beginPosition) && trackNode.BoundingBox.ContainsPoint(endPos))
{
OnClickTrackNode(true);
}
else
{
OnClickTrackNode(false);
}
}
public void OnClickTrackNode(bool bClicked)
{
if (bClicked && TrackNode != null)
{
if (!isKeyboardShown)
{
isKeyboardShown = true;
TrackNode.Edit();
}
}
else
{
if (TrackNode != null)
{
TrackNode.EndEdit();
}
}
}
private void OnEndEditing(object sender, ref string text, ref bool canceled)
{
//((CCNode)sender).RunAction(scrollDown);
Console.WriteLine("OnEndEditing text {0}", text);
}
private void OnBeginEditing(object sender, ref string text, ref bool canceled)
{
//((CCNode)sender).RunAction(scrollUp);
Console.WriteLine("OnBeginEditing text {0}", text);
}
void AttachListeners()
{
// Attach our listeners.
var imeImplementation = trackNode.TextFieldIMEImplementation;
imeImplementation.KeyboardDidHide += OnKeyboardDidHide;
imeImplementation.KeyboardDidShow += OnKeyboardDidShow;
imeImplementation.KeyboardWillHide += OnKeyboardWillHide;
imeImplementation.KeyboardWillShow += OnKeyboardWillShow;
imeImplementation.InsertText += InsertText;
}
void DetachListeners()
{
if (TrackNode != null)
{
// Remember to remove our event listeners.
var imeImplementation = TrackNode.TextFieldIMEImplementation;
imeImplementation.KeyboardDidHide -= OnKeyboardDidHide;
imeImplementation.KeyboardDidShow -= OnKeyboardDidShow;
imeImplementation.KeyboardWillHide -= OnKeyboardWillHide;
imeImplementation.KeyboardWillShow -= OnKeyboardWillShow;
imeImplementation.InsertText -= InsertText;
}
}
This is all taken from the link below but needed a bit of additional work to get it working on each platform.
https://github.com/mono/cocos-sharp-samples/tree/master/TextField

Stream file from ftp in localhost working in azure no

Hi I using VisualStudio 2012 and I have created web site which reads info (from .csv) from external ftp site. When I running it on local host everything works fine, but then I deployed it to azure web sites it is not working, just show zeros everywhere were should be numbers. (Dont get info from ftp)
public static List<ApiClient.Models.StatsList> GetStatsData(string Ticket, DateTime start, DateTime end, int CampaignId, String CampaignName)
{
//--------------------------------------------------------------------------------------------------------
//Gets stats from GetAdsStats service (included: Banner id, impressions, and clicks)
//--------------------------------------------------------------------------------------------------------
List<ApiClient.Models.StatsList> FullList = GetAdStatsService.GetAdsStats(Ticket, start, end, CampaignId);
List<LikesDislikesList> LikeDislike = new List<LikesDislikesList>();
//--------------------------------------------------------------------------------------------------------
//
//--------------------------------------------------------------------------------------------------------
string day;
string month;
if (DateTime.Today.AddDays(-1).Day.ToString().Count() == 1)
{
day = "0" + DateTime.Today.AddDays(-1).Day;
}
else
{
day = DateTime.Today.AddDays(-1).Day.ToString();
}
if (DateTime.Today.Month.ToString().Count() == 1)
{
month = "0" + DateTime.Today.Month;
}
else
{
month = DateTime.Today.Month.ToString();
}
try
{
string uri = "ftp://siteAdres" + CampaignName.Replace(" ", "_") + "_Optimizing_events_" + day + "-" + month + "-" + DateTime.Today.Year + ".csv";
Uri serverUri = new Uri(uri);
if (serverUri.Scheme != Uri.UriSchemeFtp)
{
return FullList;
}
FtpWebRequest reqFTP;
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(uri));
reqFTP.Credentials = new NetworkCredential("username", "password");
reqFTP.KeepAlive = false;
reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
reqFTP.UseBinary = true;
reqFTP.Proxy = null;
reqFTP.UsePassive = false;
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
Stream responseStream = response.GetResponseStream();
StreamReader csvStream = new StreamReader(response.GetResponseStream());
//--------------------------------------------------------------------------------------------------------
//Read Likes/Dislikes from csv file stream
//--------------------------------------------------------------------------------------------------------
using (var rd = csvStream)
{
int iname = -1;
int ilikes = -1;
int idislikes = -1;
while (!rd.EndOfStream)
{
var raw = rd.ReadLine().Split((char)9);
if (rd.Peek() == -1)
{
break;
}
if (ilikes == -1 || idislikes == -1)
{
for (int i = 0; i < raw.Length; i++)
{
if (raw[i] == "Event name")
iname = i;
if (raw[i] == "Custom Event 14")
ilikes = i;
if (raw[i] == "Custom Event 15")
{
idislikes = i;
raw = rd.ReadLine().Split((char)9);
}
}
}
else
{
LikeDislike.Add(new LikesDislikesList() { Likes = Convert.ToInt32(raw[ilikes]), Dislikes = Convert.ToInt32(raw[idislikes]), Name = raw[iname] });
}
}
}
response.Close();
}
catch(Exception ex)
{
log4net.Config.XmlConfigurator.Configure();
log.Warn("GetAdStatsService.cs " + ex);
}
//--------------------------------------------------------------------------------------------------------
//Add like/dislike values for certain banners
//--------------------------------------------------------------------------------------------------------
foreach (var element in FullList)
{
foreach (var el in LikeDislike)
{
if (element.name == el.Name)
{
element.Likes = el.Likes;
element.Dislikes = el.Dislikes;
}
}
}
return FullList;
}
}
}
Check FtpWebResponse.StatusCode before calling response.GetResponseStream(). You are probably having come kind of connection error. My guess would be firewall settings on your Azure VM.

How Inserted IMAP services properties like Bcc , Cc and To in our data base

Function For Insert In Email Table and Email Id insert in Enmail Recipient table
public void InsertEmailsFromIMAP(string SelectMailBox, string Server, string AccountId, string Password, int DefaultPort, bool EnableSSL, int EmailFolderId, long EmailAccountId)
{
try
{
using (var imap = new AE.Net.Mail.ImapClient(Server, AccountId, Password, AE.Net.Mail.ImapClient.AuthMethods.Login, DefaultPort, EnableSSL))
{
imap.SelectMailbox(SelectMailBox);
MailMessage[] messagetrash = imap.GetMessages(0, 10, false);
foreach (MailMessage msgitemtrash in messagetrash)
{
EmailFolder objEmailfolder = db.EmailFolders.Where(EF => EF.EmailFolderId == EmailFolderId).FirstOrDefault();
Email objEmail = new Email();
objEmail = GetEmailsData(EmailAccountId, objEmailfolder.EmailFolderId, msgitemtrash.Subject, msgitemtrash.Body, msgitemtrash.Date, msgitemtrash.From.ToString());
db.Emails.AddObject(objEmail);
db.SaveChanges();
//WriteText("Bcc"+msgitemtrash.Bcc.ToString()+"<br>");
//WriteText("Ccc"+msgitemtrash.Cc.ToString()+"<br>");
//WriteText("To"+msgitemtrash.To.ToString());
long EmailId = objEmail.EmailId;
int EmailrecipientType = 0;
if (msgitemtrash.To.ToString() != "")
EmailrecipientType = 1;
else if (msgitemtrash.Bcc.ToString() != "")
EmailrecipientType = 2;
else if (msgitemtrash.Cc.ToString() != "")
EmailrecipientType = 3;
WriteText(EmailrecipientType.ToString());
WriteText(EmailId.ToString());
EmailRecipient objEmailRecipient = new EmailRecipient();
objEmailRecipient = GetEmailRecipientData(EmailId,EmailrecipientType );
db.EmailRecipients.AddObject(objEmailRecipient);
db.SaveChanges();
}
imap.Dispose();
}
}
catch(Exception ex)
{
WriteText(ex.ToString());
}
}
When Insert In Recipient table its giving error System.Collections.Generic.List. how to convert collection type and what type gave in database column name.

Resources