public static string makePOST(PostSubmitter post)
        {
            string result = "";
            post.Type = PostSubmitter.PostTypeEnum.Post;

                result = post.Post();
            return result;

        }
        public static string makeGET(PostSubmitter post, string strSessionKey, HttpSessionState session, ref BFConfiguration configuration )
        {
            string result = "";
            post.Type = PostSubmitter.PostTypeEnum.Get;
            post.strSessionKey = strSessionKey;
            post.cookieContainer = configuration.cookieContainer;
            result = post.Post();

            return result;

        }
        // ********
        // This is the active Login method for this application
        // ********
        public static CurrentSession login(string strSessionKey, HttpSessionState session, BFConfiguration configuration)
        {
            string XForwardedFor = configuration.currentUser.ipAddress;

            if (string.IsNullOrEmpty(XForwardedFor)) return null;

            PostSubmitter post = new PostSubmitter();
            //post.Url = ServiceCaller.serviceUrlRoot(configuration) + "bms/auth/trusted.xml?devicePlatform=SPWebPart&X-Forwarded-For=" + System.Web.HttpUtility.UrlEncode(XForwardedFor);
            post.Url = ServiceCaller.serviceUrlRoot() + "bms/auth/trusted.xml?devicePlatform=SPWebPart&X-Forwarded-For=" + XForwardedFor;

            post.PostItems.Add("token", configuration.currentUser.sid);

            post.PostItems.Add("X-Forwarded-For", XForwardedFor);

            post.PostItems.Add("User-Agent", configuration.currentUser.userAgent);

            post.strSessionKey = strSessionKey;
            string BFLoginResponse = CommonFunctions.unLTGT(ServiceCaller.makePOST(post));

            string BFSessionKey = "";
            BFSessionKey = xmlReader.getValueBySimpleQuery(BFLoginResponse, "sessionKey", "", false);


            string BFPasscode = "";
            BFPasscode = xmlReader.getValueBySimpleQuery(BFLoginResponse, "passcode", "", false);

            CurrentSession _currentSession = new CurrentSession();
            _currentSession.sessionKey = BFSessionKey;
            _currentSession.passCode = BFPasscode;

            // bug27992: SharePoint portal authentication issue 
            // Modified - 09/18/2012
            // Serialized Session Information
            //session[CommonVariables.c_CookieContainer] = post.cookieContainer;
            configuration.currentSession = _currentSession;
            configuration.cookieContainer = post.cookieContainer;

            return _currentSession;

        }
        public static string getBizCoveHTMLData(HttpSessionState session, ref BFConfiguration configuration)
        {
            PostSubmitter post = new PostSubmitter();

            StringBuilder postUrl = new StringBuilder(4096);

            /*  Discarded 04/30/2014
            switch (configuration.BizCoveType)
            {
                case BFConfiguration.BizCoveTypes.Report:
                    postUrl.Append(BFActions_Report.getActionLink((int)configuration.BizCove, ref configuration));
                    break;
                case BFConfiguration.BizCoveTypes.ReportList:
                    postUrl.Append(BFActions_ReportList.getActionLink((int)configuration.BizCove, ref configuration));
                    break;
                case BFConfiguration.BizCoveTypes.ExternalReport:
                    postUrl.Append(BFActions_ExternalReport.getActionLink((int)configuration.BizCove, ref configuration));
                    break;
                case BFConfiguration.BizCoveTypes.UrlViewer:
                    postUrl.Append(BFActions_UrlViewer.getActionLink((int)configuration.BizCove, ref configuration));
                    break;
                default: return "";
            }

            */
            // On Test:

            return postUrl.ToString();

        }
        public static string getMyCompletedWorkitems(HttpSessionState session, ref BFConfiguration configuration)
        {
            if (configuration.currentPage <= 0) configuration.currentPage = 1;
            configuration.ItemLimit = 1000;

            PostSubmitter post = new PostSubmitter();
            StringBuilder postUrl = new StringBuilder(1024);

            postUrl.Append(ServiceCaller.serviceUrlRoot());
            postUrl.Append("bms/list/");
            postUrl.Append(BizCoveTypes.Monitor.ToString());
            postUrl.Append("/");
            postUrl.Append("1000043");   // Completed Processes 
            postUrl.Append(".xml?page=");
            if (configuration.currentPage > 0)
                postUrl.Append(configuration.currentPage.ToString());
            else
                postUrl.Append("1");

            postUrl.Append("&limit=");
            postUrl.Append(configuration.ItemLimit.ToString());


            post.Url = postUrl.ToString();
            post.strSessionKey = session.SessionID;

            post.cookieContainer = configuration.cookieContainer;

            string bizCoveDataString;

            bizCoveDataString = ServiceCaller.makeGET(post, session.SessionID, session, ref configuration);

            configuration.totalItems = Convert.ToInt16(xmlReader.getValueBySimpleQuery(bizCoveDataString, "total", "", false));

            if (configuration.totalItems == 0)
            {
                configuration.totalPages = 0;
            }

            if (!string.IsNullOrEmpty(bizCoveDataString))
            {
                configuration.completedData = CommonFunctions.getAllData(bizCoveDataString);
                
            }
            return bizCoveDataString;

        }
        public static string getBizCoveData_Delete(HttpSessionState session, ref BFConfiguration configuration)
        {
            if (configuration.currentPage <= 0) configuration.currentPage = 1;
            configuration.ItemLimit = 1000;

            PostSubmitter post = new PostSubmitter();
            StringBuilder postUrl = new StringBuilder(1024);

            postUrl.Append(ServiceCaller.serviceUrlRoot());
            postUrl.Append("bms/list/");
            postUrl.Append(BizCoveTypes.Worklist.ToString());
            postUrl.Append("/");
            postUrl.Append(configuration.BizCove.ToString());
            postUrl.Append(".xml?page=");
            if (configuration.currentPage > 0)
                postUrl.Append(configuration.currentPage.ToString());
            else
                postUrl.Append("1");

            postUrl.Append("&limit=");
            postUrl.Append(configuration.ItemLimit.ToString());

            #region discarded  // 04/30/2014

            //   04/30/2014
            /*
            if (configuration.bfFilter != null)
            {
                if (configuration.bfFilter.filterType == BFFilter.FilterType.QSFilterBy)
                {
                    postUrl.Append("&witemCategory=");
                    //postUrl.Append(CommonFunctions.getWorkItemStatusID(configuration.bfFilter.FilterValue));
                    postUrl.Append(CommonFunctions.mapFilterBy(configuration.bfFilter.FilterValue));
                }
                if (configuration.bfFilter.filterType == BFFilter.FilterType.QSText)
                {
                    postUrl.Append("&search=");
                    postUrl.Append(configuration.bfFilter.FilterValue);
                }
                if (configuration.bfFilter.filterType == BFFilter.FilterType.KeySearch)
                {
                    postUrl.Append("&");
                    postUrl.Append(configuration.bfFilter.FilterValue);
                }
                if (configuration.bfFilter.filterType == BFFilter.FilterType.AdvSearch)
                {
                    postUrl.Append("&advSearchKey=");
                    postUrl.Append(configuration.bfFilter.FilterValue);

                    // Deleting old Advance Search Session
                    configuration.bfFilter.filterType = BFFilter.FilterType.None;
                    configuration.bfFilter.FilterValue = "";
                }
            }
            */
            /*   04/30/2014
            if (configuration.bfSort != null)
            {
                string sortType = "";

                if (configuration.bfSort.sortType != BFSort.SortType.None)
                {
                    if (configuration.bfSort.sortType == BFSort.SortType.Asc)
                    {
                        sortType = "a";
                    }
                    else
                    {
                        sortType = "d";
                    }
                    postUrl.Append("&sort=");
                    postUrl.Append(configuration.bfSort.sortColumn);
                    postUrl.Append("|");
                    postUrl.Append(configuration.bfSort.dataType);
                    postUrl.Append("|");
                    postUrl.Append(sortType);
                    postUrl.Append("|");
                    postUrl.Append("column");

                }


            }
            */

#endregion

            post.Url = postUrl.ToString();
            post.strSessionKey = session.SessionID;

            post.cookieContainer = configuration.cookieContainer;

            string bizCoveDataString;

            bizCoveDataString = ServiceCaller.makeGET(post, session.SessionID, session, ref configuration);

            configuration.totalItems = Convert.ToInt16(xmlReader.getValueBySimpleQuery(bizCoveDataString, "total", "", false));

            if (configuration.totalItems == 0)
            {
                configuration.totalPages = 0;
            }

            if (!string.IsNullOrEmpty(bizCoveDataString))
            {
                configuration.sourceData = CommonFunctions.getAllData(bizCoveDataString);
                configuration.gridData = configuration.sourceData;
            }
            return bizCoveDataString;

        }
        public static void getBizCoveConfig(HttpSessionState session, ref BFConfiguration configuration)
        {

            PostSubmitter post = new PostSubmitter();
            post.Url = ServiceCaller.serviceUrlRoot() + "bms/bizcove/" + BizCoveTypes.Worklist + "/" + configuration.BizCove + ".xml";
            post.strSessionKey = session.SessionID;
            post.cookieContainer = configuration.cookieContainer;

            string bizCoveConfig;

            bizCoveConfig = ServiceCaller.makeGET(post, session.SessionID, session, ref configuration);

            getBizCoveConfigSection(ref configuration, bizCoveConfig, true);   // For fetching actionConfiguration         
            getBizCoveConfigSection(ref configuration, bizCoveConfig, false);  // For fetching columnConfiguration
            getBizCoveFilterSection(ref configuration, bizCoveConfig);         // For filter criteria  
        }
        public static DataTable getBizCoveIDs(string strBizCoveType, HttpSessionState session, ref BFConfiguration configuration)
        {
            PostSubmitter post = new PostSubmitter();
            post.Url = ServiceCaller.serviceUrlRoot() + "bms/bizcove/" + strBizCoveType + ".xml";
            //post.strSessionKey = strSessionKey;
            post.strSessionKey = session.SessionID;

            // bug27992: SharePoint portal authentication issue 
            // Modified - 09/18/2012
            // Serialized Session Information
            //post.cookieContainer = (CookieContainer)session[CommonVariables.c_CookieContainer];
            post.cookieContainer = configuration.cookieContainer;

            string bizCoveType;

            bizCoveType = xmlReader.getValueBySimpleQuery(ServiceCaller.makeGET(post, session.SessionID, session, ref configuration), "HWRECBODY", "", true).Trim();

            DataSet dts = new DataSet();
            XmlDocument xDoc = new XmlDocument();

            try
            {
                dts = xmlReader.getDataSetFromXmlDocument(bizCoveType, "HWCOVELIST");
            }
            catch (Exception)
            {
            }

            if (dts.Tables.Count == 0) return null;

            return dts.Tables[0];


        }
        public static bool loginWithSessionKey(string strSessionKey, BFConfiguration configuration)
        {
            PostSubmitter post = new PostSubmitter();
            post.Url = ServiceCaller.serviceUrlRoot() + "bms/auth/sessionkey.xml";
            post.PostItems.Add("sessionKey", strSessionKey);
            post.strSessionKey = strSessionKey;

            string BFSessionKey;

            //BFSessionKey = xmlReader.getScalarValue(ServiceCaller.makeCall(post), "/");

            BFSessionKey = ServiceCaller.makePOST(post);

            return true;
        }