public async Task <ActionResult> Update(Opportunity input) { if (ModelState.IsValid) { SalesForceResponse sfResponse = new SalesForceResponse(); ForceClient client = await _client.CreateForceClient(); // Coverting the object value to required format input.StageName = GlobalHelper.GetStageName(Convert.ToInt32(input.StageName)); input.Type = GlobalHelper.GetType(Convert.ToInt32(input.Type)); // Need to provide opporunity id seperately var opportunityId = input.Id; input.Id = null; // Updating the opportunity sfResponse = await _repository.UpdateOpportunity(client, opportunityId, input); // Managing Notification based on update operation response TempData["NotificationType"] = sfResponse.IsSuccess ? NotificationType.Success.ToString() : NotificationType.Error.ToString(); TempData["Notification"] = sfResponse.Details; return(RedirectToAction("Index", "Opportunities")); } // Case when model has invalid data TempData["NotificationType"] = NotificationType.Error.ToString(); TempData["Notification"] = GlobalHelper.GetErrorListFromModelState(ModelState); return(View(input)); }
public async Task <ActionResult> Add(OpportunityLineItem input) { if (ModelState.IsValid) { SalesForceResponse sfResponse = new SalesForceResponse(); ForceClient client = await _client.CreateForceClient(); // Creating the Opportunity Line item sfResponse = await _repository.CreateOpportunityLineItem(client, input); // Managing the Notification TempData["NotificationType"] = sfResponse.IsSuccess ? NotificationType.Success.ToString() : NotificationType.Error.ToString(); TempData["Notification"] = sfResponse.Details; return(RedirectToAction("Index", "OpportunityLineitems", new { opportunityId = input.OpportunityId })); } // In case the model has no valid data TempData["NotificationType"] = NotificationType.Error.ToString(); TempData["Notification"] = GlobalHelper.GetErrorListFromModelState(ModelState); return(View(input)); }
public async Task <ActionResult> Update(OpportunityLineItem input) { if (ModelState.IsValid) { SalesForceResponse sfResponse = new SalesForceResponse(); ForceClient client = await _client.CreateForceClient(); // Need to provide opporunity line item id seperately string opportunityLineItemId = input.Id; input.Id = null; string opportunityId = input.OpportunityId; input.OpportunityId = null; // Updating the opportunity line item sfResponse = await _repository.UpdateOpportunityLineItem(client, opportunityLineItemId, input); // Managing Notification based on update operation response TempData["NotificationType"] = sfResponse.IsSuccess ? NotificationType.Success.ToString() : NotificationType.Error.ToString(); TempData["Notification"] = sfResponse.Details; return(RedirectToAction("Index", "OpportunityLineitems", new { opportunityId = opportunityId })); } // Case when model has invalid data TempData["NotificationType"] = NotificationType.Error.ToString(); TempData["Notification"] = GlobalHelper.GetErrorListFromModelState(ModelState); return(View(input)); }
public async Task <ContactFields> GetContactAsync(SalesForceResponse salesForceResponse, string contactNMLSID) { LoggerService.Debug("Entered GetContactAsync()", "INFO"); string query = "Select conta.ID, conta.Owner.ID,conta.Account.ID From Contact conta where conta.NMLS__c = '" + contactNMLSID + "'"; string queryURL = salesForceResponse.instance_url + "/services/data/v24.0/query/?q=" + query; ContactFields conFields = new ContactFields(); using (HttpClient httpClient = new HttpClient()) { httpClient.DefaultRequestHeaders.Add("Authorization", "OAuth " + salesForceResponse.access_token); httpClient.DefaultRequestHeaders.Accept.Clear(); httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); httpResponseMessage = await httpClient.GetAsync(queryURL); } if (httpResponseMessage != null && httpResponseMessage.IsSuccessStatusCode) { var ContactContent = await httpResponseMessage.Content.ReadAsStringAsync(); con.ContactDetails conResult = (con.ContactDetails)javaScriptSerializer.Deserialize(ContactContent, typeof(con.ContactDetails)); if (conResult != null && conResult.records.Count > 0) { conFields.ContactId = conResult.records[0].Id; conFields.OwnerId = conResult.records[0].Owner.Id; conFields.AccountId = conResult.records[0].account.Id; } } LoggerService.Debug("Leaving GetContactAsync()", "INFO"); return(conFields); }
public async Task <ActionResult> Add(Opportunity input) { if (ModelState.IsValid) { SalesForceResponse sfResponse = new SalesForceResponse(); ForceClient client = await _client.CreateForceClient(); // Coverting the object value to required format input.StageName = GlobalHelper.GetStageName(Convert.ToInt32(input.StageName)); input.Type = GlobalHelper.GetType(Convert.ToInt32(input.Type)); // Creating the Opportunity sfResponse = await _repository.CreateOpportunity(client, input); // Managing the Notification TempData["NotificationType"] = sfResponse.IsSuccess ? NotificationType.Success.ToString() : NotificationType.Error.ToString(); TempData["Notification"] = sfResponse.Details; return(RedirectToAction("Index", "Opportunities")); } // In case the model has no valid data TempData["NotificationType"] = NotificationType.Error.ToString(); TempData["Notification"] = GlobalHelper.GetErrorListFromModelState(ModelState); return(View(input)); }
/// <summary> /// Get user details based on ownerid being passed. /// </summary> /// <param name="salesForceResponse"></param> /// <param name="userId"></param> /// <returns></returns> public async Task <UserFields> GetUserAsync(SalesForceResponse salesForceResponse, string userId) //UserID = OwnerID { LoggerService.Debug("Entered GetUserAsync()", "INFO"); string query = "Select usr.Email,usr.Username, usr.Name From User usr where usr.Id = '" + userId + "'"; string queryURL = salesForceResponse.instance_url + "/services/data/v24.0/query/?q=" + query; UserFields userFields = new UserFields(); using (HttpClient httpClient = new HttpClient()) { httpClient.DefaultRequestHeaders.Add("Authorization", "OAuth " + salesForceResponse.access_token); httpClient.DefaultRequestHeaders.Accept.Clear(); httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); httpResponseMessage = await httpClient.GetAsync(queryURL); } if (httpResponseMessage != null && httpResponseMessage.IsSuccessStatusCode) { var AccContent = await httpResponseMessage.Content.ReadAsStringAsync(); usr.UserDetails accResult = (usr.UserDetails)javaScriptSerializer.Deserialize(AccContent, typeof(usr.UserDetails)); if (accResult != null && accResult.records.Count > 0) { userFields.Name = accResult.records[0].Name; userFields.Username = accResult.records[0].Username; userFields.Email = accResult.records[0].Email; } } LoggerService.Debug("Leaving GetUserAsync()", "INFO"); return(userFields); }
public async Task <AccountFields> GetAccountAsync(SalesForceResponse salesForceResponse, string accountNMLSID) { LoggerService.Debug("Entered GetAccountAsync()", "INFO"); string query = "Select acc.Id, acc.Name,Parent.Id From Account acc where acc.NMLS__c = '" + accountNMLSID + "'"; string queryURL = salesForceResponse.instance_url + "/services/data/v24.0/query/?q=" + query; AccountFields accFields = new AccountFields(); using (HttpClient httpClient = new HttpClient()) { httpClient.DefaultRequestHeaders.Add("Authorization", "OAuth " + salesForceResponse.access_token); httpClient.DefaultRequestHeaders.Accept.Clear(); httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); httpResponseMessage = await httpClient.GetAsync(queryURL); } if (httpResponseMessage != null && httpResponseMessage.IsSuccessStatusCode) { var AccContent = await httpResponseMessage.Content.ReadAsStringAsync(); acc.AccountDetails accResult = (acc.AccountDetails)javaScriptSerializer.Deserialize(AccContent, typeof(acc.AccountDetails)); if (accResult != null && accResult.records.Count > 0) { accFields.AccountId = accResult.records[0].Id; accFields.ParentId = accResult.records[0].Parent; } } LoggerService.Debug("Leaving GetAccountAsync()", "INFO"); return(accFields); }
public async Task <string> CreateOpportunityAsync(SalesForceResponse salesForceResponse, SalesForceOpprtunity opp) { LoggerService.Debug("Entered CreateOpportunityAsync", "INFO"); string opportunityId = string.Empty; try { CreateOpportunityFields createOpportunityFields = new CreateOpportunityFields(); createOpportunityFields.Name = opp.OppurtunityName; createOpportunityFields.Contact__c = opp.ContactID; createOpportunityFields.CloseDate = opp.closedate; createOpportunityFields.StageName = opp.stage; createOpportunityFields.AccountId = opp.AccountID; createOpportunityFields.Byte_FileDataID__c = opp.ByteFileDataID; LoggerService.Debug("Setting Opp data, and calling CreateOpportunityAsync()", ""); opportunityId = await CreateOpportunityAsync(salesForceResponse, createOpportunityFields); bool isUpdated = false; if (opportunityId != null) { isUpdated = await UpdateOpportunityAsync(salesForceResponse, opp, opportunityId, "4"); //Creating New opp based on loanstatus code = 4 } } catch (Exception ex) { LoggerService.Error("", "SalesForceBL->CreateOpportunityAsync(): " + "\r\nError Message: " + ex.Message + "\r\nStackTrace: " + ex.StackTrace); } return(opportunityId); }
//public async Task<bool> UpdateOpportunityAsync(SalesForceResponse salesForceResponse, SalesForceOpprtunity opp, string opportunityId) public async Task <bool> UpdateOpportunityAsync(SalesForceResponse salesForceResponse, SalesForceOpprtunity opp, string opportunityId, string loanStatusCode) { LoggerService.Debug("Entered UpdateOpportunityAsync", "INFO"); bool isOpportunityUpdated = false; OpportunityUpdateFields ouf = new OpportunityUpdateFields(); ouf.Name = opp.OppurtunityName; if (loanStatusCode == "4") //New Loan { LoggerService.Debug("loanStatusCode = 4", "INFO"); ouf.StageName = opp.stage; ouf.CloseDate = opp.closedate; ouf.OwnerID = opp.OwnerID; } else if (loanStatusCode == "9" || loanStatusCode == "10" || loanStatusCode == "59" || loanStatusCode == "12") { LoggerService.Debug("loanStatusCode: ", loanStatusCode); ouf.StageName = opp.stage; ouf.OwnerID = opp.OwnerID; ouf.CloseDate = opp.closedate; ouf.Amount = opp.Amount; } string opportunityUpdateUrl = salesForceResponse.instance_url + "/services/data/v26.0/sobjects/Opportunity/" + opportunityId; using (HttpClient httpClient = new HttpClient()) { httpClient.DefaultRequestHeaders.Add("Authorization", "OAuth " + salesForceResponse.access_token); HttpContent httpcontent = new StringContent(javaScriptSerializer.Serialize(ouf), Encoding.UTF8, "application/json"); httpResponseMessage = await httpClient.PatchAsync(new Uri(opportunityUpdateUrl), httpcontent); LoggerService.Debug("httpResponseMessage :", httpResponseMessage); var opportunityUpdateResult = await httpResponseMessage.Content.ReadAsStringAsync(); LoggerService.Debug("opportunityUpdateResult :", opportunityUpdateResult); if (httpResponseMessage != null && httpResponseMessage.IsSuccessStatusCode) { isOpportunityUpdated = true; } } LoggerService.Debug("Leaving UpdateOpportunityAsync", "INFO"); return(isOpportunityUpdated); }
private async Task <string> CreateOpportunityAsync(SalesForceResponse salesForceResponse, CreateOpportunityFields createOpportunityFields) { string opportunityId = string.Empty; string createOpportunityUrl = salesForceResponse.instance_url + "/services/data/v26.0/sobjects/Opportunity/"; LoggerService.Debug("Entered CreateOpportunityAsync()", "INFO"); try { LoggerService.Debug("Inside CreateOpportunityAsync() 2", ""); using (HttpClient httpClient = new HttpClient()) { httpClient.DefaultRequestHeaders.Add("Authorization", "OAuth " + salesForceResponse.access_token); httpResponseMessage = await httpClient.PostAsJsonAsync(createOpportunityUrl, createOpportunityFields); LoggerService.Debug("CreateOpportunityAsync()- Response for httpResponseMessage:", httpResponseMessage); var opportunityUserResult = await httpResponseMessage.Content.ReadAsStringAsync(); LoggerService.Debug("CreateOpportunityAsync() - Response for opportunityUserResult :", opportunityUserResult); if (httpResponseMessage != null && httpResponseMessage.IsSuccessStatusCode) { LoggerService.Debug("httpResponseMessage = SuccessStatusCode ", ""); var opportunityUserResultObject = (IDictionary <string, object>)javaScriptSerializer.DeserializeObject(opportunityUserResult); opportunityId = Convert.ToString(opportunityUserResultObject["id"]); LoggerService.Debug("opportunityId:", opportunityId); } else { LoggerService.Debug("httpResponseMessage = Error ", httpResponseMessage); } } } catch (Exception ex) { LoggerService.Error("", "SalesForceBL->CreateOpportunityAsync() 2: " + "\r\nError Message: " + ex.Message + "\r\nStackTrace: " + ex.StackTrace); } return(opportunityId); }
public async Task <JsonResult> Delete(string itemId) { SalesForceResponse sfResponse = new SalesForceResponse(); try { ForceClient client = await _client.CreateForceClient(); sfResponse = await _repository.DeleteOpportunityLineItem(client, itemId); } catch (Exception ex) { sfResponse.Details = ex.Message; } return(Json(new { IsDeleted = sfResponse.IsSuccess, Details = sfResponse.Details }, JsonRequestBehavior.DenyGet)); }
public async Task <OpportunityUpdateFields> GetOpportunityAsync(SalesForceResponse salesForceResponse, string filterCode) { string query = "Select op.Id,op.Name From Opportunity op"; string queryURL = salesForceResponse.instance_url + "/services/data/v24.0/query/?q=" + query; using (HttpClient httpClient = new HttpClient()) { httpClient.DefaultRequestHeaders.Add("Authorization", "OAuth " + salesForceResponse.access_token); httpClient.DefaultRequestHeaders.Accept.Clear(); httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); httpResponseMessage = await httpClient.GetAsync(queryURL); } if (httpResponseMessage != null && httpResponseMessage.IsSuccessStatusCode) { var OppContent = await httpResponseMessage.Content.ReadAsStringAsync(); olis.OpportunityLineItemSchedules oppResults = (olis.OpportunityLineItemSchedules)javaScriptSerializer.Deserialize(OppContent, typeof(olis.OpportunityLineItemSchedules)); } return(null); }
async Task SalesForceCRUD() { string sfAuthenticationResult = string.Empty; bool processData = true; string strFileDataID = null; string queueid = "-1"; try { DateTime start = DateTime.Now; LoggerService.Debug("Salesforce authentication started at ", start); SalesForceConnectionData sfd = objSalesForceBL.GetSalesForceConnectionData(); if (sfd.securityToken != null && sfd.securityToken.Length > 0) { sfd.password = sfd.password + sfd.securityToken; } using (HttpClient httpClient = new HttpClient()) { FormUrlEncodedContent formUrlEncodedContent = new FormUrlEncodedContent(new[] { new KeyValuePair <string, string>("grant_type", "password"), new KeyValuePair <string, string>("username", sfd.username), new KeyValuePair <string, string>("password", sfd.password), new KeyValuePair <string, string>("client_id", sfd.consumerKey), new KeyValuePair <string, string>("client_secret", sfd.consumerSecret) }); //The line below enables TLS1.1 and TLS1.2 ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; httpResponseMessage = await httpClient.PostAsync(sfd.baseUrl, formUrlEncodedContent); sfAuthenticationResult = await httpResponseMessage.Content.ReadAsStringAsync(); } if (httpResponseMessage != null && httpResponseMessage.IsSuccessStatusCode) { salesForceResponse = (SalesForceResponse)jsonSerializer.Deserialize(sfAuthenticationResult, typeof(SalesForceResponse)); sfd.restServiceUrl = salesForceResponse.instance_url + ConfigurationManager.AppSettings["restServiceUrlPostfix"]; LoggerService.Debug("Logged in as " + sfd.username + " in environment " + sfd.loginHost + "\n", ""); LoggerService.Debug("postback_url:", sfd.baseUrl); LoggerService.Debug("response:", jsonSerializer.Serialize(salesForceResponse)); LoggerService.Debug("access_token:", salesForceResponse.access_token); LoggerService.Debug("instance_url:", salesForceResponse.instance_url); LoggerService.Debug("restServiceUrl:", sfd.restServiceUrl); LoggerService.Debug("It took " + (DateTime.Now - start).Hours + " Hour(s) " + (DateTime.Now - start).Minutes + " Minute(s) " + (DateTime.Now - start).Seconds + " Second(s) in salesforce authentication", ""); } else { LoggerService.Error("", "SFService->SalesForceCRUD(): " + "\r\nError Message: " + httpResponseMessage.StatusCode); } while (processData) { try { //Get top 1 record to process [Query 1] DataTable dtQueueDetail = objSalesForceBL.GetLoanQueueData(); //Based on LoanStatus=4 if (dtQueueDetail.Rows.Count > 0) { strFileDataID = dtQueueDetail.Rows[0]["FileDataID"].ToString(); //Get FileDataID LoggerService.Debug("FiledataID:", strFileDataID); queueid = dtQueueDetail.Rows[0]["QueueID"].ToString(); //Get QueueID LoggerService.Debug("QueueID: ", queueid); string strLoanStatusCode = dtQueueDetail.Rows[0]["LoanStatus"].ToString(); string strOppID = dtQueueDetail.Rows[0]["OppId"].ToString(); //if you get record to process then continue...else processData = false; if (strFileDataID.Length <= 0) { processData = false; LoggerService.Debug("No data found in queue table.", "INFO"); } else { //UPDATE[ByteProSFQueue] SET Status = 'PROCESSING' objSalesForceBL.UpdateQueueRecord("PROCESSING", queueid); LoggerService.Debug("UpdateQueueRecord:", "PROCESSING"); // Get party Email, CategoryId,ContactNMLSID,BranchId etc from Party based on filedataid and CategoryId= 110 = Broker string ContactNMLSID = string.Empty; string CompanyNMLSID = string.Empty; string BranchID = string.Empty; string EMail = string.Empty; DataTable dtParty = new DataTable(); dtParty = objSalesForceBL.GetPartyinfo(strFileDataID); if (dtParty.Rows.Count > 0) { ContactNMLSID = dtParty.Rows[0]["ContactNMLSID"].ToString(); //Get ContactNMLSID LoggerService.Debug("ContactNMLSID:", ContactNMLSID); //CompanyNMLSID = "144549";//To be removed, other smaple data "8473959844" for debugging purpose. CompanyNMLSID = dtParty.Rows[0]["CompanyNMLSID"].ToString(); //Get CompanyNMLSID LoggerService.Debug("CompanyNMLSID:", CompanyNMLSID); BranchID = dtParty.Rows[0]["BranchID"].ToString(); //Get BranchID LoggerService.Debug("BranchID:", BranchID); EMail = dtParty.Rows[0]["EMail"].ToString(); //Get Email LoggerService.Debug("EMail:", EMail); } else { LoggerService.Debug("No data found in Party Table", "INFO"); } //Get filename and Closingdate from FileData table string strFileName = string.Empty; DateTime closingDate = DateTime.MinValue; DataTable dtFileDetail = objSalesForceBL.GetFileDetail(strFileDataID); if (dtFileDetail.Rows.Count > 0) { strFileName = dtFileDetail.Rows[0]["FileName"].ToString(); //Get FileName LoggerService.Debug("FileName:", strFileName); closingDate = (DateTime)(dtFileDetail.Rows[0]["CloseDate"]); //Get ClosingDate LoggerService.Debug("ClosingDate:", closingDate); } else { LoggerService.Debug("No data found in FileData Table", "ERROR"); } //await objSalesForceBL.GetOpportunityAsync(salesForceResponse, "test"); // retreive salesforce accountid and user id using those methods //SalesForceClientEntities.Account.AccountFields accFields = await objSalesForceBL.GetAccountAsync(salesForceResponse, CompanyNMLSID); LoggerService.Debug("Calling GetContactAsync", "INFO"); SalesForceClientEntities.Contact.ContactFields conFileds = await objSalesForceBL.GetContactAsync(salesForceResponse, ContactNMLSID); LoggerService.Debug("Setting Entity", "INFO"); //Set entity with data retrieved if (strLoanStatusCode == "4") //New Opp. to be created. (API 1 & 1.5) { LoggerService.Debug("API 1.0 start", "INFO"); //create opportunity SalesForceOpprtunity opp = new SalesForceOpprtunity(); opp.OppurtunityName = strFileName; //FileName from dbo.FileData based on FileDataID opp.stage = "Qualification"; opp.closedate = closingDate.ToString("yyyy-MM-dd"); opp.ContactID = conFileds.ContactId; opp.AccountID = conFileds.AccountId; opp.OwnerID = conFileds.OwnerId; opp.ByteFileDataID = strFileDataID; LoggerService.Debug("Calling CreateOpportunityAsync()", "INFO"); string opportunityId = await objSalesForceBL.CreateOpportunityAsync(salesForceResponse, opp); if (opportunityId != null) { LoggerService.Debug("Opportunity created with opportunityId:", opportunityId); } else { LoggerService.Debug("Opportunity creation failed", "ERROR!!!"); } //Update queue table with PROCESSED and oppid objSalesForceBL.UpdateQueueRecord(queueid, "PROCESSED", opportunityId); LoggerService.Debug("UpdateQueueRecord: PROCESSED", "INFO"); LoggerService.Debug("API 1 Over", "INFO"); LoggerService.Debug("API 1.5 Starts", "INFO"); SalesForceClientEntities.User.UserFields usrFileds = await objSalesForceBL.GetUserAsync(salesForceResponse, conFileds.OwnerId); string strName = usrFileds.Name; string strUserName = usrFileds.Username; string strUsrEmail = usrFileds.Email; //Update dbo.Party Table objSalesForceBL.UpdatePartyRecord(strUsrEmail, strUserName, strFileDataID); LoggerService.Debug("Update dbo.Party Table", "INFO"); LoggerService.Debug("API 1.5 Over", "INFO"); } else if (strLoanStatusCode == "9") //Closed_Won Loan { //Update queue table with PROCESSING and queueid objSalesForceBL.UpdateQueueRecord("PROCESSING", queueid); LoggerService.Debug(" Closed_Won Loan - UpdateQueueRecord: PROCESSING", "INFO"); SalesForceOpprtunity opp = new SalesForceOpprtunity(); opp.OppurtunityName = strFileName; opp.stage = "Closed Won"; opp.OwnerID = conFileds.OwnerId; opp.closedate = DateTime.Now.ToString("yyyy-MM-dd"); opp.Amount = objSalesForceBL.GetRevenueinfo(strFileDataID); LoggerService.Debug("Calling UpdateOpportunityAsync ", "INFO"); bool isUpdated = false; isUpdated = await objSalesForceBL.UpdateOpportunityAsync(salesForceResponse, opp, strOppID, strLoanStatusCode); if (isUpdated) { //Update queue table with PROCESSED and queueid objSalesForceBL.UpdateQueueRecord("PROCESSED", queueid); LoggerService.Debug("Closed_Won Loan - UpdateQueueRecord: PROCESSED", "INFO"); } else { LoggerService.Debug("Closed_Won Loan - FAILED!!!", "ERROR"); } } else if (strLoanStatusCode == "10" || strLoanStatusCode == "59") //Closed_Lost Loan { //Update queue table with PROCESSING and queueid objSalesForceBL.UpdateQueueRecord("PROCESSING", queueid); LoggerService.Debug("Closed_Lost Loan - UpdateQueueRecord: PROCESSING", "INFO"); SalesForceOpprtunity opp = new SalesForceOpprtunity(); opp.OppurtunityName = strFileName; opp.stage = "Closed Lost"; opp.OwnerID = conFileds.OwnerId; opp.closedate = DateTime.Now.ToString("yyyy-MM-dd"); opp.Amount = objSalesForceBL.GetRevenueinfo(strFileDataID); bool isUpdated = false; isUpdated = await objSalesForceBL.UpdateOpportunityAsync(salesForceResponse, opp, strOppID, strLoanStatusCode); if (isUpdated) { //Update queue table with PROCESSED and queueid objSalesForceBL.UpdateQueueRecord("PROCESSED", queueid); LoggerService.Debug("Closed_Lost Loan - UpdateQueueRecord: PROCESSED", "INFO"); } else { LoggerService.Debug("Closed_Lost Loan - FAILED!!!", "ERROR"); } } else if (strLoanStatusCode == "12") //Suspended Loan { //Update queue table with PROCESSING and queueid objSalesForceBL.UpdateQueueRecord("PROCESSING", queueid); LoggerService.Debug("Suspended Loan - UpdateQueueRecord: PROCESSING", "INFO"); SalesForceOpprtunity opp = new SalesForceOpprtunity(); opp.OppurtunityName = strFileName; opp.stage = "Suspended"; opp.OwnerID = conFileds.OwnerId; opp.closedate = DateTime.Now.ToString("yyyy-MM-dd"); opp.Amount = objSalesForceBL.GetRevenueinfo(strFileDataID); bool isUpdated = false; isUpdated = await objSalesForceBL.UpdateOpportunityAsync(salesForceResponse, opp, strOppID, strLoanStatusCode); if (isUpdated) { //Update queue table with PROCESSED and queueid objSalesForceBL.UpdateQueueRecord("PROCESSED", queueid); LoggerService.Debug("Suspended Loan - UpdateQueueRecord: PROCESSING", "INFO"); } else { LoggerService.Debug("Suspended Loan - FAILED!!!", "ERROR"); } } } } else { processData = false; LoggerService.Debug("No queued data found. Exit loop.", "INFO"); } } catch (Exception ex) { // update queue table with error and status objSalesForceBL.UpdateQueueRecord(queueid, "ERROR", ex.Message.ToString()); LoggerService.Error("", "SFService->SalesForceCRUD(): " + "\r\nError Message: " + ex.Message + "\r\nStackTrace: " + ex.StackTrace); } } } catch (Exception ex) { LoggerService.Error("", "SFService->SalesForceCRUD(): " + "\r\nError Message: " + ex.Message + "\r\nStackTrace: " + ex.StackTrace); } }