private String custDataInfo(String bodyText, Model.ActivityData item) { if (bodyText == null) { bodyText = String.Empty; } String custDataBegin = "## CRM Data ==> ##"; String custDataEnd = "## <== CRM Data ##"; int cdStartPos = bodyText.IndexOf(custDataBegin); int cdEndPos = bodyText.IndexOf(custDataEnd, cdStartPos == -1 ? 0 : cdStartPos); if (cdStartPos != -1 && cdEndPos != -1) { cdEndPos += custDataEnd.Length; bodyText = bodyText.Remove(cdStartPos, cdEndPos - cdStartPos); } if (cdStartPos == -1) { cdStartPos = bodyText.Length; } String custDataTxt = String.Empty; String custDataInfo = String.Empty; custDataInfo += String.Format("Customer name: {0}", item.CUSTNAME) + Environment.NewLine; custDataInfo += String.Format("Customer ABC: {0}", item.CUSTABC) + Environment.NewLine; custDataInfo += String.Format("Sales Rep: {0}", item.CUSTSALESREP) + Environment.NewLine; custDataInfo += String.Format("Mode of delivery: {0}", item.DLVMODE) + Environment.NewLine; custDataInfo += String.Format("Search name: {0}", item.NAMEALIAS) + Environment.NewLine; custDataInfo += String.Format("Contact ID: {0}", item.CONTACTPERSONID) + Environment.NewLine; custDataInfo += String.Format("Contact name: {0}", item.CONTACTNAME) + Environment.NewLine; custDataInfo += String.Format("Contact phone : {0}", item.CONTACTPHONE) + Environment.NewLine; custDataInfo += String.Format("Contact email : {0}", item.CONTACTEMAIL) + Environment.NewLine; custDataInfo += String.Format("Activity number: {0}", item.ACTIVITYNUMBER); custDataTxt = Environment.NewLine; custDataTxt += custDataBegin + Environment.NewLine; custDataTxt += custDataInfo + Environment.NewLine; custDataTxt += custDataEnd + Environment.NewLine; bodyText = bodyText.Insert(cdStartPos, custDataTxt); return(bodyText); }
public static Boolean IsdifferentRecord(Outlook.AppointmentItem oAppointment, Model.ActivityData item) { Boolean differenetRec = false; if (oAppointment.Start != item.STARTDATETIME.ToLocalTime()) { differenetRec = true; } if (oAppointment.End != item.ENDDATETIME.ToLocalTime()) { differenetRec = true; } if (string.IsNullOrEmpty(oAppointment.BillingInformation)) { if (string.IsNullOrEmpty(item.BILLINGINFORMATION)) { } else { differenetRec = true; } } else { if (oAppointment.BillingInformation != item.BILLINGINFORMATION) { differenetRec = true; } } if (string.IsNullOrEmpty(oAppointment.Body)) { if (string.IsNullOrEmpty(item.USERMEMO)) { } else { differenetRec = true; } } else { if (oAppointment.Body.ToString() != item.USERMEMO) { differenetRec = true; } } if (string.IsNullOrEmpty(oAppointment.Subject)) { if (string.IsNullOrEmpty(item.PURPOSE)) { } else { differenetRec = true; } } else { if (oAppointment.Subject.ToString() != item.PURPOSE.ToString()) { differenetRec = true; } } if (string.IsNullOrEmpty(oAppointment.Categories)) { if (string.IsNullOrEmpty(item.OUTLOOKCATEGORIES)) { } else { differenetRec = true; } } else { if (oAppointment.Categories.ToString() != item.OUTLOOKCATEGORIES) { differenetRec = true; } } if (string.IsNullOrEmpty(oAppointment.Location)) { if (string.IsNullOrEmpty(item.LOCATION)) { } else { differenetRec = true; } } else { if (oAppointment.Location.ToString() != item.LOCATION.ToString()) { differenetRec = true; } } if (string.IsNullOrEmpty(oAppointment.Mileage)) { if (string.IsNullOrEmpty(item.MILEAGE)) { } else { differenetRec = true; } } else { if (oAppointment.Mileage.ToString() != item.MILEAGE.ToString()) { differenetRec = true; } } if (oAppointment.ReminderMinutesBeforeStart != item.REMINDERMINUTES) { differenetRec = true; } if (string.IsNullOrEmpty(oAppointment.Resources)) { if (string.IsNullOrEmpty(item.OUTLOOKRESOURCES)) { } else { differenetRec = true; } } else { if (oAppointment.Resources.ToString() != item.OUTLOOKRESOURCES) { differenetRec = true; } } if (oAppointment.AllDayEvent != Convert.ToBoolean(item.ALLDAY)) { differenetRec = true; } if (oAppointment.ReminderSet != Convert.ToBoolean(item.REMINDERACTIVE)) { differenetRec = true; } if (oAppointment.ResponseRequested != Convert.ToBoolean(item.RESPONSEREQUESTED)) { differenetRec = true; } if (oAppointment.Importance != OutlookMgt.TASKPRIORITYConvertIntToOutlookOlImportance(item.TASKPRIORITY)) { differenetRec = true; } if (oAppointment.Sensitivity != OutlookMgt.SENSITIVITYIntToConvertOutlookOlSensitivity(item.SENSITIVITY)) { differenetRec = true; } if (oAppointment.BusyStatus != OutlookMgt.ACTIVITYTIMETYPEConvertIntToOutlookOlBusyStatus(item.ACTIVITYTIMETYPE)) { differenetRec = true; } return(differenetRec); }