Ejemplo n.º 1
0
    public static Int32 REG_HEADER()
    {
        //Get REGISTRATIONID from header
        Int32  objREGISTRATIONID = 0;
        Int32  objCOUNT          = 0;
        string objREGID          = string.Empty;

        try
        {
            IncomingWebRequestContext request = WebOperationContext.Current.IncomingRequest;
            WebHeaderCollection       headers = request.Headers;
            //Initialize Logger
            log4net.Config.XmlConfigurator.Configure();
            //Initialize Logger

            objREGID          = request.Headers["REGISTRATIONID"];
            objREGISTRATIONID = objDb.DEC_REGID(objREGID);
            ////Console.WriteLine(request.Method + " " + request.UriTemplateMatch.RequestUri.AbsolutePath);
            //foreach (string headerName in headers.AllKeys)
            //{
            //    if (headerName == "REGISTRATIONID")
            //    {
            //        objREGID = headers[headerName];
            //        objREGISTRATIONID = objDb.DEC_REGID(headers[headerName]);
            //    }
            //    //Console.WriteLine(headerName + ": " + headers[headerName]);
            //}

            if (objREGISTRATIONID != 0)
            {
                System.Threading.Thread.Sleep(10);
                Hashtable parameters_login = new Hashtable();
                //Get REGISTRATIONID OF active user
                parameters_login.Clear();
                parameters_login.Add("@REGISTRATIONID", objREGISTRATIONID);

                objCOUNT = Convert.ToInt32(objDb.SendValue_Parameter("SELECT COUNT(1) FROM STBL_REGISTRATION WITH(NOLOCK) WHERE REGISTRATIONID=@REGISTRATIONID AND STATUS=1", parameters_login));
                if (objCOUNT == 0)
                {
                    logger.Error("Common.cs/REG_HEADER: " + objREGISTRATIONID.ToString());
                    objREGISTRATIONID = 0;
                }
                //Get REGISTRATIONID OF active user
            }
        }
        catch (Exception ex)
        {
            ctx.OutgoingResponse.StatusCode = (System.Net.HttpStatusCode) 200;
            logger.Error("Common.cs/REG_HEADER_Error: REGID:" + objREGID + "::" + objREGISTRATIONID.ToString() + "/" + ex.Message.ToString() + "::" + ex.StackTrace.ToString());
            objREGISTRATIONID = 0;
        }
        return(objREGISTRATIONID);
    }