示例#1
0
 private string ConstructUrlParams(IIsAction action, View? view, int numRows)
 {
     string msg = "";
     const string toolname = "BCHECK";
     string baseUrl = ViewModel.ListAsmxUrl;
     switch (action)
     {
         case IIsAction.ALERTS:
             {
                 msg = string.Format("{0}?TOOLNAME={1}&ACTION={2}", baseUrl, toolname, action.ToString());
             }
             break;
         case IIsAction.QUERY:
             {
                 if (view == null) throw new ArgumentException("The parameter view cannot be NULL when action=QUERY", "view");
                 msg = string.Format("{0}?TOOLNAME={1}&ACTION={2}&VIEW={3}", baseUrl, toolname, action.ToString(), view.ToString());
             }
             break;
     }
     return msg;
 }
示例#2
0
        /// <summary>
        /// Internal function for constructing the URL for the List web service.
        /// This method will append parameters to the URL
        /// Rationale: IIS logs would be more meaningful with these parameters. Would help us in 
        /// determining the profile of usage.
        /// </summary>
        /// <returns></returns>
        private string ConstructUrlParams(IIsAction action, View? view, int numRows)
        {
            string msg = "";
            const string toolname = "BCHECK";
            string baseUrl = ViewModel.ListAsmxUrl;
            switch (action)
            {
                case IIsAction.ALERTS:
                    {
                        msg = string.Format("{0}?TOOLNAME={1}&ACTION={2}", baseUrl, toolname, action.ToString());
                    }
                    break;
                case IIsAction.QUERY:
                    {
                        if (view == null) throw new ArgumentException("The parameter view cannot be NULL when action=QUERY", "view");
                        msg = string.Format("{0}?TOOLNAME={1}&ACTION={2}&VIEW={3}", baseUrl, toolname, action.ToString(), view.ToString());
                    }
                    break;
                case IIsAction.QUERYSINGLE:
                    {
                        msg = string.Format("{0}?TOOLNAME={1}&ACTION={2}", baseUrl, toolname, action.ToString());
                    }
                    break;
                case IIsAction.SUMMARY:
                    {
                        if (view == null) throw new ArgumentException("The parameter view cannot be NULL when action=SUMMARY", "view");
                        msg = string.Format("{0}?TOOLNAME={1}&ACTION={2}&VIEW={3}", baseUrl, toolname, action.ToString(), view.ToString());
                    }
                    break;
                case IIsAction.UPDATESINGLE:
                    {
                        msg = string.Format("{0}?TOOLNAME={1}&ACTION={2}", baseUrl, toolname, action.ToString());
                    }
                    break;
                case IIsAction.UPDATEBULK:
                    {
                        if (numRows < 0) throw new ArgumentException("Number of rows should be a positive number", "numRows");
                        msg = string.Format("{0}?TOOLNAME={1}&ACTION={2}&NUMROWS={3}", baseUrl, toolname, action.ToString(), numRows);
                    }
                    break;
                case IIsAction.GETATTACHMENTS:
                    {
                        msg = string.Format("{0}?TOOLNAME={1}&ACTION={2}", baseUrl, toolname, action.ToString());
                    }
                    break;
                case IIsAction.DELETEATTACHMENT:
                case IIsAction.ADDATTACHMENT:
                    {
                        msg = string.Format("{0}?TOOLNAME={1}&ACTION={2}", baseUrl, toolname, action.ToString());
                    }
                    break;
                case IIsAction.VIEWATTACHMENT:
                    {
                        throw new NotImplementedException("Viewing attachments is done through direct URL access and not using Web Services");
                    }
                case IIsAction.UPDATEOWNERSHIP:
                    {
                        if (numRows < 0) throw new ArgumentException("Number of rows should be a positive number", "numRows");
                        msg = string.Format("{0}?TOOLNAME={1}&ACTION={2}&NUMROWS={3}", baseUrl, toolname, action.ToString(), numRows);
                    }
                    break;
                case IIsAction.UPDATECOMMENTS:
                    {
                        if (numRows < 0) throw new ArgumentException("Number of rows should be a positive number", "numRows");
                        msg = string.Format("{0}?TOOLNAME={1}&ACTION={2}&NUMROWS={3}", baseUrl, toolname, action.ToString(), numRows);
                    }
                    break;
                case IIsAction.UPDATETIMETOCOMPLETE:
                    {
                        if (numRows < 0) throw new ArgumentException("Number of rows should be a positive number", "numRows");
                        msg = string.Format("{0}?TOOLNAME={1}&ACTION={2}&NUMROWS={3}", baseUrl, toolname, action.ToString(), numRows);
                    }
                    break;

                case IIsAction.UPDATELATEINCOMPLETEREASON:
                    {
                        if (numRows < 0) throw new ArgumentException("Number of rows should be a positive number", "numRows");
                        msg = string.Format("{0}?TOOLNAME={1}&ACTION={2}&NUMROWS={3}", baseUrl, toolname, action.ToString(), numRows);
                    }
                    break;

            }
            return msg;
        }