Exemple #1
0
        public void SaveWorkReport(WorkReport item, KeyValuePair <string, string>?additionalField)
        {
            JObject additionalFields = new JObject();

            if (additionalField != null)
            {
                additionalFields.Add(additionalField.Value.Key, item.ReservedField);
            }

            this.connection.CallMethod("SaveWorkReport", JObject.FromObject(new
            {
                transmitObject = JObject.FromObject(new
                {
                    ItemGUID             = item.ItemGuid,
                    ItemVersion          = 1,
                    Subject              = item.Subject,
                    From                 = item.FromTime.ToStringForApi(),
                    To                   = item.ToTime.ToStringForApi(),
                    Duration             = Math.Round((item.ToTime.Subtract(item.FromTime)).TotalHours, 2),
                    TypeEn               = item.Type,
                    Projects_ProjectGuid = (item.ProjectItem.FolderName ?? "Projects") == "Projects" ? (Guid?)item.Project : null,
                    Leads_LeadGuid       = item.ProjectItem.FolderName == "Leads" ? (Guid?)item.Project : null,
                    Users_PersonGuid     = item.UserItem.ItemGuid,
                    Note                 = item.Note,
                    AdditionalFields     = additionalFields
                }),
                dieOnItemConflict = false
            }));
        }
Exemple #2
0
 /// <summary>
 /// Saves WorkReport into the remote item store.
 /// </summary>
 /// <returns>True if everything went ok</returns>
 public static void SaveWorkReport(WorkReport item)
 {
     ItemStore.Instance.SaveWorkReport(item, Items.ReservedField);
 }