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); }
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); }
/// <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"]); }
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); }