public static void UpdateDatabaseNote(string argGenre, string argFilename, string argField, int argId) { string str = argGenre; string str2 = argFilename; string str3 = argField; int num = argId; db db = new db(); string str4 = cls.getString(jt.itake("global.config.sys->upload-ndatabase", "cfg")); string argFpre = cls.getString(jt.itake("global.config.sys->upload-nfpre", "cfg")); string argString = string.Concat(new object[] { "update ", str4, " set ", cls.cfnames(argFpre, "valid"), "=0,", cls.cfnames(argFpre, "vlreason"), "=2 where ", cls.cfnames(argFpre, "fid"), "=", num, " and ", cls.cfnames(argFpre, "genre"), "='", str, "' and ", cls.cfnames(argFpre, "field"), "='", str3, "'" }); db.Execute(argString); string[] strArray = str2.Split(new char[] { '|' }); for (int i = 0; i < strArray.Length; i++) { string argObject = cls.getSafeString(strArray[i]); if (!cls.isEmpty(argObject)) { db.Execute(string.Concat(new object[] { "update ", str4, " set ", cls.cfnames(argFpre, "fid"), "=", num, ",", cls.cfnames(argFpre, "valid"), "=1 where ", cls.cfnames(argFpre, "genre"), "='", str, "' and ", cls.cfnames(argFpre, "field"), "='", str3, "' and ", cls.cfnames(argFpre, "filename"), "='", argObject, "'" })); } } }
// DELETE api/<controller>/<id> public IHttpActionResult Delete(int id) { jtbc.db db = new jtbc.db(0, "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=App_Data/test.mdb;"); string sql = "DELETE FROM products WHERE ID=" + id.ToString(); db.Execute(sql); Dictionary<string, object> ret = new Dictionary<string, object>(); ret.Add("errorCode", 0); return Ok(ret); }
public bool ckLogin(string argUsername, string argPassword) { bool flag = true; if (cls.isEmpty(this.username) || cls.isEmpty(this.popedom)) { db db = new db(); string argObject = ""; string str2 = cls.getSafeString(argUsername); string str3 = cls.getSafeString(argPassword); string str4 = cls.getString(jt.itake("global.config.admin-ndatabase", "cfg")); string argFpre = cls.getString(jt.itake("global.config.admin-nfpre", "cfg")); string argString = "select * from " + str4 + " where " + cls.cfnames(argFpre, "username") + "='" + str2 + "' and " + cls.cfnames(argFpre, "password") + "='" + str3 + "' and " + cls.cfnames(argFpre, "lock") + "=0"; object[] objArray = db.getDataAry(argString); if (objArray != null) { object[,] argAry = (object[,]) objArray[0]; int argValue = (int) db.getValue(argAry, cls.cfnames(argFpre, "id")); string str7 = (string) db.getValue(argAry, cls.cfnames(argFpre, "username")); string str8 = (string) db.getValue(argAry, cls.cfnames(argFpre, "password")); string str9 = (string) db.getValue(argAry, cls.cfnames(argFpre, "popedom")); session.set("admin-id", argValue); session.set("admin-username", str7); session.set("admin-popedom", str9); cookies.set("admin-username", str7); cookies.set("admin-password", str8); this.id = argValue; this.username = str7; this.popedom = str9; argObject = "update " + str4 + " set " + cls.cfnames(argFpre, "lasttime") + "='" + cls.getDate() + "'," + cls.cfnames(argFpre, "lastip") + "='" + request.ClientIP() + "' where " + cls.cfnames(argFpre, "username") + "='" + str2 + "'"; } else { flag = false; } if (!cls.isEmpty(argObject)) { db.Execute(argObject); } } return flag; }
public bool ckLogins(string argUsername, string argPassword) { string str = argUsername; string argString = argPassword; this.username = ""; this.popedom = ""; session.remove("admin-id"); session.remove("admin-username"); session.remove("admin-popedom"); bool flag = this.ckLogin(str, encode.md5(argString)); int num = 0; if (!flag) { num = 1; } db db = new db(); string str3 = cls.getString(jt.itake("global.config.admin-userlog-ndatabase", "cfg")); string argFpre = cls.getString(jt.itake("global.config.admin-userlog-nfpre", "cfg")); string str5 = string.Concat(new object[] { "insert into ", str3, " (", cls.cfnames(argFpre, "username"), ",", cls.cfnames(argFpre, "error"), ",", cls.cfnames(argFpre, "ip"), ",", cls.cfnames(argFpre, "time"), ") values ('", cls.getSafeString(str), "',", num, ",'", request.ClientIP(), "','", cls.getDate(), "')" }); db.Execute(str5); return flag; }
public void updateProperty(string argField, string argValue, string argType, string argUserId) { string argString = argField; string str2 = argValue; string str3 = argType; string str4 = argUserId; int argID = cls.getNum(str4, -1); if (argID != -1) { string argDatabase = cls.getString(jt.itake("global." + this.ngenre + ":config.ndatabase", "cfg")); string argFpre = cls.getString(jt.itake("global." + this.ngenre + ":config.nfpre", "cfg")); string str7 = cls.cfnames(argFpre, "id"); db db = new db(); switch (str3) { case "0": db.Execute(string.Concat(new object[] { "update ", argDatabase, " set ", cls.cfnames(argFpre, argString), "=", cls.cfnames(argFpre, argString), "+", cls.getNum(str2, 0), " where ", str7, "=", argID })); break; case "1": db.Execute(string.Concat(new object[] { "update ", argDatabase, " set ", cls.cfnames(argFpre, argString), "=", cls.getNum(str2, 0), " where ", str7, "=", argID })); break; case "2": db.Execute(string.Concat(new object[] { "update ", argDatabase, " set ", cls.cfnames(argFpre, argString), "='", encode.addslashes(str2), "' where ", str7, "=", argID })); break; } dbcache.deleteCache(argDatabase, argFpre, argID); } }
public bool Login(string argUsername, string argPassword, string argRemember) { bool flag = false; this.Logout(); string argValue = cls.getSafeString(argUsername); string str2 = encode.md5(cls.getSafeString(argPassword)); int num = cls.getNum(argRemember, 0); db db = new db(); string str3 = cls.getString(jt.itake("global." + this.ngenre + ":config.ndatabase", "cfg")); string argFpre = cls.getString(jt.itake("global." + this.ngenre + ":config.nfpre", "cfg")); string argString = cls.cfnames(argFpre, "id"); string str6 = "select * from " + str3 + " where " + cls.cfnames(argFpre, "username") + "='" + argValue + "' and " + cls.cfnames(argFpre, "password") + "='" + str2 + "' and " + cls.cfnames(argFpre, "lock") + "=0"; object[] objArray = db.getDataAry(str6); if (objArray == null) { return flag; } object[,] argAry = (object[,]) objArray[0]; string str7 = cls.toString(db.getValue(argAry, argString)); if (num == 0) { cookies.set(this.ngenre + "-userid", str7); cookies.set(this.ngenre + "-username", argValue); cookies.set(this.ngenre + "-password", str2); } else { cookies.set(this.ngenre + "-userid", str7, 0x1e13380); cookies.set(this.ngenre + "-username", argValue, 0x1e13380); cookies.set(this.ngenre + "-password", str2, 0x1e13380); } session.set(this.ngenre + "-nuserid", str7); session.set(this.ngenre + "-nusername", argValue); db.Execute("update " + str3 + " set " + cls.cfnames(argFpre, "prelasttime") + "=" + cls.cfnames(argFpre, "lasttime") + " where " + argString + "=" + str7); db.Execute("update " + str3 + " set " + cls.cfnames(argFpre, "lasttime") + "='" + cls.getDate() + "' where " + argString + "=" + str7); return true; }