/// <summary> /// Adding Opportunity into CRM /// </summary> /// <param name="opportunity"> The Opportunity entity. </param> /// <returns> VTigerPotential entity </returns> public VTigerPotential CreateOpportunity(VTigerPotential opportunity) { try { opportunity = this.vTigerService.Create<VTigerPotential>(opportunity); } catch (Exception ex) { this.LoggerService.LogException("Adding Opportunity :- " + ex.Message); opportunity = new VTigerPotential(); } return opportunity; }
/// <summary> /// Updating Opportunity in CRM /// </summary> /// <param name="opportunity"> The Opportunity entity. </param> /// <returns> VTigerPotential entity </returns> public VTigerPotential UpdateOpportunity(VTigerPotential opportunity) { try { opportunity = this.vTigerService.Update<VTigerPotential>(opportunity); } catch (Exception ex) { this.LoggerService.LogException("Updating Opportunity :- " + ex.Message); } return opportunity; }
/// <summary> /// Gets the opportunity. /// </summary> /// <param name="companyId">The company identifier.</param> /// <param name="userId">The user identifier.</param> /// <param name="interest">The interest.</param> /// <returns>VTigerPotential object.</returns> public VTigerPotential GetOpportunity(string companyId, string userId, string interest) { VTigerPotential pot = new VTigerPotential(); try { string query = "select * from Potentials where related_to = '" + companyId + "' and contact_id = '" + userId + "' and cf_853 = '" + interest + "';"; pot = this.leadService.GetQueryResult<VTigerPotential>(query).FirstOrDefault(); } catch (Exception ex) { this.LoggerService.LogException("Get Opportunity :- " + ex.Message); } return pot; }
/// <summary> /// Retrieving Opportunity from CRM /// </summary> /// <param name="opportunityId"> The Opportunity id. </param> /// <returns> VTigerPotential entity </returns> public VTigerPotential ReadOpportunity(string opportunityId) { VTigerPotential opportunity = new VTigerPotential(); try { opportunity = this.vTigerService.Retrieve<VTigerPotential>(opportunityId); } catch (Exception ex) { this.LoggerService.LogException("Retrieving Opportunity :- " + ex.Message); } return opportunity; }