示例#1
0
        public static bool Duplicated(string alias, string campo, string value)
        {
            string where = campo + " ='" + value.Trim() + "'";
            XResponse resp = CrsData.TableSelect(new List <string> {
                campo
            }, alias, where, 0);

            return(!resp.empty);
        }
示例#2
0
        public static XResponse GetFieldByUID(string campo, string alias, int uid)
        {
            XResponse resp = CrsData.TableSelect(new List <string> {
                campo
            }, "productos", "uid = " + uid, BuildType.TablaArray);

            if (resp.error || resp.empty)
            {
                return(resp);
            }
            Tabla[] tabla = (Tabla[])resp.objecto;
            resp.response = (string)tabla[0].datos[campo];
            return(resp);
        }
示例#3
0
        /// <summary>
        /// devuelve el uid si ya existe sino devuelve -1 (la tabla debe tener un campo uid)
        /// </summary>
        /// <param name="alias"></param>
        /// <param name="campo"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public static int GetUID(string alias, string campo, string value)
        {
            string where = campo + " ='" + value.Trim() + "'";
            XResponse resp = CrsData.TableSelect(new List <string> {
                "uid"
            }, alias, where, BuildType.TablaArray);

            if (resp.empty || resp.error)
            {
                return(-1);
            }
            Tabla[] tabla = (Tabla[])resp.objecto;
            return(tabla[0].datos["uid"]);
        }
示例#4
0
        public static string SaveLog(string msg)
        {
            string     code   = CrsUtil.RandString(6);
            XUserLoged usrlog = (XUserLoged)HttpContext.Current.Session["_UserLoged"];

            if (usrlog.uid.Equals(0))
            {
                usrlog.name = "no user";
            }
            CrsData.TableInsert("log", new Dictionary <string, dynamic> {
                { "message", msg.Replace("'", "\"") }, { "codigo", code }, { "uiduser", usrlog.uid.ToString() }, { "username", usrlog.name }
            });
            return(code);
        }