Exemplo n.º 1
0
 public static void EnsureValueIsSupportedByServerVersion(IProjectObject obj, SpecialDataFieldFormat value)
 {
     var serverVersion = obj.Session.ServerVersion;
     switch (value)
     {
         case SpecialDataFieldFormat.DefaultUserDefined:
         case SpecialDataFieldFormat.DefaultHTML:
         case SpecialDataFieldFormat.DefaultImage:
             return;
         case SpecialDataFieldFormat.TextUserDefined:
         case SpecialDataFieldFormat.DateUserDefined:
         case SpecialDataFieldFormat.CurrencyUserDefined:
             var version = new Version(11, 0);
             if (serverVersion < version)
             {
                 throw new SmartAPIException(obj.Session.ServerLogin,
                                             string.Format(
                                                 "Cannot set {0} to value {1} for server versions older than {2}",
                                                 RedDotAttributeDescription.GetDescriptionForElement(
                                                     "eltcolumniotype"), value.ToString(), version));
             }
             return;
         default:
             throw new ArgumentException(string.Format("Unknown {0} value: {1}",
                                                       typeof (SpecialDataFieldFormat).Name, value));
     }
 }
Exemplo n.º 2
0
        private void GenericRemove(IProjectObject[] entries, string type)
        {
            if (entries == null || entries.Length == 0)
            {
                return;
            }

            const string REMOVE_ENTRY =
                @"<ADMINISTRATION><USER guid=""{0}""><CLIPBOARDDATA action=""remove"" projectguid=""{1}"">{2}</CLIPBOARDDATA></USER></ADMINISTRATION>";

            var entryStr = string.Join("", entries.Select(x => SINGLE_ENTRY.RQLFormat(x, type)));

            var doc = Project.ExecuteRQL(REMOVE_ENTRY.RQLFormat(Session.CurrentUser, Project, entryStr));

            if (!doc.InnerText.Contains("ok"))
            {
                throw new SmartAPIException(Session.ServerLogin, "Error removing entries from clipboard");
            }

            InvalidateCache();
        }