Exemplo n.º 1
0
        public static bool IsParamsValid(this SqlServerRequestHandler Handler, HttpMethod Method, HttpContext Context)
        {
            bool IsValid = false;

            string[] RequiredParameters;

            if (Method.Equals(HttpMethod.Post))
            {
                RequiredParameters = new string[] { "EntryKey", "StoreUsername", "EntryName", "EntryUse" }
            }
            ;
            else
            {
                RequiredParameters = new string[] { "EntryKey", "StoreUsername" }
            };

            foreach (string Parameter in RequiredParameters)
            {
                if (Context.Request.Query.TryGetValue(Parameter, out var ParamValue))
                {
                    if (!ParamValue.ToString().Equals(""))
                    {
                        IsValid = true;
                    }
                }
            }
            return(IsValid);
        }
Exemplo n.º 2
0
        public static bool IsRecordsAffected(this SqlServerRequestHandler Handler)
        {
            bool IsAffected = true;

            if (Handler.ResultTable.Rows.Count.Equals(0))
            {
                IsAffected = false;
            }

            return(IsAffected);
        }
Exemplo n.º 3
0
        public static bool IsExceptionRaised(this SqlServerRequestHandler Handler)
        {
            bool ExceptionRaised = false;

            if (Handler.DictionaryLog.ContainsKey("Exception"))
            {
                ExceptionRaised = true;
            }

            return(ExceptionRaised);
        }
Exemplo n.º 4
0
        // Convert the first Row of Data to a Dictionary(All Data left over is Discarded )
        public static Dictionary <string, string> ToDictionary(this SqlServerRequestHandler Handler)
        {
            Dictionary <string, string> DTable = new Dictionary <string, string>();

            foreach (DataRow Row in Handler.ResultTable.Rows)
            {
                foreach (DataColumn Column in Handler.ResultTable.Columns)
                {
                    DTable.Add(Column.ColumnName, Row[Column].ToString());
                }
                break;
            }
            return(DTable);
        }
Exemplo n.º 5
0
        public static List <Dictionary <string, string> > ToDictionaryList(this SqlServerRequestHandler Handler)
        {
            List <Dictionary <string, string> > dictionaryList = new List <Dictionary <string, string> >();

            foreach (DataRow Row in Handler.ResultTable.Rows)
            {
                Dictionary <string, string> dictionary = new Dictionary <string, string>();

                foreach (DataColumn Column in Handler.ResultTable.Columns)
                {
                    dictionary.Add(Column.ColumnName, Row[Column].ToString());
                }

                dictionaryList.Add(dictionary);
            }
            return(dictionaryList);
        }