Is there any way to add Sales Tax Item using QBFC?
Example:
Sales Tax A
4%
Sales Tax B
10%
I can add it easily from Quickbooks, but I need a way to add from external application using QBFC.
Any help will be greatly appreciated.
You can find a good example in the On Screen Reference.
At the top of the screen choose ItemSalesTaxAdd from the "Select Message" dropdown. From there click on the C# tab and you will see the following sample code:
//The following sample code is generated as an illustration of
//Creating requests and parsing responses ONLY
//This code is NOT intended to show best practices or ideal code
//Use at your most careful discretion
using System;
using System.Net;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using Interop.QBFC10;
namespace com.intuit.idn.samples
{
public class Sample
{
public void DoItemSalesTaxAdd()
{
bool sessionBegun = false;
bool connectionOpen = false;
QBSessionManager sessionManager = null;
try
{
//Create the session Manager object
sessionManager = new QBSessionManager();
//Create the message set request object to hold our request
IMsgSetRequest requestMsgSet = sessionManager.CreateMsgSetRequest("US",1,.0);
requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue;
BuildItemSalesTaxAddRq(requestMsgSet);
//Connect to QuickBooks and begin a session
sessionManager.OpenConnection("","Sample Code from OSR");
connectionOpen = true;
sessionManager.BeginSession("", ENOpenMode.omDontCare);
sessionBegun = true;
//Send the request and get the response from QuickBooks
IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet);
//End the session and close the connection to QuickBooks
sessionManager.EndSession();
sessionBegun = false;
sessionManager.CloseConnection();
connectionOpen = false;
WalkItemSalesTaxAddRs(responseMsgSet);
}
catch (Exception e)
{
MessageBox.Show(e.Message, "Error");
if (sessionBegun)
{
sessionManager.EndSession();
}
if (connectionOpen)
{
sessionManager.CloseConnection();
}
}
}
void BuildItemSalesTaxAddRq(IMsgSetRequest requestMsgSet)
{
IItemSalesTaxAdd ItemSalesTaxAddRq= requestMsgSet.AppendItemSalesTaxAddRq();
//Set field value for Name
ItemSalesTaxAddRq.Name.SetValue("ab");
//Set field value for BarCodeValue
ItemSalesTaxAddRq.BarCode.BarCodeValue.SetValue("ab");
//Set field value for AssignEvenIfUsed
ItemSalesTaxAddRq.BarCode.AssignEvenIfUsed.SetValue(true);
//Set field value for AllowOverride
ItemSalesTaxAddRq.BarCode.AllowOverride.SetValue(true);
//Set field value for IsActive
ItemSalesTaxAddRq.IsActive.SetValue(true);
//Set field value for ListID
ItemSalesTaxAddRq.ClassRef.ListID.SetValue("200000-1011023419");
//Set field value for FullName
ItemSalesTaxAddRq.ClassRef.FullName.SetValue("ab");
//Set field value for ItemDesc
ItemSalesTaxAddRq.ItemDesc.SetValue("ab");
//Set field value for TaxRate
ItemSalesTaxAddRq.TaxRate.SetValue(20.00);
//Set field value for ListID
ItemSalesTaxAddRq.TaxVendorRef.ListID.SetValue("200000-1011023419");
//Set field value for FullName
ItemSalesTaxAddRq.TaxVendorRef.FullName.SetValue("ab");
//Set field value for ExternalGUID
ItemSalesTaxAddRq.ExternalGUID.SetValue(Guid.NewGuid().ToString());
//Set field value for IncludeRetElementList
//May create more than one of these if needed
ItemSalesTaxAddRq.IncludeRetElementList.Add("ab");
}
void WalkItemSalesTaxAddRs(IMsgSetResponse responseMsgSet)
{
if (responseMsgSet == null) return;
IResponseList responseList = responseMsgSet.ResponseList;
if (responseList == null) return;
//if we sent only one request, there is only one response, we'll walk the list for this sample
for (int i=0; i<responseList.Count; i++)
{
IResponse response = responseList.GetAt(i);
//check the status code of the response, 0=ok, >0 is warning
if (response.StatusCode >= 0)
{
//the request-specific response is in the details, make sure we have some
if (response.Detail != null)
{
//make sure the response is the type we're expecting
ENResponseType responseType = (ENResponseType)response.Type.GetValue();
if (responseType == ENResponseType.rtItemSalesTaxAddRs)
{
//upcast to more specific type here, this is safe because we checked with response.Type check above
IItemSalesTaxRet ItemSalesTaxRet = (IItemSalesTaxRet)response.Detail;
WalkItemSalesTaxRet(ItemSalesTaxRet);
}
}
}
}
}
void WalkItemSalesTaxRet(IItemSalesTaxRet ItemSalesTaxRet)
{
if (ItemSalesTaxRet == null) return;
//Go through all the elements of IItemSalesTaxRet
//Get value of ListID
string ListID1 = (string)ItemSalesTaxRet.ListID.GetValue();
//Get value of TimeCreated
DateTime TimeCreated2 = (DateTime)ItemSalesTaxRet.TimeCreated.GetValue();
//Get value of TimeModified
DateTime TimeModified3 = (DateTime)ItemSalesTaxRet.TimeModified.GetValue();
//Get value of EditSequence
string EditSequence4 = (string)ItemSalesTaxRet.EditSequence.GetValue();
//Get value of Name
string Name5 = (string)ItemSalesTaxRet.Name.GetValue();
//Get value of BarCodeValue
if (ItemSalesTaxRet.BarCodeValue != null)
{
string BarCodeValue6 = (string)ItemSalesTaxRet.BarCodeValue.GetValue();
}
//Get value of IsActive
if (ItemSalesTaxRet.IsActive != null)
{
bool IsActive7 = (bool)ItemSalesTaxRet.IsActive.GetValue();
}
if (ItemSalesTaxRet.ClassRef != null)
{
//Get value of ListID
if (ItemSalesTaxRet.ClassRef.ListID != null)
{
string ListID8 = (string)ItemSalesTaxRet.ClassRef.ListID.GetValue();
}
//Get value of FullName
if (ItemSalesTaxRet.ClassRef.FullName != null)
{
string FullName9 = (string)ItemSalesTaxRet.ClassRef.FullName.GetValue();
}
}
//Get value of ItemDesc
if (ItemSalesTaxRet.ItemDesc != null)
{
string ItemDesc10 = (string)ItemSalesTaxRet.ItemDesc.GetValue();
}
//Get value of TaxRate
if (ItemSalesTaxRet.TaxRate != null)
{
double TaxRate11 = (double)ItemSalesTaxRet.TaxRate.GetValue();
}
if (ItemSalesTaxRet.TaxVendorRef != null)
{
//Get value of ListID
if (ItemSalesTaxRet.TaxVendorRef.ListID != null)
{
string ListID12 = (string)ItemSalesTaxRet.TaxVendorRef.ListID.GetValue();
}
//Get value of FullName
if (ItemSalesTaxRet.TaxVendorRef.FullName != null)
{
string FullName13 = (string)ItemSalesTaxRet.TaxVendorRef.FullName.GetValue();
}
}
//Get value of ExternalGUID
if (ItemSalesTaxRet.ExternalGUID != null)
{
string ExternalGUID14 = (string)ItemSalesTaxRet.ExternalGUID.GetValue();
}
if (ItemSalesTaxRet.DataExtRetList != null)
{
for (int i15 = 0; i15 < ItemSalesTaxRet.DataExtRetList.Count; i15++)
{
IDataExtRet DataExtRet = ItemSalesTaxRet.DataExtRetList.GetAt(i15);
//Get value of OwnerID
if (DataExtRet.OwnerID != null)
{
string OwnerID16 = (string)DataExtRet.OwnerID.GetValue();
}
//Get value of DataExtName
string DataExtName17 = (string)DataExtRet.DataExtName.GetValue();
//Get value of DataExtType
ENDataExtType DataExtType18 = (ENDataExtType)DataExtRet.DataExtType.GetValue();
//Get value of DataExtValue
string DataExtValue19 = (string)DataExtRet.DataExtValue.GetValue();
}
}
}
}
}
You can add each tax item as a line item. Make sure you set the invoice to a 0 tax, so tax is not calculated on top of tax.
You would have line item sales tax A and another line item sales tax B.
Related
Below is my override saveChanges Methed which calls SetChanges Method
public override int SaveChanges(bool acceptAllChangesOnSuccess)
{
SetChanges();
OnBeforeSaving();
return base.SaveChanges(acceptAllChangesOnSuccess);
}
Right now, Sometimes code works completely fine but in some scenario It gives same value of both property.OriginalValue and property.CurrentValue for Modification so I am not able find what is the issue in my code
private void SetChanges()
{
Guid SystemLogId = Guid.NewGuid();
var currentDate = DateTime.Now;
var entitiesTracker = ChangeTracker.Entries()
.Where(p => p.State == EntityState.Modified || p.State == EntityState.Added).ToList();
foreach (var entry in entitiesTracker)
{
var pagename = entry.Entity.GetType().Name;
if (pagename != "ExceptionLog")
{
var rowid = 0;
try
{
rowid = int.Parse(entry.OriginalValues["Id"].ToString());
}
catch (Exception)
{ }
SystemLog sysLog = new SystemLog();
List<SystemChangeLog> changeLog = new List<SystemChangeLog>();
foreach (PropertyEntry property in entry.Properties)
{
string propertyName = property.Metadata.Name;
switch (entry.State)
{
case EntityState.Added:
sysLog.Event = "Created";
break;
case EntityState.Modified:
{
sysLog.Event = "Updated";
if (propertyName != "ModifiedDate" && propertyName != "CreatedDate" && propertyName != "ModifiedBy" && propertyName != "CreatedBy" && propertyName != "RowVersion")
{
var original = Convert.ToString(property.OriginalValue);
var current = Convert.ToString(property.CurrentValue);
if (property.IsModified && !original.Equals(current))
{
SystemChangeLog log = new SystemChangeLog()
{
Property = propertyName,
OldValue = original,
NewValue = current,
DateOfChange = currentDate,
rowid = rowid,
SystemLogId = SystemLogId.ToString(),
};
changeLog.Add(log);
}
}
}
break;
}
}
base.Set<SystemChangeLog>().AddRange(changeLog);
if(changeLog.Count() >0 || entry.State == EntityState.Added)
{
sysLog.UserId = UserId;
sysLog.Date = currentDate;
sysLog.Page = pagename;
sysLog.Location = ExceptionHandler(entry, "Location");
sysLog.IPAddress = ExceptionHandler(entry, "IPAddress");
sysLog.MACAddress = ExceptionHandler(entry, "MACAddress");
sysLog.SystemLogId = SystemLogId.ToString();
base.Set<SystemLog>().Add(sysLog);
}
}
}
}
And also Is there any way to make it fast for more than thousand entry
hope below code can help:
public override int SaveChanges(bool acceptAllChangesOnSuccess)
{
setChanges(); // to get new value and old value
var result = base.SaveChanges(acceptAllChangesOnSuccess);
OnAfterSaveChanges();// to get auto added id
return result;
}
Given a linked List $link1, with elements (a->b->c->d->e->f->g->h->i->j), we need to reverse the linked list provided that the reversing will be done in a manner like -
Reverse 1st element (a)
Reverse next 2 elements (a->c->b)
Reverse next 3 elements (a->c->b->f->e->d)
Reverse next 4 elements (a->c->b->f->e->d->j->i->h->g)
....
....
I have created below code in PHP to solve this problem
Things I need -
I need to calculate the time complexity of reverseLinkedList function below.
Need to know if we can optimize reverseLinkedList function to reduce time complexity.
-
class ListNode
{
public $data;
public $next;
function __construct($data)
{
$this->data = $data;
$this->next = NULL;
}
function read_node()
{
return $this->data;
}
}
class LinkList
{
private $first_node;
private $last_node;
private $count;
function __construct()
{
$this->first_node = NULL;
$this->last_node = NULL;
$this->count = 0;
}
function size()
{
return $this->count;
}
public function read_list()
{
$listData = array();
$current = $this->first_node;
while($current != NULL)
{
echo $current->read_node().' ';
$current = $current->next;
}
}
public function reverse_list()
{
if(($this->first_node != NULL)&&($this->first_node->next != NULL))
{
$current = $this->first_node;
$new = NULL;
while ($current != NULL)
{
$temp = $current->next;
$current->next = $new;
$new = $current;
$current = $temp;
}
$this->first_node = $new;
}
}
public function read_node($position)
{
if($position <= $this->count)
{
$current = $this->first_node;
$pos = 1;
while($pos != $position)
{
if($current->next == NULL)
return null;
else
$current = $current->next;
$pos++;
}
return $current->data;
}
else
return NULL;
}
public function insert($data)
{
$new_node = new ListNode($data);
if($this->first_node != NULL)
{
$this->last_node->next = $new_node;
$new_node->next = NULL;
$this->last_node = &$new_node;
$this->count++;
}
else
{
$new_node->next = $this->first_node;
$this->first_node = &$new_node;
if($this->last_node == NULL)
$this->last_node = &$new_node;
$this->count++;
}
}
}
//Create linked list
$link1 = new LinkList();
//Insert elements
$link1->insert('a');
$link1->insert('b');
$link1->insert('c');
$link1->insert('d');
$link1->insert('e');
$link1->insert('f');
$link1->insert('g');
$link1->insert('h');
$link1->insert('i');
$link1->insert('j');
echo "<b>Input :</b><br>";
$link1->read_list();
//function to reverse linked list in specified manner
function reverseLinkedList(&$link1)
{
$size= $link1->size();
if($size>2)
{
$link2=new LinkList();
$link2->insert($link1->read_node(1));
$elements_covered=1;
//reverse
$rev_size=2;
while($elements_covered<$size)
{
$start=$elements_covered+1;
$temp_link = new LinkList();
$temp_link->insert($link1->read_node($start));
for($i=1;$i<$rev_size;$i++)
{
$temp_link->insert($link1->read_node(++$start));
}
$temp_link->reverse_list();
$temp_size=$temp_link->size();
$link2_size=$link2->size();
for($i=1;$i<=$temp_size;$i++)
{
$link2->insert($temp_link->read_node($i));
++$elements_covered;
++$link2_size;
}
++$rev_size;
}
///reverse
//Flip the linkedlist
$link1=$link2;
}
}
///function to reverse linked list in specified manner
//Reverse current linked list $link1
reverseLinkedList($link1);
echo "<br><br><b>Output :</b><br>";
$link1->read_list();
It's O(n)...just one traversal.
And secondly, here tagging it in language is not necessary.
I have provided a Pseudocode here for your reference:
current => head_ref
prev => NULL;
current => head_ref;
next => null;
while (current != NULL)
{
next = current->next;
current->next = prev;
prev = current;
current = next;
}
*head_ref = prev;
Showing Error Value Cannot be null. While Adding Task from Gantt Chart for ASP.NET MVC with dhtmlxGantt.
An exception of type ‘System.ArgumentNullException’ occurred in mscorlib.dll but was not handled in user code.
Additional Information :Value cannot be null
LINK : dhtmlx Link for Gantt Chart
Heres My Code :
public static List<GanttRequest> Parse(FormCollection form, string ganttMode)
{
// save current culture and change it to InvariantCulture for data parsing
var currentCulture = Thread.CurrentThread.CurrentCulture;
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
var dataActions = new List<GanttRequest>();
var prefixes = form["ids"].Split(',');
foreach (var prefix in prefixes)
{
var request = new GanttRequest();
// lambda expression for form data parsing
Func<string, string> parse = x => form[String.Format("{0}_{1}", prefix, x)];
request.Mode = (GanttMode)Enum.Parse(typeof(GanttMode), ganttMode, true);
request.Action = (GanttAction)Enum.Parse(typeof(GanttAction), parse("!nativeeditor_status"), true);
request.SourceId = Int64.Parse(parse("id"));
// parse gantt task
if (request.Action != GanttAction.Deleted && request.Mode == GanttMode.Tasks)
{
//--HERE SHOWING ERROR VALUE CANNOT BE NULL--//
request.UpdatedTask = new GanttTasks()
{
GanttTaskId = (request.Action == GanttAction.Updated) ? (int)request.SourceId : 0,
Text = parse("text"),
StartDate = DateTime.Parse(parse("start_date")),
Duration = Int32.Parse(parse("duration")),
Progress = Decimal.Parse(parse("progress")),
ParentId = (parse("parent") != "0") ? Int32.Parse(parse("parent")) : (int?)null,
SortOrder = (parse("order") != null) ? Int32.Parse(parse("order")) : 0,
Type = parse("type")
};
}
// parse gantt link
else if (request.Action != GanttAction.Deleted && request.Mode == GanttMode.Links)
{
request.UpdatedLink = new GanttLinks()
{
GanttLinkId = (request.Action == GanttAction.Updated) ? (int)request.SourceId : 0,
SourceTaskId = Int32.Parse(parse("source")),
TargetTaskId = Int32.Parse(parse("target")),
Type = parse("type")
};
}
dataActions.Add(request);
}
// return current culture back
Thread.CurrentThread.CurrentCulture = currentCulture;
return dataActions;
}
}
I Referred to link provided above and done as stated. But while adding value its shows value cannot be null.
Try setting a default value for task.progress on the client side,
JS:
gantt.attachEvent("onTaskCreated", function(task){
task.progress = 0;
return true;
});
Client doesn't set the default value for progress property of a newly created task, so when you insert task on a backend progress value is null.
And since backend code doesn't validate the value, probably the error fires on this line:
Progress = Decimal.Parse(parse("progress")),
Setting a default value on the client, as shown above, or checking for null on the server should fix the issue
I am trying to implement a let's say "change my account email address" fonctionality.
I want to keep backup of all user emails in (R_EmailAddressHistory table).
Here are some of my project's code.
public bool ChangeEmailAddress(string username, string newEmailAddress, string callbackUrl)
{
DateTime currentUtcTime = DateTime.UtcNow;
R_User currentUser = UserRepo.GetSingle(whereCondition: w=>w.Username == username);
currentUser.UpdateDate = currentUtcTime;
if (currentUser.HasPendingNewEmail)
{
R_EmailAddressHistory currentPendingRequest = EmailHistoRepo.GetSingle(whereCondition: w => w.StatusID == (int)Reno.Common.Enums.RecordStatus.Pending && w.R_User.GId == currentUser.GId);
currentPendingRequest.NewEmail = newEmailAddress;
currentPendingRequest.UpdateDate = currentUtcTime;
EmailHistoRepo.Update(currentPendingRequest);
}
else
{
currentUser.HasPendingNewEmail = true;
R_EmailAddressHistory newEmail = new R_EmailAddressHistory();
newEmail.UserId = currentUser.GId;
newEmail.R_User = currentUser;
newEmail.NewEmail = newEmailAddress;
newEmail.InsertDate = currentUtcTime;
newEmail.StatusID = (int) Reno.Common.Enums.RecordStatus.Pending;
currentUser.R_EmailAddressHistory.Add(newEmail);
}
IdentityResult idtResult = UserRepo.Update(currentUser);
if(idtResult == IdentityResult.Succeeded)
{
//Send notification to current email address for validation before proceeding change email process
bool sendResult = Communication.EmailService.SendChangeEmailValidation(username,currentUser.Email, newEmailAddress, callbackUrl);
return sendResult;
}
else
{
return false;
}
}
The previous method is use to change an email address. Each of my tables (R_User and EmailAddressHistory ) has Repository (UserRepo and EmailHistoRepo). The implement the same IRepositoryBase class, here is the Update methode
public IdentityResult Update(T entity)
{
try
{
if (_currentContext.DbContext.Entry(entity).State == EntityState.Detached)
{
_currentContext.DbContext.Set<T>().Attach(entity);
}
_currentContext.DbContext.Entry(entity).State = EntityState.Modified;
return IdentityResult.Succeeded;
}
catch
{
return IdentityResult.Failed;
}
}
When a user has already a non validate new email address, when he request to change his current email address, I show him the pending new email address and he can change it, in this case I whant to update my historical table instead of creating a new one, cause only one pending new email address is allow. In such a case, my code failed in the line EmailHistoRepo.Update(currentPendingRequest) throwing the error : An entity object cannot be referenced by multiple instances of IEntityChangeTracker.
Can anyone help me?
Thanks
EDIT
I am using MVC(4) with a unitOfWork. My UOW is initialized in a the Controller the first time the DB is queried and the Commit is done in the global.asax file in Appalication_EndRequest (see below).
protected void Application_EndRequest(Object sender, EventArgs e)
{
CommitChanges();
}
private void CommitChanges()
{
Reno.BLL.Services.Singleton.UnitOfWork unitOfWork = Reno.BLL.Services.Singleton.UnitOfWork.GetCurrentInstance(false);
if (unitOfWork != null)
{
unitOfWork.Commit();
unitOfWork.Dispose();
}
}
Your currentUser is modified before updating the emailaddress. Save the changes to currentUser first.
Something like this:
R_User currentUser = UserRepo.GetSingle(whereCondition: w=>w.Username == username);
currentUser.UpdateDate = currentUtcTime;
bool pendingNewEmail = currentUser.HasPendingNewEmail;
UserRepo.Update(currentUser);
if (pendingNewEmail)
{
R_EmailAddressHistory currentPendingRequest = EmailHistoRepo.GetSingle(whereCondition: w => w.StatusID == (int)Reno.Common.Enums.RecordStatus.Pending && w.R_User.GId == currentUser.GId);
currentPendingRequest.NewEmail = newEmailAddress;
currentPendingRequest.UpdateDate = currentUtcTime;
EmailHistoRepo.Update(currentPendingRequest);
}
else
I finally found the answer. The problem was that when I first get the user in line
R_User currentUser = UserRepo.GetSingle(whereCondition: w=>w.Username == username);
The currentUser variable hold a refrence of all of its R_EmailAddressHistory.
And then after, I queried the DB (2nd time) to get the pending email change request (or type R_EmailAddressHistory) to modify its new email and its update date, in line
R_EmailAddressHistory currentPendingRequest = EmailHistoRepo.GetSingle(whereCondition: w => w.StatusID == (int)Reno.Common.Enums.RecordStatus.Pending && w.R_User.GId == currentUser.GId);
currentPendingRequest.NewEmail = newEmailAddress;
currentPendingRequest.UpdateDate = currentUtcTime;
But te last code updates only currentPendingRequest while another reference of the same object which is in currentUser.R_EmailAddressHistory is not update and was already tracked by the context. Therefore, by doing an update on the new instance (EmailHistoRepo.Update(currentPendingRequest)), the code failed: the same object if referenced in 2 places.
So, the solution was (the only thing I modified):
R_User currentUser = UserRepo.GetSingle(whereCondition: w=>w.Username == username);
currentUser.UpdateDate = currentUtcTime;
if (currentUser.HasPendingNewEmail)
{
R_EmailAddressHistory currentPendingRequest = currentUser.R_EmailAddressHistory.Where(h => h.StatusID == (int)Reno.Common.Enums.RecordStatus.Pending).First(); // EmailHistoRepo.GetSingle(whereCondition: w => w.StatusID == (int)Reno.Common.Enums.RecordStatus.Pending && w.R_User.GId == currentUser.GId);
currentPendingRequest.NewEmail = newEmailAddress;
currentPendingRequest.UpdateDate = currentUtcTime;
}
I decided to modify the instance in currentUser variable.
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.