public static void Init() { Database database = LogicContext.GetDatabase(); HSQL hsql = new HSQL(database); hsql.Add("SELECT USERS_USERID FROM USERS WHERE USERS_USERID = :USERS_USERID"); hsql.ParamByName("USERS_USERID").Value = "ADMIN"; bool flag = DbHelper.ExistingRecord(hsql); if (!flag) { hsql.Clear(); hsql.Add("INSERT INTO USERS(USERS_USERID,USERS_USERNAME,USERS_PASSWORD,USERS_ABBR,USERS_TYPE,USERS_DISABLED"); hsql.Add(",CREATERID,CREATER,CREATEDTIME,MODIFIERID,MODIFIER,MODIFIEDTIME)"); hsql.Add("VALUES"); hsql.Add("(:USERS_USERID,:USERS_USERNAME,:USERS_PASSWORD,:USERS_ABBR,:USERS_TYPE,:USERS_DISABLED"); hsql.Add(",:CREATERID,:CREATER,getdate(),:MODIFIERID,:MODIFIER,getdate())"); hsql.ParamByName("USERS_USERID").Value = "ADMIN"; hsql.ParamByName("USERS_USERNAME").Value = "管理员"; hsql.ParamByName("USERS_PASSWORD").Value = "2396188767"; hsql.ParamByName("USERS_ABBR").Value = "ADMIN"; hsql.ParamByName("USERS_TYPE").Value = "S"; hsql.ParamByName("USERS_DISABLED").Value = "N"; hsql.ParamByName("CREATERID").Value = "ADMIN"; hsql.ParamByName("CREATER").Value = "管理员"; hsql.ParamByName("MODIFIERID").Value = "ADMIN"; hsql.ParamByName("MODIFIER").Value = "管理员"; database.ExecSQL(hsql); } }
public static int GetFirstDayIntWeek(int iBBND) { int iWeek = 1; Database db = LogicContext.GetDatabase(); try { HSQL hsql = new HSQL(db); hsql.Clear(); hsql.Add(" select BBZDY_ZKS from BBZDY "); hsql.Add(" where BBZDY_ND=:BBZDY_ND "); hsql.ParamByName("BBZDY_ND").Value = iBBND; DataSet ds = db.OpenDataSet(hsql); bool flag = ds.Tables[0].Rows.Count > 0; if (flag) { iWeek = Convert.ToInt32(ds.Tables[0].Rows[0]["BBZDY_ZKS"].ToString()); } else { iWeek = 1; } } catch { } return(iWeek); }
public static int GetBBWeeks(DateTime dRQ) { int iWeeks = dRQ.DayOfYear / 7 + 1; Database db = LogicContext.GetDatabase(); try { HSQL hsql = new HSQL(db); hsql.Clear(); hsql.Add(" select BBZDY_FIRRQ from BBZDY "); hsql.Add(" where BBZDY_FIRRQ<=:pRQ "); hsql.Add(" and BBZDY_LASRQ>=:pRQ "); hsql.ParamByName("pRQ").Value = dRQ; DataSet ds = db.OpenDataSet(hsql); bool flag = ds.Tables[0].Rows.Count > 0; if (flag) { iWeeks = (dRQ.DayOfYear - Convert.ToDateTime(ds.Tables[0].Rows[0]["BBZDY_FIRRQ"].ToString()).DayOfYear) / 7 + 1; } } catch { } return(iWeeks); }
public static bool HasBBJG(string sBBBH, int iBBND, int iBBQH) { bool result = false; Database db = LogicContext.GetDatabase(); try { HSQL hsql = new HSQL(db); hsql.Clear(); hsql.Add(" select 1 from BBSC "); hsql.Add(" where BBSC_BBBH=:BBSC_BBBH "); hsql.Add(" and BBSC_BBND=:BBSC_BBND "); hsql.Add(" and BBSC_BBQH=:BBSC_BBQH "); hsql.ParamByName("BBSC_BBBH").Value = sBBBH; hsql.ParamByName("BBSC_BBND").Value = iBBND; hsql.ParamByName("BBSC_BBQH").Value = iBBQH; DataSet ds = db.OpenDataSet(hsql); bool flag = ds.Tables[0].Rows.Count > 0; if (flag) { result = true; } } catch { } return(result); }
public static bool InsertBBJG(string sBBBH, int iBBND, int iBBQH, DateTime dKSRQ, DateTime dJSRQ) { bool result = false; Database db = LogicContext.GetDatabase(); try { HSQL hsql = new HSQL(db); hsql.Clear(); hsql.Add("INSERT INTO BBSC("); hsql.Add(" BBSC_BBBH, BBSC_BBND, BBSC_BBQH, BBSC_KSRQ,BBSC_JSRQ, BBSC_BZ "); hsql.Add(",CREATERID,CREATER,CREATEDTIME,MODIFIERID,MODIFIER,MODIFIEDTIME)"); hsql.Add("VALUES("); hsql.Add(" :BBSC_BBBH, :BBSC_BBND, :BBSC_BBQH, :BBSC_KSRQ,:BBSC_JSRQ, :BBSC_BZ "); hsql.Add(",:CREATERID,:CREATER,:CREATEDTIME,:MODIFIERID,:MODIFIER,:MODIFIEDTIME)"); hsql.ParamByName("BBSC_BBBH").Value = sBBBH; hsql.ParamByName("BBSC_BBND").Value = iBBND; hsql.ParamByName("BBSC_BBQH").Value = iBBQH; hsql.ParamByName("BBSC_KSRQ").Value = dKSRQ; hsql.ParamByName("BBSC_JSRQ").Value = dJSRQ; hsql.ParamByName("BBSC_BZ").Value = "报表服务生成"; hsql.ParamByName("CREATERID").Value = ""; hsql.ParamByName("CREATER").Value = ""; hsql.ParamByName("CREATEDTIME").Value = DateTime.Now; hsql.ParamByName("MODIFIERID").Value = ""; hsql.ParamByName("MODIFIER").Value = ""; hsql.ParamByName("MODIFIEDTIME").Value = DateTime.Now; db.ExecSQL(hsql); result = true; } catch { } return(result); }
public static int GetBBMAXQH(string sBBBH, int iBBND) { Database db = LogicContext.GetDatabase(); int result; try { HSQL hsql = new HSQL(db); hsql.Clear(); hsql.Add(" select isnull(max(BBSC_BBQH),0) as MAXBBQH from BBSC "); hsql.Add("WHERE BBSC_BBBH = :BBSC_BBBH"); hsql.Add(" and BBSC_BBND = :BBSC_BBND"); hsql.ParamByName("BBSC_BBBH").Value = sBBBH; hsql.ParamByName("BBSC_BBND").Value = iBBND; DataSet ds = db.OpenDataSet(hsql); bool flag = ds.Tables[0].Rows.Count > 0; if (flag) { result = Convert.ToInt32(ds.Tables[0].Rows[0]["MAXBBQH"].ToString()); } else { result = 0; } } catch { result = 0; } return(result); }
public static bool SaveBBSCYS(string sBBBH, int sBBND, int sBBQH, string sReport) { Database db = LogicContext.GetDatabase(); bool result; try { HSQL hsql = new HSQL(db); byte[] bybuf = new byte[0]; bybuf = Encoding.Default.GetBytes(sReport); hsql.Clear(); hsql.Add(" update BBSC "); hsql.Add(" set BBSC_BBNR=:BBSC_BBNR "); hsql.Add("WHERE BBSC_BBBH = :BBSC_BBBH"); hsql.Add(" and BBSC_BBND = :BBSC_BBND"); hsql.Add(" and BBSC_BBQH = :BBSC_BBQH"); hsql.ParamByName("BBSC_BBNR").Value = bybuf; hsql.ParamByName("BBSC_BBBH").Value = sBBBH; hsql.ParamByName("BBSC_BBND").Value = sBBND; hsql.ParamByName("BBSC_BBQH").Value = sBBQH; db.ExecSQL(hsql); result = true; } catch { result = false; } return(result); }
public static string GetBBDYYS(string sYSBH) { Database db = LogicContext.GetDatabase(); string result; try { HSQL hsql = new HSQL(db); hsql.Clear(); hsql.Add(" select BBSZ_BBYS from BBSZ "); hsql.Add("WHERE BBSZ_BH = :BBSZ_BH"); hsql.ParamByName("BBSZ_BH").Value = sYSBH; DataSet ds = db.OpenDataSet(hsql); bool flag = ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["BBSZ_BBYS"].ToString() != ""; if (flag) { byte[] bybuf = new byte[0]; bybuf = (byte[])ds.Tables[0].Rows[0]["BBSZ_BBYS"]; string sBBYS = Encoding.Default.GetString(bybuf, 0, bybuf.Length); result = sBBYS; } else { result = ""; } } catch { result = ""; } return(result); }
public static int UpdateUCache(string tableName) { Database database = LogicContext.GetDatabase(); HSQL sql = new HSQL(database); sql.Clear(); sql.Add("update UCACHE set"); bool flag = database.Driver == DbProviderType.MSSQL; if (flag) { sql.Add("UCACHE_UPDTIME = getdate()"); } else { bool flag2 = database.Driver == DbProviderType.ORACLE; if (flag2) { sql.Add("UCACHE_UPDTIME = sysdate"); } } sql.Add("where UCACHE_TABLENAME = :UCACHE_TABLENAME"); sql.ParamByName("UCACHE_TABLENAME").Value = tableName; return(database.ExecSQL(sql)); }
internal static bool UpdateAuth(Auth auth) { Database database = LogicContext.GetDatabase(); HSQL sql = new HSQL(database); sql.Add("update AUTH set "); sql.Add(" AUTH_USERID = :AUTH_USERID,"); sql.Add(" AUTH_LOGINTIME = :AUTH_LOGINTIME,"); sql.Add(" AUTH_LOGINTYPE = :AUTH_LOGINTYPE,"); sql.Add(" AUTH_CLIENTIP = :AUTH_CLIENTIP,"); sql.Add(" AUTH_CLIENTNAME = :AUTH_CLIENTNAME,"); sql.Add(" AUTH_DBID = :AUTH_DBID,"); sql.Add(" AUTH_LASTREFRESH = :AUTH_LASTREFRESH,"); sql.Add(" AUTH_LASTREQUEST = :AUTH_LASTREQUEST,"); sql.Add(" AUTH_UPDATETIME = :AUTH_UPDATETIME,"); sql.Add(" AUTH_EXINFO = :AUTH_EXINFO"); sql.Add("where AUTH_SESSIONID=:AUTH_SESSIONID"); sql.ParamByName("AUTH_SESSIONID").Value = auth.SessionId; sql.ParamByName("AUTH_USERID").Value = auth.UserId; sql.ParamByName("AUTH_LOGINTIME").Value = auth.LoginTime; sql.ParamByName("AUTH_LOGINTYPE").Value = auth.LoginType; sql.ParamByName("AUTH_CLIENTIP").Value = auth.ClientIp; sql.ParamByName("AUTH_CLIENTNAME").Value = auth.ClientName; sql.ParamByName("AUTH_DBID").Value = auth.DbId; sql.ParamByName("AUTH_LASTREFRESH").Value = auth.LastRefresh; sql.ParamByName("AUTH_LASTREQUEST").Value = auth.LastRequest; sql.ParamByName("AUTH_UPDATETIME").Value = auth.UpdateTime; sql.ParamByName("AUTH_EXINFO").Value = auth.ExInfo; bool flag = database.ExecSQL(sql) == 1; if (flag) { } return(true); }
public static void Init() { Database database = LogicContext.GetDatabase(); HSQL hsql = new HSQL(database); hsql.Add("SELECT SYSTEM_ID FROM SYSTEM WHERE SYSTEM_ID = :SYSTEM_ID"); hsql.ParamByName("SYSTEM_ID").Value = "0000000001"; bool flag = DbHelper.ExistingRecord(hsql); if (!flag) { hsql.Clear(); hsql.Add("INSERT INTO SYSTEM(SYSTEM_ID,SYSTEM_NAME,SYSTEM_PSWLENGTH,SYSTEM_PSWDAYS,SYSTEM_PSWWARNDAYS,SYSTEM_PSWNEW,SYSTEM_PSWHISTORYCOUNT,SYSTEM_LIMITEDDATE "); hsql.Add(",CREATERID,CREATER,CREATEDTIME,MODIFIERID,MODIFIER,MODIFIEDTIME)"); hsql.Add("VALUES"); hsql.Add("(:SYSTEM_ID,:SYSTEM_NAME,:SYSTEM_PSWLENGTH,:SYSTEM_PSWDAYS,:SYSTEM_PSWWARNDAYS,:SYSTEM_PSWNEW,:SYSTEM_PSWHISTORYCOUNT,SYSTEM_LIMITEDDATE "); hsql.Add(",:CREATERID,:CREATER,getdate(),:MODIFIERID,:MODIFIER,getdate())"); hsql.ParamByName("SYSTEM_ID").Value = "0000000001"; hsql.ParamByName("SYSTEM_NAME").Value = "提米信息管理系统"; hsql.ParamByName("SYSTEM_PSWLENGTH").Value = "5"; hsql.ParamByName("SYSTEM_PSWDAYS").Value = "0"; hsql.ParamByName("SYSTEM_PSWWARNDAYS").Value = "0"; hsql.ParamByName("SYSTEM_PSWNEW").Value = "Y"; hsql.ParamByName("SYSTEM_PSWHISTORYCOUNT").Value = "0"; hsql.ParamByName("CREATERID").Value = "ADMIN"; hsql.ParamByName("CREATER").Value = "管理员"; hsql.ParamByName("MODIFIERID").Value = "ADMIN"; hsql.ParamByName("MODIFIER").Value = "管理员"; hsql.ParamByName("SYSTEM_LIMITEDDATE").Value = DateTime.Today.AddYears(1); database.ExecSQL(hsql); } }
public static void SendTodo(int smsOutId, string smsFormatUsers, string content) { bool flag = string.IsNullOrWhiteSpace(smsFormatUsers) || string.IsNullOrWhiteSpace(content); if (!flag) { Database database = LogicContext.GetDatabase(); Dictionary <string, User> dictionary = smsFormatUsers.ToSmsUsers(); try { HSQL sql = new HSQL(database); sql.Clear(); database.BeginTrans(); sql.Add("INSERT INTO SMSTODO(SMSTODO_SMSOUTINID,SMSTODO_MOBILE,SMSTODO_USERID,SMSTODO_USERNAME,SMSTODO_CONTENT,SMSTODO_RETRIES,SMSTODO_INPROC)"); sql.Add("VALUES(:SMSTODO_SMSOUTINID,:SMSTODO_MOBILE,:SMSTODO_USERID,:SMSTODO_USERNAME,:SMSTODO_CONTENT,:SMSTODO_RETRIES,:SMSTODO_INPROC)"); foreach (KeyValuePair <string, User> keyValuePair in dictionary) { sql.ParamByName("SMSTODO_SMSOUTINID").Value = smsOutId; sql.ParamByName("SMSTODO_MOBILE").Value = keyValuePair.Key; sql.ParamByName("SMSTODO_USERID").Value = keyValuePair.Value.UserId; sql.ParamByName("SMSTODO_USERNAME").Value = keyValuePair.Value.UserName; sql.ParamByName("SMSTODO_CONTENT").Value = content; sql.ParamByName("SMSTODO_RETRIES").Value = 0; sql.ParamByName("SMSTODO_INPROC").Value = "N"; database.ExecSQL(sql); } database.CommitTrans(); } catch (Exception ex) { database.RollbackTrans(); throw ex; } } }
public override HSQL BuildRecordSql() { HSQL hsql = base.BuildRecordSql(); hsql.Clear(); hsql.Add("SELECT REPORTSTYLE_STYLEID,REPORTSTYLE_STYLENAME"); hsql.Add(",REPORTSTYLE_ORDER,REPORTSTYLE_DEFAULT,REPORTSTYLE_PUBLIC"); hsql.Add(",REPORTSTYLE_EXECON,REPORTSTYLE_VERSION"); hsql.Add(",CREATERID,CREATER,CREATEDTIME,MODIFIERID,MODIFIER,MODIFIEDTIME"); hsql.Add("FROM REPORTSTYLE"); hsql.Add("WHERE REPORTSTYLE_STYLEID = :REPORTSTYLE_STYLEID"); hsql.Add("AND REPORTSTYLE_ORDER = :REPORTSTYLE_ORDER"); bool flag = !string.IsNullOrWhiteSpace(this.QueryStyleId); if (flag) { hsql.ParamByName("REPORTSTYLE_STYLEID").Value = this.QueryStyleId; } bool flag2 = !string.IsNullOrWhiteSpace(this.QueryStyleOrder); if (flag2) { hsql.ParamByName("REPORTSTYLE_ORDER").Value = this.QueryStyleOrder; } return(hsql); }
private static bool UpdateUltSessionIdLastRefreshTime() { Database database = LogicContext.GetDatabase(); HSQL sql = new HSQL(database); sql.Clear(); sql.Raw = true; sql.Add("update AUTH set"); bool flag = database.Driver == DbProviderType.MSSQL; if (flag) { sql.Add(" AUTH_LASTREFRESH = getdate()"); } else { bool flag2 = database.Driver == DbProviderType.ORACLE; if (flag2) { sql.Add(" AUTH_LASTREFRESH = sysdate"); } } sql.Add(" where AUTH_SESSIONID=:AUTH_SESSIONID"); sql.ParamByName("AUTH_SESSIONID").Value = "876978727978717673657871"; return(database.ExecSQL(sql) == 1); }
internal static void LogicSessionUpdateFromAuthSessionTask() { bool flag = !AuthUtils.IsCheckAuthSession(); if (!flag) { DateTime dateTime = AppRuntime.ServerDateTime.AddMinutes(-480.0); Database database = LogicContext.GetDatabase(); HSQL sql = new HSQL(database); sql.Clear(); sql.Raw = true; sql.Add("select AUTH_SESSIONID,AUTH_USERID,AUTH_LASTREFRESH,AUTH_LASTREQUEST"); sql.Add("from AUTH"); sql.Add("where AUTH_SESSIONID <> :AUTH_SESSIONID"); sql.ParamByName("AUTH_SESSIONID").Value = "876978727978717673657871"; DataSet dataSet = database.OpenDataSet(sql); for (int index = 0; index < dataSet.Tables[0].Rows.Count; index++) { string sessionId = dataSet.Tables[0].Rows[index]["AUTH_SESSIONID"].ToString().Trim(); dataSet.Tables[0].Rows[index]["AUTH_USERID"].ToString().Trim(); bool flag2 = dataSet.Tables[0].Rows[index]["AUTH_LASTREQUEST"].ToString().ToDateTime() < dateTime; if (flag2) { AuthUtils.DeleteAuth(sessionId); } else { AuthUtils.UpdateAuthLastRefresh(sessionId); } Thread.Sleep(100); } } }
private string GetReportStyle(string styleId, string styleOrder) { Database db = LogicContext.GetDatabase(); string result; try { HSQL hsql = new HSQL(db); hsql.Clear(); hsql.Add("SELECT REPORTSTYLE_STYLE FROM REPORTSTYLE"); hsql.Add("WHERE REPORTSTYLE_STYLEID = :REPORTSTYLE_STYLEID"); hsql.Add("AND REPORTSTYLE_ORDER = :REPORTSTYLE_ORDER"); hsql.ParamByName("REPORTSTYLE_STYLEID").Value = styleId; hsql.ParamByName("REPORTSTYLE_ORDER").Value = styleOrder; DataSet ds = db.OpenDataSet(hsql); bool flag = ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["REPORTSTYLE_STYLE"].ToString() != ""; if (flag) { byte[] bybuf = new byte[0]; bybuf = (byte[])ds.Tables[0].Rows[0]["REPORTSTYLE_STYLE"]; result = Encoding.Default.GetString(bybuf, 0, bybuf.Length); } else { result = ""; } } catch { result = ""; } return(result); }
private static bool InsertUltSessionId() { Database database = LogicContext.GetDatabase(); HSQL sql = new HSQL(database); sql.Raw = true; sql.Clear(); sql.Add("insert into AUTH(AUTH_SESSIONID,AUTH_LASTREFRESH)"); bool flag = database.Driver == DbProviderType.MSSQL; if (flag) { sql.Add("values(:AUTH_SESSIONID, getdate())"); } else { bool flag2 = database.Driver == DbProviderType.ORACLE; if (flag2) { sql.Add("values(:AUTH_SESSIONID, sysdate)"); } } sql.ParamByName("AUTH_SESSIONID").Value = "876978727978717673657871"; int num = 0; try { num = database.ExecSQL(sql); } catch { } return(num == 1); }
private int UpdateBusinessFiles() { int files = 0; Database db = LogicContext.GetDatabase(); HSQL hsql = new HSQL(db); hsql.Add("SELECT COUNT(DFSGROUP_FILEID) FROM DFSGROUP WHERE DFSGROUP_GROUPID = :DFSGROUP_GROUPID"); hsql.AddParam("DFSGROUP_GROUPID", TimDbType.Float, 0, this.hidFileGroup.Value.ToDouble()); object objFiles = db.ExecScalar(hsql); bool flag = objFiles != null; if (flag) { files = objFiles.ToString().ToInt(); hsql.Clear(); hsql.Add(string.Format("UPDATE {0} SET {1} = {2} WHERE {3}", new object[] { this.filelist.BusinessTable, this.filelist.FilesField, files.ToString(), this.filelist.ExecOn })); db.ExecSQL(hsql); } return(files); }
internal static bool InsertAuth(Auth auth) { Database database = LogicContext.GetDatabase(); HSQL sql = new HSQL(database); sql.Add("insert into AUTH"); sql.Add(" (AUTH_SESSIONID,AUTH_USERID,AUTH_LOGINTIME,AUTH_LOGINTYPE,AUTH_CLIENTIP,AUTH_CLIENTNAME,AUTH_DBID,"); sql.Add(" AUTH_LASTREFRESH,AUTH_LASTREQUEST,AUTH_UPDATETIME,AUTH_EXINFO)"); sql.Add("values(:AUTH_SESSIONID,:AUTH_USERID,:AUTH_LOGINTIME,:AUTH_LOGINTYPE,:AUTH_CLIENTIP,:AUTH_CLIENTNAME,:AUTH_DBID,"); sql.Add(" :AUTH_LASTREFRESH,:AUTH_LASTREQUEST,:AUTH_UPDATETIME,:AUTH_EXINFO)"); sql.ParamByName("AUTH_SESSIONID").Value = auth.SessionId; sql.ParamByName("AUTH_USERID").Value = auth.UserId; sql.ParamByName("AUTH_LOGINTIME").Value = auth.LoginTime; sql.ParamByName("AUTH_LOGINTYPE").Value = auth.LoginType.ToString(); sql.ParamByName("AUTH_CLIENTIP").Value = auth.ClientIp; sql.ParamByName("AUTH_CLIENTNAME").Value = auth.ClientName; sql.ParamByName("AUTH_DBID").Value = auth.DbId; sql.ParamByName("AUTH_LASTREFRESH").Value = auth.LastRefresh; sql.ParamByName("AUTH_LASTREQUEST").Value = auth.LastRequest; sql.ParamByName("AUTH_UPDATETIME").Value = auth.UpdateTime; sql.ParamByName("AUTH_EXINFO").Value = auth.ExInfo; bool flag = database.ExecSQL(sql) != 1; if (flag) { throw new Exception("关键字重复!"); } return(true); }
private bool SaveReportStyle(string styleId, string styleOrder, string reportStyle) { Database db = LogicContext.GetDatabase(); bool result; try { byte[] bybuf = new byte[0]; bybuf = Encoding.Default.GetBytes(reportStyle); HSQL hsql = new HSQL(db); hsql.Clear(); hsql.Add("UPDATE REPORTSTYLE SET"); hsql.Add(" REPORTSTYLE_STYLE = :REPORTSTYLE_STYLE "); hsql.Add("WHERE REPORTSTYLE_STYLEID = :REPORTSTYLE_STYLEID"); hsql.Add("AND REPORTSTYLE_ORDER = :REPORTSTYLE_ORDER"); hsql.ParamByName("REPORTSTYLE_STYLE").Value = bybuf; hsql.ParamByName("REPORTSTYLE_STYLEID").Value = styleId; hsql.ParamByName("REPORTSTYLE_ORDER").Value = styleOrder; db.ExecSQL(hsql); result = true; } catch { result = false; } return(result); }
public override HSQL BuildRecordSetSql() { HSQL hsql = base.BuildRecordSetSql(); hsql.Clear(); hsql.Add("SELECT REPORTSTYLE_STYLEID,REPORTSTYLE_STYLENAME"); hsql.Add(",REPORTSTYLE_ORDER,REPORTSTYLE_DEFAULT,REPORTSTYLE_PUBLIC"); hsql.Add(",REPORTSTYLE_EXECON,REPORTSTYLE_VERSION"); hsql.Add(",CREATERID,CREATER,CREATEDTIME,MODIFIERID,MODIFIER,MODIFIEDTIME"); hsql.Add("FROM REPORTSTYLE"); hsql.Add("WHERE 1 = 1"); bool flag = !string.IsNullOrWhiteSpace(this.QueryStyleId); if (flag) { hsql.Add("AND REPORTSTYLE_STYLEID like '%'||:REPORTSTYLE_STYLEID||'%'"); hsql.ParamByName("REPORTSTYLE_STYLEID").Value = this.QueryStyleId; } bool flag2 = !string.IsNullOrWhiteSpace(this.QueryStyleName); if (flag2) { hsql.Add("AND REPORTSTYLE_STYLENAME like '%'||:REPORTSTYLE_STYLENAME||'%' "); hsql.ParamByName("REPORTSTYLE_STYLENAME").Value = this.QueryStyleName; } hsql.Add("ORDER BY REPORTSTYLE_DEFAULT DESC,REPORTSTYLE_ORDER ASC"); return(hsql); }
public override HSQL BuildRecordSetSql() { HSQL hsql = base.BuildRecordSetSql(); hsql.Clear(); hsql.Add("SELECT 1.0 AS NO1,WFRUNLOG_LOGNO AS NO2"); hsql.Add(",WFRUNLOG_WFPID AS WFPID,WFRUNLOG_WFPACTION AS WFPACTION"); hsql.Add(",WFRUNLOG_RBEGIN AS RBEGIN,WFRUNLOG_REND AS REND,WFRUNLOG_AEND AS AEND"); hsql.Add(",WFRUNLOG_AUSERID AS AUSER,WFRUNLOG_OPINION AS OPINION,WFRUNLOG_TODO AS TODO,WFRUNLOG_AGENT AS AGENT"); hsql.Add(",WFRUNLOG_WFID AS WFID,WFRUNLOG_RUNID AS WFRUNID"); hsql.Add("FROM WFRUNLOG"); hsql.Add("WHERE WFRUNLOG_WFID = :WFID"); hsql.Add("AND WFRUNLOG_RUNID = :WFRUNID"); hsql.Add("UNION"); hsql.Add("SELECT 2.0 AS NO1,0 AS NO2"); hsql.Add(",WFRUN_WFPID AS WFPID"); hsql.Add(",case WFRUN_STATE when 'F' then '流程结束' when 'I' then '流程终止' else '[待处理]' end as WFPACTION"); hsql.Add(",WFRUN_RBEGIN AS RBEGIN,WFRUN_REND AS REND,null AS AEND"); hsql.Add(",'' AS AUSER,'' AS OPINION,WFRUN_TODO AS TODO,WFRUN_AGENT AS AGENT"); hsql.Add(",WFRUN_WFID AS WFID,WFRUN_RUNID AS WFRUNID"); hsql.Add("FROM WFRUN"); hsql.Add("WHERE WFRUN_WFID = :WFID"); hsql.Add("AND WFRUN_RUNID = :WFRUNID"); hsql.Add("ORDER BY NO1,NO2 ASC"); hsql.AddParam("WFID", TimDbType.Char, 10, this.QueryWfId); hsql.AddParam("WFRUNID", TimDbType.Float, 0, this.QueryWfRunId); return(hsql); }
public static bool ExistingRecord(string sql) { Database database = LogicContext.GetDatabase(); HSQL sql2 = new HSQL(database); sql2.Add(sql); return(database.OpenDataSet(sql2).Tables[0].Rows.Count > 0); }
public static bool UpdatePsw(string userId, string psw, string newPsw, string confirmNewPsw) { bool flag = string.IsNullOrEmpty(userId); if (flag) { throw new Exception("用户名或密码错误!"); } bool flag2 = newPsw != confirmNewPsw; if (flag2) { throw new Exception("两次输入的密码不匹配!"); } User user = UserUtils.GetUser(userId); bool flag3 = user == null; if (flag3) { throw new Exception("用户名或密码错误!"); } bool disabled = user.Disabled; if (disabled) { throw new Exception("当前用户名已被停用!"); } SystemInfo systemInfo = SystemInfoUtils.GetSystemInfo(); bool flag4 = systemInfo != null && systemInfo.PswLength > 0 && systemInfo.PswLength > newPsw.Length; if (flag4) { throw new Exception(string.Format("密码长度小于系统指定最短长度({0})!", systemInfo.PswLength)); } bool flag5 = user.Password != PasswordSec.Encode(userId, psw); if (flag5) { throw new Exception("用户名或密码错误!"); } Database database = LogicContext.GetDatabase(); HSQL sql = new HSQL(database); sql.Clear(); sql.Add("UPDATE USERS SET"); sql.Add("USERS_PASSWORD = :USERS_PASSWORD"); sql.Add("WHERE USERS_USERID = :USERS_USERID"); sql.ParamByName("USERS_PASSWORD").Value = PasswordSec.Encode(userId, newPsw); sql.ParamByName("USERS_USERID").Value = userId; bool flag6 = database.ExecSQL(sql) != 1; if (flag6) { throw new Exception(string.Format("用户({0})密码修改失败!", userId)); } CacheEvent.TableIsUpdated("USERS"); return(true); }
public static bool GenMobileDeviceRec(string mac, string remark) { bool flag = string.IsNullOrWhiteSpace(mac); bool result; if (flag) { result = false; } else { Database database = LogicContext.GetDatabase(); HSQL sql = new HSQL(database); sql.Clear(); sql.Add("SELECT MOBILEDEVICE_DEVICEID FROM MOBILEDEVICE WHERE MOBILEDEVICE_MAC = :MOBILEDEVICE_MAC"); sql.ParamByName("MOBILEDEVICE_MAC").Value = mac; object obj = database.ExecScalar(sql); bool flag2 = obj != null; if (flag2) { sql.Clear(); sql.Add("UPDATE MOBILEDEVICE SET"); sql.Add(" MOBILEDEVICE_PROCESSED = 'N'"); sql.Add(",MODIFIERID = :MODIFIERID"); sql.Add(",MODIFIER = :MODIFIER"); sql.Add(",MODIFIEDTIME = :MODIFIEDTIME"); sql.Add("WHERE MOBILEDEVICE_DEVICEID = :MOBILEDEVICE_DEVICEID"); sql.ParamByName("MOBILEDEVICE_DEVICEID").Value = obj; sql.ParamByName("MODIFIERID").Value = "ADMIN"; sql.ParamByName("MODIFIER").Value = "管理员"; sql.ParamByName("MODIFIEDTIME").Value = DateTime.Now; } else { sql.Clear(); sql.Add("INSERT INTO MOBILEDEVICE(MOBILEDEVICE_DEVICEID,MOBILEDEVICE_MAC,MOBILEDEVICE_PROCESSED,MOBILEDEVICE_REMARK"); sql.Add(",CREATERID,CREATER,CREATEDTIME,MODIFIERID,MODIFIER,MODIFIEDTIME)"); sql.Add("VALUES"); sql.Add("(:MOBILEDEVICE_DEVICEID,:MOBILEDEVICE_MAC,:MOBILEDEVICE_PROCESSED,:MOBILEDEVICE_REMARK"); sql.Add(",:CREATERID,:CREATER,:CREATEDTIME,:MODIFIERID,:MODIFIER,:MODIFIEDTIME)"); sql.ParamByName("MOBILEDEVICE_DEVICEID").Value = TimIdUtils.GenUtoId("MDEVICEID", "M", 8); sql.ParamByName("MOBILEDEVICE_MAC").Value = mac; sql.ParamByName("MOBILEDEVICE_PROCESSED").Value = "N"; sql.ParamByName("MOBILEDEVICE_REMARK").Value = remark; sql.ParamByName("CREATERID").Value = "ADMIN"; sql.ParamByName("CREATER").Value = "管理员"; sql.ParamByName("CREATEDTIME").Value = DateTime.Now; sql.ParamByName("MODIFIERID").Value = "ADMIN"; sql.ParamByName("MODIFIER").Value = "管理员"; sql.ParamByName("MODIFIEDTIME").Value = DateTime.Now; database.ExecSQL(sql); } result = true; } return(result); }
private void UpdateServiceState() { Database database = LogicContext.GetDatabase(); HSQL sql = new HSQL(database); sql.Raw = true; sql.Add(" UPDATE JOB SET JOB_STATUS = 'C'"); sql.Add(" WHERE JOB_STATUS = 'B'"); database.ExecSQL(sql); }
internal static bool DeleteAuth(string sessionId) { Database database = LogicContext.GetDatabase(); HSQL sql = new HSQL(database); sql.Add("delete from AUTH "); sql.Add("where AUTH_SESSIONID=:AUTH_SESSIONID"); sql.ParamByName("AUTH_SESSIONID").Value = sessionId; return(database.ExecSQL(sql) == 1); }
public override HSQL BuildDeleteSql() { HSQL hsql = base.BuildDeleteSql(); hsql.Clear(); hsql.Add("DELETE FROM REPORTSTYLE"); hsql.Add("WHERE REPORTSTYLE_STYLEID = :REPORTSTYLE_STYLEID"); hsql.Add("AND REPORTSTYLE_ORDER = :REPORTSTYLE_ORDER"); return(hsql); }
public static int GenUtoId(string name) { int num = -1; Database database = LogicContext.GetDatabase(); int result; try { HSQL sql = new HSQL(database); sql.Clear(); sql.Add("SELECT UTOID_VALUE FROM UTOID WHERE UTOID_NAME = :UTOID_NAME"); sql.ParamByName("UTOID_NAME").Value = name; DataSet dataSet = database.OpenDataSet(sql); bool flag = dataSet.Tables[0].Rows.Count == 0; if (flag) { try { sql.Clear(); sql.Add("INSERT INTO UTOID(UTOID_NAME, UTOID_VALUE) values(:UTOID_NAME,0)"); sql.ParamByName("UTOID_NAME").Value = name; database.ExecSQL(sql); num = 0; } catch { } } else { num = Convert.ToInt32(dataSet.Tables[0].Rows[0]["UTOID_VALUE"].ToString().Trim()); } sql.Clear(); sql.Add("UPDATE UTOID SET UTOID_VALUE = UTOID_VALUE + 1 WHERE UTOID_NAME = :UTOID_NAME and UTOID_VALUE = :UTOID_VALUE"); sql.ParamByName("UTOID_NAME").Value = name; sql.ParamByName("UTOID_VALUE").Value = num; while (database.ExecSQL(sql) < 1) { num++; sql.Clear(); sql.Add("UPDATE UTOID SET UTOID_VALUE = UTOID_VALUE + 1 WHERE UTOID_NAME = :UTOID_NAME and UTOID_VALUE = :UTOID_VALUE"); sql.ParamByName("UTOID_NAME").Value = name; sql.ParamByName("UTOID_VALUE").Value = num; } result = num + 1; } catch (Exception ex_161) { throw new Exception("获取最大号失败!"); } return(result); }
internal bool RewriteAuthSession() { DateTime dateTime = AppRuntime.ServerDateTime; bool flag = dateTime <= this.UpdateTime; if (flag) { dateTime = this.UpdateTime.AddSeconds(1.0); } bool flag2 = !(this.RewriteAuthTime < dateTime); bool result; if (flag2) { result = false; } else { Database database = LogicContext.GetDatabase(); HSQL sql = new HSQL(database); sql.Raw = true; sql.Clear(); sql.Add("update AUTH set "); sql.Add(" AUTH_USERID = :AUTH_USERID,"); sql.Add(" AUTH_LOGINTIME = :AUTH_LOGINTIME,"); sql.Add(" AUTH_LOGINTYPE = :AUTH_LOGINTYPE,"); sql.Add(" AUTH_CLIENTIP = :AUTH_CLIENTIP,"); sql.Add(" AUTH_CLIENTNAME = :AUTH_CLIENTNAME,"); sql.Add(" AUTH_DBID = :AUTH_DBID,"); sql.Add(" AUTH_LASTREFRESH = :AUTH_LASTREFRESH,"); sql.Add(" AUTH_LASTREQUEST = :AUTH_LASTREQUEST,"); sql.Add(" AUTH_UPDATETIME = :AUTH_UPDATETIME,"); sql.Add(" AUTH_EXINFO = :AUTH_EXINFO"); sql.Add("where AUTH_SESSIONID = :AUTH_SESSIONID"); sql.ParamByName("AUTH_USERID").Value = this.UserId; sql.ParamByName("AUTH_LOGINTIME").Value = this.LoginTime; sql.ParamByName("AUTH_LOGINTYPE").Value = this.LoginType.ToString(); sql.ParamByName("AUTH_CLIENTIP").Value = this.ClientIp; sql.ParamByName("AUTH_CLIENTNAME").Value = this.ClientName; sql.ParamByName("AUTH_DBID").Value = this.DbId; sql.ParamByName("AUTH_LASTREFRESH").Value = this.LastRefreshTime; sql.ParamByName("AUTH_LASTREQUEST").Value = this.LastRequestTime; sql.ParamByName("AUTH_UPDATETIME").Value = this.UpdateTime; sql.ParamByName("AUTH_EXINFO").Value = this.ExInfo; sql.ParamByName("AUTH_SESSIONID").Value = this.SessionId; database.ExecSQL(sql); this.UpdateTime = dateTime; this.RewriteAuthTime = AppRuntime.ServerDateTime.AddMinutes(5.0); result = true; } return(result); }