Exemplo n.º 1
0
    /// <summary>
    /// Made for debug purposes, to see what the webservices return ...
    /// </summary>
    /// <param name="sValueWeReturn"></param>
    /// <returns></returns>
    public string MAIN_STRING_RETURN(bool bSuperDeveloperTesting, string sValueWeReturn)
    {
        if (bSuperDeveloperTesting)
        {
            return(sValueWeReturn);
        }

        try
        {
            string sDetailedFunction = "Not found ...";
            string sCallStack        = Environment.StackTrace;
            if (sCallStack != null && sCallStack.Length > 0)
            {
                string[] callStackTable = sCallStack.Split("\r\n".ToCharArray());

                if (callStackTable != null && callStackTable.Length > 6)
                {
                    string sCall = callStackTable[6]; // This is the method we call +1 level higher up in the call stack ...

                    int start = sCall.IndexOf(".");
                    int end   = sCall.IndexOf(")");

                    if (start > 0 && end > 0 && end > start)
                    {
                        sDetailedFunction = sCall.Substring(start + 1, end - start);
                    }
                }
            }


            string sSqlReadyText = sValueWeReturn;
            sSqlReadyText = sSqlReadyText.Replace("'", "&quot;");

            xSQL_InsertBuilder sb = new xSQL_InsertBuilder((webservice_database)this, "webservice_log");

            DateTime now = DateTime.Now;

            if (sDetailedFunction.Length > 99)
            {
                sDetailedFunction = sDetailedFunction.Substring(0, 98);
            }
            sb.add("name", sDetailedFunction);
            sb.add("timestamp", now.Year.ToString() + "." + zero_2(now.Month.ToString()) + "." + zero_2(now.Day.ToString()) + " " + zero_2(now.Hour.ToString()) + ":" + zero_2(now.Minute.ToString()) + ":" + zero_2(now.Second.ToString()) + " " + zero_3(now.Millisecond.ToString()));
            sb.add("parameters", "RETURNED: " + sSqlReadyText);
            bool bOK = sb.ExecuteSql();
        } catch (Exception e)
        {
            return(sValueWeReturn);
        }
        return(sValueWeReturn);
    }
    public bool save_page_view()
    {
        bool bOK = false;

        try
        {
            xSQL_InsertBuilder ib = new xSQL_InsertBuilder(this, "bank_phone_page_view");
            ib.add("timestamp", DateTime.Now);
            bool bOk = ib.ExecuteSql();
        }
        catch (Exception)
        {
        }
        finally
        {
        }

        return(bOK);
    }
    public bool save_phone(string sPhone)
    {
        bool bOK = false;

        try
        {
            xSQL_InsertBuilder ib = new xSQL_InsertBuilder(this, "bank_phone");
            ib.add("phone", sPhone);
            bool bOk = ib.ExecuteSql();
        }
        catch (Exception)
        {
        }
        finally
        {
        }

        return(bOK);
    }
    public bool save_phone(string sPhone)
    {
        bool bOK = false;

        try
        {
            xSQL_InsertBuilder ib = new xSQL_InsertBuilder(this, "bank_phone");
            ib.add("phone", sPhone);
            bool bOk = ib.ExecuteSql();
        }
        catch (Exception)
        {
        }
        finally
        {
        }

        return bOK;
    }
    /// <summary>
    /// Made for debug purposes, to see what the webservices return ...
    /// </summary>
    /// <param name="sValueWeReturn"></param>
    /// <returns></returns>
    public string MAIN_STRING_RETURN(bool bSuperDeveloperTesting, string sValueWeReturn)
    {
        if (bSuperDeveloperTesting) return sValueWeReturn;

        try
        {
            string sDetailedFunction = "Not found ...";
            string sCallStack = Environment.StackTrace;
            if (sCallStack != null && sCallStack.Length > 0)
            {
                string[] callStackTable = sCallStack.Split("\r\n".ToCharArray());

                if (callStackTable != null && callStackTable.Length > 6)
                {
                    string sCall = callStackTable[6]; // This is the method we call +1 level higher up in the call stack ...

                    int start = sCall.IndexOf(".");
                    int end = sCall.IndexOf(")");

                    if (start > 0 && end > 0 && end > start)
                    {
                        sDetailedFunction = sCall.Substring(start + 1, end - start);
                    }
                }
            }


            string sSqlReadyText = sValueWeReturn;
            sSqlReadyText = sSqlReadyText.Replace("'", "&quot;");

            xSQL_InsertBuilder sb = new xSQL_InsertBuilder((webservice_database)this, "webservice_log");

            DateTime now = DateTime.Now;

            if (sDetailedFunction.Length > 99) sDetailedFunction = sDetailedFunction.Substring(0, 98);
            sb.add("name", sDetailedFunction);
            sb.add("timestamp", now.Year.ToString() + "." + zero_2(now.Month.ToString()) + "." + zero_2(now.Day.ToString()) + " " + zero_2(now.Hour.ToString()) + ":" + zero_2(now.Minute.ToString()) + ":" + zero_2(now.Second.ToString()) + " " + zero_3(now.Millisecond.ToString()));
            sb.add("parameters", "RETURNED: " + sSqlReadyText);
            bool bOK = sb.ExecuteSql();

        } catch (Exception e)
        {
            return sValueWeReturn;
        }
        return sValueWeReturn;
    }
    public bool log_call(string sActualParameters)
    {
        try
        {
            if (!isBlank(sActualParameters))
            {
                sActualParameters = sActualParameters.Replace("'", "_");
                // sActualParameters = sActualParameters.Replace("\"", "_");

                if (sActualParameters.Length > 5000) sActualParameters = sActualParameters.Substring(0, 4999);

            } else
                sActualParameters = "";

            bool bOK = false;

            string sDetailedFunction = "Not found ...";
            string sCallStack = Environment.StackTrace;
            if (sCallStack != null && sCallStack.Length > 0)
            {
                string[] callStackTable = sCallStack.Split("\r\n".ToCharArray());

                if (callStackTable != null && callStackTable.Length > 6)
                {
                    string sCall = callStackTable[6];

                    int start = sCall.IndexOf(".");
                    int end = sCall.IndexOf(")");

                    if (start > 0 && end > 0 && end > start)
                    {
                        sDetailedFunction = sCall.Substring(start + 1, end - start);
                    }
                }
            }

            if (isBlank(sActualParameters))
            {
                sActualParameters = "";
            }

            sActualParameters = sActualParameters.Replace("'", "_");
            sActualParameters = sActualParameters.Replace("\"", "_");

            // xSQL_InsertBuilder sb = new xSQL_InsertBuilder(iCommonPointer, "webservice_log");
            xSQL_InsertBuilder sb = new xSQL_InsertBuilder((webservice_database)this, "webservice_log");

            DateTime now = DateTime.Now;

            if (sDetailedFunction.Length > 99) sDetailedFunction = sDetailedFunction.Substring(0, 98);
            sb.add("name", sDetailedFunction);
            // sb.add("timestamp", DateTime.Now.ToLongDateString() + " - " + DateTime.Now.ToLongTimeString());
            sb.add("timestamp", now.Year.ToString() + "." + zero_2(now.Month.ToString()) + "." + zero_2(now.Day.ToString()) + " " + zero_2(now.Hour.ToString()) + ":" + zero_2(now.Minute.ToString()) + ":" + zero_2(now.Second.ToString()) + " " + zero_3(now.Millisecond.ToString()));
            sb.add("parameters", sActualParameters);
            bOK = sb.ExecuteSql();
        } catch (Exception)
        {
            return false;
        }
        return true;
    }
    public bool log_user_action(string sConsumerGuid, string sSubAction, string sActualParameters)
    {
        try
        {
            if (sSubAction == null) sSubAction = "";
            if (sSubAction.Length > 50) sSubAction = sSubAction.Substring(0, 49);

            string sCouponId = "";
            if (!isBlank(sActualParameters))
            {
                sActualParameters = sActualParameters.Replace("'", "_");
                sActualParameters = sActualParameters.Replace("\"", "_");
                string[] tab = sActualParameters.Split(";".ToCharArray());
                if (tab != null && tab.Length > 0)
                {
                    for (int i = 0; i < tab.Length; ++i)
                    {
                        string[] tab2 = tab[i].Split("=".ToCharArray());

                        if (tab2 != null && tab2.Length == 2)
                        {
                            if (tab2[0] == "coupon_id")
                            {
                                sCouponId = tab2[1];
                            }
                        }
                    }
                }
            }
            bool bOK = false;

            string sDetailedFunction = "Not found ...";
            string sFunctionCall = "void";
            string sCallStack = Environment.StackTrace;
            if (sCallStack != null && sCallStack.Length > 0)
            {
                string[] callStackTable = sCallStack.Split("\r\n".ToCharArray());

                if (callStackTable != null && callStackTable.Length > 6)
                {
                    string sCall = callStackTable[6];

                    int start = sCall.IndexOf(".");
                    int end = sCall.IndexOf(")");

                    if (start > 0 && end > 0 && end > start)
                    {
                        sDetailedFunction = sCall.Substring(start + 1, end - start);
                        int iStartPar = sDetailedFunction.IndexOf("(");
                        if (iStartPar > 0)
                        {
                            sFunctionCall = sDetailedFunction.Substring(0, iStartPar);
                        }
                    }
                }
            }

            if (isBlank(sActualParameters))
            {
                sActualParameters = "";
            } else if (sActualParameters.Length > 199)
            {
                sActualParameters = sActualParameters.Substring(0, 199);
            }
            sActualParameters = sActualParameters.Replace("'", "_");
            sActualParameters = sActualParameters.Replace("\"", "_");

            xSQL_InsertBuilder sb = new xSQL_InsertBuilder((webservice_database)this, "user_action");

            if (sConsumerGuid.Length > 50) sConsumerGuid = sConsumerGuid.Substring(0, 49);
            if (sActualParameters.Length > 99) sActualParameters = sActualParameters.Substring(0, 98);
            if (sFunctionCall.Length > 50) sFunctionCall = sFunctionCall.Substring(0, 49);
            sb.add("consumer_guid", sConsumerGuid);
            if (sCouponId != "") sb.add("coupon_id", sCouponId);
            sb.add("action", sFunctionCall);
            sb.add("sub_action", sSubAction);
            sb.add("parameters", sActualParameters);
            sb.add("timestamp", DateTime.Now.Subtract(new TimeSpan(1, 0, 0))); // 19 nov fix we get 1 hour wrong on Azure !!!

            bOK = sb.ExecuteSql();
        } catch (Exception e)
        {
            log_call("PROBLEM");
            return false;
        }
        return true;
    }
Exemplo n.º 8
0
    public bool log_call(string sActualParameters)
    {
        try
        {
            if (!isBlank(sActualParameters))
            {
                sActualParameters = sActualParameters.Replace("'", "_");
                // sActualParameters = sActualParameters.Replace("\"", "_");

                if (sActualParameters.Length > 5000)
                {
                    sActualParameters = sActualParameters.Substring(0, 4999);
                }
            }
            else
            {
                sActualParameters = "";
            }

            bool bOK = false;

            string sDetailedFunction = "Not found ...";
            string sCallStack        = Environment.StackTrace;
            if (sCallStack != null && sCallStack.Length > 0)
            {
                string[] callStackTable = sCallStack.Split("\r\n".ToCharArray());

                if (callStackTable != null && callStackTable.Length > 6)
                {
                    string sCall = callStackTable[6];

                    int start = sCall.IndexOf(".");
                    int end   = sCall.IndexOf(")");

                    if (start > 0 && end > 0 && end > start)
                    {
                        sDetailedFunction = sCall.Substring(start + 1, end - start);
                    }
                }
            }

            if (isBlank(sActualParameters))
            {
                sActualParameters = "";
            }

            sActualParameters = sActualParameters.Replace("'", "_");
            sActualParameters = sActualParameters.Replace("\"", "_");

            // xSQL_InsertBuilder sb = new xSQL_InsertBuilder(iCommonPointer, "webservice_log");
            xSQL_InsertBuilder sb = new xSQL_InsertBuilder((webservice_database)this, "webservice_log");

            DateTime now = DateTime.Now;

            if (sDetailedFunction.Length > 99)
            {
                sDetailedFunction = sDetailedFunction.Substring(0, 98);
            }
            sb.add("name", sDetailedFunction);
            // sb.add("timestamp", DateTime.Now.ToLongDateString() + " - " + DateTime.Now.ToLongTimeString());
            sb.add("timestamp", now.Year.ToString() + "." + zero_2(now.Month.ToString()) + "." + zero_2(now.Day.ToString()) + " " + zero_2(now.Hour.ToString()) + ":" + zero_2(now.Minute.ToString()) + ":" + zero_2(now.Second.ToString()) + " " + zero_3(now.Millisecond.ToString()));
            sb.add("parameters", sActualParameters);
            bOK = sb.ExecuteSql();
        } catch (Exception)
        {
            return(false);
        }
        return(true);
    }
Exemplo n.º 9
0
    public bool log_user_action(string sConsumerGuid, string sSubAction, string sActualParameters)
    {
        try
        {
            if (sSubAction == null)
            {
                sSubAction = "";
            }
            if (sSubAction.Length > 50)
            {
                sSubAction = sSubAction.Substring(0, 49);
            }

            string sCouponId = "";
            if (!isBlank(sActualParameters))
            {
                sActualParameters = sActualParameters.Replace("'", "_");
                sActualParameters = sActualParameters.Replace("\"", "_");
                string[] tab = sActualParameters.Split(";".ToCharArray());
                if (tab != null && tab.Length > 0)
                {
                    for (int i = 0; i < tab.Length; ++i)
                    {
                        string[] tab2 = tab[i].Split("=".ToCharArray());

                        if (tab2 != null && tab2.Length == 2)
                        {
                            if (tab2[0] == "coupon_id")
                            {
                                sCouponId = tab2[1];
                            }
                        }
                    }
                }
            }
            bool bOK = false;

            string sDetailedFunction = "Not found ...";
            string sFunctionCall     = "void";
            string sCallStack        = Environment.StackTrace;
            if (sCallStack != null && sCallStack.Length > 0)
            {
                string[] callStackTable = sCallStack.Split("\r\n".ToCharArray());

                if (callStackTable != null && callStackTable.Length > 6)
                {
                    string sCall = callStackTable[6];

                    int start = sCall.IndexOf(".");
                    int end   = sCall.IndexOf(")");

                    if (start > 0 && end > 0 && end > start)
                    {
                        sDetailedFunction = sCall.Substring(start + 1, end - start);
                        int iStartPar = sDetailedFunction.IndexOf("(");
                        if (iStartPar > 0)
                        {
                            sFunctionCall = sDetailedFunction.Substring(0, iStartPar);
                        }
                    }
                }
            }

            if (isBlank(sActualParameters))
            {
                sActualParameters = "";
            }
            else if (sActualParameters.Length > 199)
            {
                sActualParameters = sActualParameters.Substring(0, 199);
            }
            sActualParameters = sActualParameters.Replace("'", "_");
            sActualParameters = sActualParameters.Replace("\"", "_");

            xSQL_InsertBuilder sb = new xSQL_InsertBuilder((webservice_database)this, "user_action");

            if (sConsumerGuid.Length > 50)
            {
                sConsumerGuid = sConsumerGuid.Substring(0, 49);
            }
            if (sActualParameters.Length > 99)
            {
                sActualParameters = sActualParameters.Substring(0, 98);
            }
            if (sFunctionCall.Length > 50)
            {
                sFunctionCall = sFunctionCall.Substring(0, 49);
            }
            sb.add("consumer_guid", sConsumerGuid);
            if (sCouponId != "")
            {
                sb.add("coupon_id", sCouponId);
            }
            sb.add("action", sFunctionCall);
            sb.add("sub_action", sSubAction);
            sb.add("parameters", sActualParameters);
            sb.add("timestamp", DateTime.Now.Subtract(new TimeSpan(1, 0, 0))); // 19 nov fix we get 1 hour wrong on Azure !!!

            bOK = sb.ExecuteSql();
        } catch (Exception e)
        {
            log_call("PROBLEM");
            return(false);
        }
        return(true);
    }
    public bool save_page_view()
    {
        bool bOK = false;

        try
        {
            xSQL_InsertBuilder ib = new xSQL_InsertBuilder(this, "bank_phone_page_view");
            ib.add("timestamp", DateTime.Now);
            bool bOk = ib.ExecuteSql();
        }
        catch (Exception)
        {
        }
        finally
        {
        }

        return bOK;
    }