/// <summary> /// /// </summary> /// <returns></returns> public List <SalesForceEvent> GetEvents() { List <SalesForceEvent> listEvents = new List <SalesForceEvent>(); try { QueryResult queryResult = null; String SOQL = ""; SOQL = "select subject,StartDateTime ,EndDateTime,Location, Description from event"; queryResult = SfdcBinding.query(SOQL); for (int i = 0; i < queryResult.size; i++) { SalesForceEvent sfEvent = new SalesForceEvent(); Event salesforceEvent = (Event)queryResult.records[i]; sfEvent.Subject = salesforceEvent.Subject; sfEvent.StartDate = salesforceEvent.StartDateTime; sfEvent.EndDate = salesforceEvent.EndDateTime;; sfEvent.Location = salesforceEvent.Location; sfEvent.Description = salesforceEvent.Description; sfEvent.Id = i; listEvents.Add(sfEvent); } return(listEvents); } catch (Exception e) { return(listEvents); } }
public ActionResult CreateEvent() { EventDAL eventdal = new EventDAL(); SalesForceEvent eventsales = new SalesForceEvent(); eventsales.Subject = "TestEvent to check for Creating events"; eventsales.StartDate = DateTime.Now; eventsales.EndDate = eventsales.StartDate.Value.AddHours(1); eventsales.Location = "Conference Room"; eventdal.CreateEvent(eventsales); return(View("Index")); }
/// <summary> /// /// </summary> /// <returns></returns> public int CreateEvent(SalesForceEvent eventsales) { List <SalesForceEvent> listEvents = new List <SalesForceEvent>(); try { Event salesevent = new Event(); salesevent.Subject = eventsales.Subject; salesevent.StartDateTime = eventsales.StartDate; salesevent.EndDateTime = eventsales.EndDate; salesevent.Location = eventsales.Location; salesevent.Description = eventsales.Description; salesevent.StartDateTimeSpecified = true; salesevent.EndDateTimeSpecified = true; QueryResult queryResult = null; SaveResult[] results = SfdcBinding.create(new sObject[] { salesevent }); //for (int i = 0; i < queryResult.size; i++) //{ // SalesForceEvent sfEvent = new SalesForceEvent(); // Event salesforceEvent = (Event)queryResult.records[i]; // sfEvent.Subject = salesforceEvent.Subject; // sfEvent.StartDate = salesforceEvent.StartDateTime; // sfEvent.EndDate = salesforceEvent.EndDateTime; ; // sfEvent.Id = i; // listEvents.Add(sfEvent); //} return(1); } catch (Exception e) { EventLog.WriteEntry("SalesForcceIntegration", e.Message, EventLogEntryType.Error); return(0); } }