Пример #1
0
        internal static string GetIDsMove(HttpSessionState session, string[] parameters, out int userID, out int oldContainerID, out int newContainerID, out List <int> contentIDList)
        {
            oldContainerID = -1;
            newContainerID = -1;
            contentIDList  = new List <int>();

            if (!Helper.TryGetUserID(session, out userID))
            {
                return(String.Empty);
            }

            if (parameters.Length < 4)
            {
                return(ErrorWrapper.SendError("Command parameters missing."));
            }

            if (!int.TryParse(parameters[1], out oldContainerID))
            {
                return(ErrorWrapper.SendError("Invalid Old Folder ID"));
            }

            if (!int.TryParse(parameters[2], out newContainerID))
            {
                return(ErrorWrapper.SendError("Invalid New Folder ID"));
            }

            string[] contentIDs = parameters[3].Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string stringID in contentIDs)
            {
                int contentID;

                if (!int.TryParse(stringID, out contentID))
                {
                    return(ErrorWrapper.SendError("Invalid ID"));
                }

                contentIDList.Add(contentID);
            }

            return("1");
        }
Пример #2
0
        internal static string GetContentIDs(string IDs, out List <int> contentIDList)
        {
            contentIDList = new List <int>();

            string[] contentIDs = IDs.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string stringID in contentIDs)
            {
                int contentID;

                if (!int.TryParse(stringID, out contentID))
                {
                    return(ErrorWrapper.SendError("Invalid ID"));
                }

                contentIDList.Add(contentID);
            }

            return("1");
        }
Пример #3
0
        // format: command,,containerID,,ID1||ID2||ID3...
        internal static string GetIDs(HttpSessionState session, string[] parameters, out int userID, out int containerID, out List <int> contentIDList)
        {
            containerID   = -1;
            contentIDList = null;

            if (!TryGetUserID(session, out userID))
            {
                return(String.Empty);
            }

            if (parameters.Length < 3)
            {
                return(ErrorWrapper.SendError("Command parameters missing."));
            }

            if (!int.TryParse(parameters[1], out containerID))
            {
                return(ErrorWrapper.SendError("Invalid Folder ID"));
            }

            return(GetContentIDs(parameters[2], out contentIDList));
        }