Beispiel #1
0
 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);
     }
 }
Beispiel #2
0
 /// <summary>
 /// To get the custom view based on custom view Id of the module.
 /// </summary>
 /// <returns>APIResponse class instance</returns>
 /// <param name="cvId">Custom view Id (Long) of module</param>
 public APIResponse GetCustomView(long cvId)
 {
     return(ModuleAPIHandler.GetInstance(this).GetCustomView(cvId));
 }
Beispiel #3
0
 /// <summary>
 /// To get all custom views of the module that are modified after the date-time specified in the If-Modified-Since Header.
 /// </summary>
 /// <returns>BulkAPIResponse&lt;ZCRMCustomView&gt; class instance.</returns>
 /// <param name="modifiedSince">DateTime(ISO8601 format) to display custom views which are modified after the given input datetime (String)</param>
 public BulkAPIResponse <ZCRMCustomView> GetAllCustomViews(string modifiedSince)
 {
     return(ModuleAPIHandler.GetInstance(this).GetAllCustomViews(modifiedSince));
 }
Beispiel #4
0
 /// <summary>
 /// To get layout details based on layout Id of the module.
 /// </summary>
 /// <returns>APIResponse class instance.</returns>
 /// <param name="layoutId">Layout Id (Long) of the module.</param>
 public APIResponse GetLayoutDetails(long layoutId)
 {
     return(ModuleAPIHandler.GetInstance(this).GetLayoutDetails(layoutId));
 }
Beispiel #5
0
 /// <summary>
 /// To get all layouts of the module that are modified after the date-time specified in the If-Modified-Since Header
 /// </summary>
 /// <returns>BulkAPIResponse&lt;ZCRMLayout&gt; class instance.</returns>
 /// <param name="modifiedSince">DateTime(ISO8601 format) to display layouts which are modified after the given input datetime (String)</param>
 public BulkAPIResponse <ZCRMLayout> GetAllLayouts(string modifiedSince)
 {
     return(ModuleAPIHandler.GetInstance(this).GetAllLayouts(modifiedSince));
 }
Beispiel #6
0
 /// <summary>
 /// To get related lists of the module.
 /// </summary>
 /// <returns>BulkAPIResponse&lt;ZCRMModuleRelation&gt; class instance</returns>
 public BulkAPIResponse <ZCRMModuleRelation> GetRelatedLists()
 {
     return(ModuleAPIHandler.GetInstance(this).GetAllRelatedLists());
 }