/// <summary> /// To deletes the note of the records. /// </summary> /// <returns>APIResponse class instance.</returns> /// <param name="note">ZCRMNote class instance</param> public APIResponse DeleteNote(ZCRMNote note) { if (note.Id == null) { throw new ZCRMException("Note ID MUST be null for Delete Operation"); } return(ZCRMModuleRelation.GetInstance(this, "Notes").DeleteNote(note)); }
private ZCRMModuleRelation GetZCRMModuleRelation(JObject relatedList) { ZCRMModuleRelation moduleRelation = ZCRMModuleRelation.GetInstance(module.ApiName, Convert.ToInt64(relatedList["id"])); moduleRelation.ApiName = (string)relatedList["api_name"]; moduleRelation.Label = (string)relatedList["display_label"]; moduleRelation.Module = (string)relatedList["module"]; moduleRelation.Type = (string)relatedList["type"]; moduleRelation.Name = (string)relatedList["name"]; return(moduleRelation); }
/// <summary> /// To delete the attachment of the notes based on attachment Id. /// </summary> /// <returns>APIResponse class instance.</returns> /// <param name="attachmentId">Attachment Id (Long) of the notes</param> public APIResponse DeleteAttachment(long attachmentId) { return(ZCRMModuleRelation.GetInstance(ZCRMRecord.GetInstance("Notes", id), "Attachments").DeleteAttachment(attachmentId)); }
/// <summary> /// To upload the attachment of the notes based on file path. /// </summary> /// <returns>APIResponse class instance.</returns> /// <param name="filePath">File path (String) of the note attachment</param> public APIResponse UploadAttachment(string filePath) { return(ZCRMModuleRelation.GetInstance(ZCRMRecord.GetInstance("Notes", id), "Attachments").UploadAttachment(filePath)); }
/// <summary> /// To delete the relation of the record based on ZCRMJunctionRecord class instance. /// </summary> /// <returns>APIResponse class instance.</returns> /// <param name="junctionRecord">ZCRMJunctionRecord class instance</param> public APIResponse DeleteRelation(ZCRMJunctionRecord junctionRecord) { return(ZCRMModuleRelation.GetInstance(this, junctionRecord).DeleteRelation()); }
/// <summary> /// To delete the attachment of the records based on attachment Id. /// </summary> /// <returns>APIResponse class instance.</returns> /// <param name="attachmentId">Id (Long) of the record attachment.</param> public APIResponse DeleteAttachment(long attachmentId) { return(ZCRMModuleRelation.GetInstance(this, "Attachments").DeleteAttachment(attachmentId)); }
/// <summary> /// To download the attachment of the records based on attachment Id. /// </summary> /// <returns>FileAPIResponse class instance.</returns> /// <param name="attachmentId">Id (Long) of the record attachment.</param> public FileAPIResponse DownloadAttachment(long attachmentId) { return(ZCRMModuleRelation.GetInstance(this, "Attachments").DownloadAttachment(attachmentId)); }
/// <summary> /// To upload the link as attachment of the records based on attachment URL. /// </summary> /// <returns>APIResponse class instance.</returns> /// <param name="attachmentUrl">Attachment URL (String) of the record</param> public APIResponse UploadLinkAsAttachment(String attachmentUrl) { return(ZCRMModuleRelation.GetInstance(this, "Attachments").UploadLinkAsAttachment(attachmentUrl)); }
/// <summary> /// To upload the attachment of the records based on attachment file path. /// </summary> /// <returns>APIResponse class instance.</returns> /// <param name="filePath">file path (String) of the record attachment.</param> public APIResponse UploadAttachment(String filePath) { return(ZCRMModuleRelation.GetInstance(this, "Attachments").UploadAttachment(filePath)); }
/// <summary> /// To get all attachments of the records based on page, perPage and modifiedSince(Header). /// </summary> /// <returns>BulkAPIResponse class instance.</returns> /// <param name="page">Starting page index (Integer)</param> /// <param name="perPage">Number of records per page (Integer)</param> /// <param name="modifiedSince">DateTime(ISO8601 format) to display attachments which are modified after the given input datetime (String)</param> public BulkAPIResponse <ZCRMAttachment> GetAttachments(int page, int perPage, string modifiedSince) { return(ZCRMModuleRelation.GetInstance(this, "Attachments").GetAttachments(page, perPage, modifiedSince)); }
/// <summary> /// To get all notes of the records based on sortByField, sortOrder, page, perPage and modifiedSince(Header). /// </summary> /// <returns>BulkAPIResponse class instance.</returns> /// <param name="sortByField">To sort the records based on this field (String)</param> /// <param name="sortOrder">Order preference - CommonUtil.SortOrder {asc/desc} <example>CommonUtil.SortOrder.asc</example></param> /// <param name="page">Starting page index (Integer)</param> /// <param name="perPage">Number of records per page (Integer)</param> /// <param name="modifiedSince">DateTime(ISO8601 format) to display notes which are modified after the given input datetime (String)</param> public BulkAPIResponse <ZCRMNote> GetNotes(string sortByField, CommonUtil.SortOrder?sortOrder, int page, int perPage, string modifiedSince) { return(ZCRMModuleRelation.GetInstance(this, "Notes").GetNotes(sortByField, sortOrder, page, perPage, modifiedSince)); }
/// <summary> /// To get all related list records based on related List APIName, sortByField, sortOrder, page, perPage and modifiedSince. /// </summary> /// <returns>BulkAPIResponse<ZCRMRecord> class instance.</returns> /// <param name="relatedListAPIName">APIName (String) of the record related list.</param> /// <param name="sortByField">To sort the records based on this field (String)</param> /// <param name="sortOrder">Order preference - CommonUtil.SortOrder {asc/desc} <example>CommonUtil.SortOrder.asc</example></param> /// <param name="page">Starting page index (Integer)</param> /// <param name="perPage">Number of records per page (Integer)</param> /// <param name="modifiedSince">DateTime to display records which are modified after the given input datetime (String)</param> public BulkAPIResponse <ZCRMRecord> GetRelatedListRecords(string relatedListAPIName, string sortByField, CommonUtil.SortOrder?sortOrder, int page, int perPage, string modifiedSince) { return(ZCRMModuleRelation.GetInstance(this, relatedListAPIName).GetRecords(sortByField, sortOrder, page, perPage, modifiedSince)); }
private ZCRMModule GetZCRMModule(JObject moduleDetails) { try { ZCRMModule module = ZCRMModule.GetInstance((string)moduleDetails["api_name"]); module.Id = Convert.ToInt64(moduleDetails["id"]); module.SystemName = (string)moduleDetails["module_name"]; module.SingularLabel = (string)moduleDetails["singular_label"]; module.PluralLabel = (string)moduleDetails["plural_label"]; module.Creatable = (bool)moduleDetails["creatable"]; module.Viewable = (bool)moduleDetails["viewable"]; module.Editable = (bool)moduleDetails["editable"]; module.Convertable = (bool)moduleDetails["convertable"]; module.Deletable = (bool)moduleDetails["deletable"]; module.CustomModule = (bool)(moduleDetails["generated_type"].ToString().Equals("custom")); module.ApiSupported = (bool)(moduleDetails["api_supported"]); JArray accessibleProfilesArray = (JArray)moduleDetails["profiles"]; foreach (JObject accessibleProfiles in accessibleProfilesArray) { ZCRMProfile profile = ZCRMProfile.GetInstance(Convert.ToInt64(accessibleProfiles["id"]), (string)accessibleProfiles["name"]); module.AddAccessibleProfile(profile); } if (moduleDetails["modified_by"].HasValues) { JObject modifiedByObject = (JObject)moduleDetails["modified_by"]; ZCRMUser modifiedUser = ZCRMUser.GetInstance(Convert.ToInt64(modifiedByObject["id"]), (string)modifiedByObject["name"]); module.ModifiedBy = modifiedUser; module.ModifiedTime = CommonUtil.removeEscaping((string)JsonConvert.SerializeObject(moduleDetails["modified_time"])); } if (moduleDetails.ContainsKey("related_lists") && moduleDetails["related_lists"].Type != JTokenType.Null) { List <ZCRMModuleRelation> relatedLists = new List <ZCRMModuleRelation>(); JArray relatedListsArray = (JArray)moduleDetails["related_lists"]; foreach (JObject relatedListDetails in relatedListsArray) { ZCRMModuleRelation relatedList = ZCRMModuleRelation.GetInstance(module.ApiName, (string)relatedListDetails["api_name"]); SetRelatedListProperties(relatedList, relatedListDetails); relatedLists.Add(relatedList); } module.RelatedLists = relatedLists; } if (moduleDetails.ContainsKey("business_card_fields") && moduleDetails.Type != JTokenType.Null) { List <string> bcFields = new List <string>(); JArray bcFieldsArray = (JArray)moduleDetails["business_card_fields"]; foreach (JObject bcField in bcFieldsArray) { bcFields.Add(bcField.ToString()); } module.BussinessCardFields = bcFields; } if (moduleDetails.ContainsKey("layouts")) { module.Layouts = ModuleAPIHandler.GetInstance(module).GetAllLayouts(moduleDetails); } return(module); } catch (Exception e) when(!(e is ZCRMException)) { ZCRMLogger.LogError(e); throw new ZCRMException(APIConstants.SDK_ERROR, e); } }
private void SetRelatedListProperties(ZCRMModuleRelation relatedList, JObject relatedListDetails) { relatedList.Id = Convert.ToInt64(relatedListDetails["id"]); relatedList.Visible = (bool)relatedListDetails["visible"]; relatedList.Label = (string)relatedListDetails["display_label"]; }
public static RelatedListAPIHandler GetInstance(ZCRMRecord parentRecord, ZCRMModuleRelation relatedList) { return(new RelatedListAPIHandler(parentRecord, relatedList)); }
private RelatedListAPIHandler(ZCRMRecord parentRecord, ZCRMModuleRelation relatedList) { this.parentRecord = parentRecord; this.relatedList = relatedList; }