Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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);
                }
            }
        }
Esempio n. 6
0
        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;
                }
            }
        }
Esempio n. 7
0
        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);
        }
Esempio n. 8
0
        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));
        }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
        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);
        }
Esempio n. 11
0
        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);
        }
Esempio n. 12
0
        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);
        }
Esempio n. 13
0
        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);
        }
Esempio n. 14
0
        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);
        }
Esempio n. 15
0
        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);
        }
Esempio n. 16
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);
        }
Esempio n. 17
0
        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);
        }
Esempio n. 18
0
        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);
        }
Esempio n. 19
0
        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);
        }
Esempio n. 20
0
        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);
        }
Esempio n. 21
0
        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);
        }
Esempio n. 22
0
        public static double ShareFile(double fileId)
        {
            double   shareGroupId = (double)TimIdUtils.GenUtoId("DFS_FGID");
            Database db           = LogicContext.GetDatabase();
            HSQL     hsql         = new HSQL(db);

            hsql.Add("INSERT INTO DFSGROUP(DFSGROUP_GROUPID,DFSGROUP_FILEID");
            hsql.Add("VALUES(:DFSGROUP_GROUPID,:DFSGROUP_FILEID)");
            hsql.AddParam("DFSGROUP_GROUPID", TimDbType.Float, 0, shareGroupId);
            hsql.AddParam("DFSGROUP_FILEID", TimDbType.Float, 0, fileId);
            db.ExecSQL(hsql);
            return(shareGroupId);
        }
Esempio n. 23
0
        public static void ClearTmpTbl(string sTable, int iTmpID)
        {
            Database database = LogicContext.GetDatabase();
            HSQL     hsql     = new HSQL(database);

            hsql.Clear();
            hsql.Add("delete from  " + sTable);
            hsql.Add(" where " + sTable.Trim() + "_ID=:pID ");
            hsql.Add("  or " + sTable.Trim() + "_VMTIME<=:pVMTIME ");
            hsql.ParamByName("pID").Value     = iTmpID;
            hsql.ParamByName("pVMTIME").Value = DateTime.Now.AddDays(-3.0);
            database.ExecSQL(hsql);
        }
Esempio n. 24
0
        internal static bool DeleteDfsGroup(double fileGroupId)
        {
            Database db   = LogicContext.GetDatabase();
            HSQL     hsql = new HSQL(db);

            hsql.Add("DELETE FROM DFSGROUP");
            hsql.Add("WHERE DFSGROUP_GROUPID = :DFSGROUP_GROUPID");
            hsql.AddParam("DFSGROUP_GROUPID", TimDbType.Float, 0, fileGroupId);
            int  affectedRows = db.ExecSQL(hsql);
            bool flag         = affectedRows < 1;

            return(!flag);
        }
Esempio n. 25
0
        public override HSQL BuildRecordSetSql()
        {
            HSQL hsql = base.BuildRecordSetSql();

            hsql.Clear();
            hsql.Add("SELECT DFSGROUP_GROUPID,DFSGROUP_FILEID");
            hsql.Add(",DFSFILE_FSID,DFSFILE_FILEID,DFSFILE_FILENAME,DFSFILE_EXTNAME,DFSFILE_FILESIZE");
            hsql.Add("FROM DFSGROUP LEFT JOIN DFSFILE ON DFSFILE_FILEID = DFSGROUP_FILEID");
            hsql.Add("WHERE DFSGROUP_GROUPID = :DFSGROUP_GROUPID");
            hsql.Add("ORDER BY DFSGROUP_FILEID");
            hsql.AddParam("DFSGROUP_GROUPID", TimDbType.Float, 0, this.QueryFileGroupId.ToInt());
            return(hsql);
        }
Esempio n. 26
0
        internal static bool UpdateAuthLastRequest(string sessionId, DateTime lastRequest)
        {
            Database database = LogicContext.GetDatabase();
            HSQL     sql      = new HSQL(database);

            sql.Raw = true;
            sql.Clear();
            sql.Add("update AUTH set");
            sql.Add(" AUTH_LASTREQUEST = :AUTH_LASTREQUEST");
            sql.Add(" where AUTH_SESSIONID=:AUTH_SESSIONID");
            sql.ParamByName("AUTH_SESSIONID").Value   = sessionId;
            sql.ParamByName("AUTH_LASTREQUEST").Value = lastRequest;
            return(database.ExecSQL(sql) == 1);
        }
Esempio n. 27
0
        private bool UpdateNextTime(int jobId, DateTime execTime, DateTime nextExecTime)
        {
            Database database = LogicContext.GetDatabase();
            HSQL     sql      = new HSQL(database);

            sql.Add(" update JOB set JOB_NEXTEXECTIME = :NEXTEXECTIME ");
            sql.Add(" where JOB_JOBID = :JOB_JOBID ");
            sql.Add(" and (JOB_NEXTEXECTIME IS NULL or JOB_NEXTEXECTIME = :EXECTIME)");
            sql.ParamByName("JOB_JOBID").Value       = jobId;
            sql.ParamByName("NEXTEXECTIME").Value    = nextExecTime;
            sql.ParamByName("EXECTIME").Value        = execTime;
            sql.ParamByName("EXECTIME").ParamterType = TimDbType.DateTime;
            return(database.ExecSQL(sql) > 0);
        }
Esempio n. 28
0
        internal static bool UpdateAuthLastRefresh(string sessionId)
        {
            Database database = LogicContext.GetDatabase();
            HSQL     sql      = new HSQL(database);

            sql.Raw = true;
            sql.Clear();
            sql.Add("update AUTH set");
            sql.Add(" AUTH_LASTREFRESH = :AUTH_LASTREFRESH");
            sql.Add(" where AUTH_SESSIONID=:AUTH_SESSIONID");
            sql.ParamByName("AUTH_SESSIONID").Value   = sessionId;
            sql.ParamByName("AUTH_LASTREFRESH").Value = AppRuntime.ServerDateTime;
            return(database.ExecSQL(sql) == 1);
        }
Esempio n. 29
0
        protected void btnDefault_Click(object sender, EventArgs e)
        {
            Database db   = LogicContext.GetDatabase();
            HSQL     hsql = new HSQL(db);

            hsql.Clear();
            hsql.Add("UPDATE REPORTSTYLE SET REPORTSTYLE_DEFAULT = 'N' WHERE REPORTSTYLE_STYLEID = :REPORTSTYLE_STYLEID");
            hsql.ParamByName("REPORTSTYLE_STYLEID").Value = this.gvMaster.DataKeys[this.gvMaster.SelectedIndex]["REPORTSTYLE_STYLEID"].ToString().Trim();
            db.ExecSQL(hsql);
            hsql.Clear();
            hsql.Add("UPDATE REPORTSTYLE SET REPORTSTYLE_DEFAULT = 'Y' WHERE REPORTSTYLE_STYLEID = :REPORTSTYLE_STYLEID AND REPORTSTYLE_ORDER = :REPORTSTYLE_ORDER");
            hsql.ParamByName("REPORTSTYLE_STYLEID").Value = this.gvMaster.DataKeys[this.gvMaster.SelectedIndex]["REPORTSTYLE_STYLEID"].ToString().Trim();
            hsql.ParamByName("REPORTSTYLE_ORDER").Value   = this.gvMaster.DataKeys[this.gvMaster.SelectedIndex]["REPORTSTYLE_ORDER"].ToString().Trim();
            db.ExecSQL(hsql);
            base.CurMaster_OnQuery(null, null);
        }
Esempio n. 30
0
        internal static void InsertDfsGroup(double fileGroupId, double fileId)
        {
            Database db   = LogicContext.GetDatabase();
            HSQL     hsql = new HSQL(db);

            hsql.Add("INSERT INTO DFSGROUP(DFSGROUP_GROUPID,DFSGROUP_FILEID)");
            hsql.Add("VALUES(:DFSGROUP_GROUPID,:DFSGROUP_FILEID)");
            hsql.AddParam("DFSGROUP_GROUPID", TimDbType.Float, 0, fileGroupId);
            hsql.AddParam("DFSGROUP_FILEID", TimDbType.Float, 0, fileId);
            int  affectedRows = db.ExecSQL(hsql);
            bool flag         = affectedRows < 1;

            if (flag)
            {
                throw new Exception("文件服务器异常!");
            }
        }