コード例 #1
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);
        }
コード例 #2
0
ファイル: ReportStyle.cs プロジェクト: zhaoxf101/Friend
        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);
        }
コード例 #3
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);
        }
コード例 #4
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);
        }
コード例 #5
0
ファイル: ReportStyle.cs プロジェクト: zhaoxf101/Friend
        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);
        }
コード例 #6
0
ファイル: StyleDesignInfo.cs プロジェクト: zhaoxf101/Friend
        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);
        }
コード例 #7
0
ファイル: StyleDesignInfo.cs プロジェクト: zhaoxf101/Friend
        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);
        }
コード例 #8
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);
        }
コード例 #9
0
ファイル: DbHelper.cs プロジェクト: zhaoxf101/Friend
        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);
        }
コード例 #10
0
ファイル: AuthUtils.cs プロジェクト: zhaoxf101/Friend
        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);
        }
コード例 #11
0
ファイル: JobScheduleTask.cs プロジェクト: zhaoxf101/Friend
        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);
        }
コード例 #12
0
ファイル: AuthUtils.cs プロジェクト: zhaoxf101/Friend
        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);
        }
コード例 #13
0
ファイル: AuthUtils.cs プロジェクト: zhaoxf101/Friend
        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);
        }
コード例 #14
0
ファイル: AuthUtils.cs プロジェクト: zhaoxf101/Friend
        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);
        }
コード例 #15
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);
        }
コード例 #16
0
ファイル: ReportStyleList.cs プロジェクト: zhaoxf101/Friend
        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);
        }
コード例 #17
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);
        }
コード例 #18
0
ファイル: AuthUtils.cs プロジェクト: zhaoxf101/Friend
        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);
                }
            }
        }
コード例 #19
0
ファイル: DbTableCacheEvent.cs プロジェクト: zhaoxf101/Friend
        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));
        }
コード例 #20
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);
        }
コード例 #21
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;
                }
            }
        }
コード例 #22
0
ファイル: AuthUtils.cs プロジェクト: zhaoxf101/Friend
        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);
        }
コード例 #23
0
ファイル: FileService.cs プロジェクト: zhaoxf101/Friend
        internal static void InsertDfsFile(string fsId, double fileId, string fileName, string exName, long fileSize)
        {
            Database db   = LogicContext.GetDatabase();
            HSQL     hsql = new HSQL(db);

            hsql.Add("INSERT INTO DFSFILE(DFSFILE_FSID,DFSFILE_FILEID,DFSFILE_FILENAME,DFSFILE_EXTNAME,DFSFILE_FILESIZE)");
            hsql.Add("VALUES(:DFSFILE_FSID,:DFSFILE_FILEID,:DFSFILE_FILENAME,:DFSFILE_EXTNAME,:DFSFILE_FILESIZE)");
            hsql.ParamByName("DFSFILE_FSID").Value     = fsId;
            hsql.ParamByName("DFSFILE_FILEID").Value   = fileId;
            hsql.ParamByName("DFSFILE_FILENAME").Value = fileName;
            hsql.ParamByName("DFSFILE_EXTNAME").Value  = exName;
            hsql.ParamByName("DFSFILE_FILESIZE").Value = fileSize;
            int  affectedRows = db.ExecSQL(hsql);
            bool flag         = affectedRows < 1;

            if (flag)
            {
                throw new Exception("文件服务器异常!");
            }
        }
コード例 #24
0
        public static bool ResetPsw(string userId, string resetPsw)
        {
            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, resetPsw);
            sql.ParamByName("USERS_USERID").Value   = userId;
            bool flag = database.ExecSQL(sql) != 1;

            if (flag)
            {
                throw new Exception(string.Format("用户({0})密码修改失败!", userId));
            }
            CacheEvent.TableIsUpdated("USERS");
            return(true);
        }
コード例 #25
0
ファイル: TimIdUtils.cs プロジェクト: zhaoxf101/Friend
        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);
        }
コード例 #26
0
 private void SetSqlParams(HSQL hsql)
 {
     foreach (string paramName in hsql.ParamList)
     {
         bool flag = this.RecordSet.Columns.Contains(paramName);
         if (flag)
         {
             bool beDoc = this.Entity.BeDoc;
             if (beDoc)
             {
                 bool flag2 = paramName == this.Entity.Table + "_FGID";
                 if (flag2)
                 {
                     hsql.ParamByName(paramName).Value = this.FileGroupId;
                     continue;
                 }
                 bool flag3 = paramName == this.Entity.Table + "_FILES";
                 if (flag3)
                 {
                     hsql.ParamByName(paramName).Value = this.GroupFiles;
                     continue;
                 }
             }
             bool flag4 = this.Fields.ContainsKey(paramName) && this.Fields[paramName].DbType == TimDbType.DateTime && string.IsNullOrEmpty(this.RecordSet.Rows[this.ActivedIndex][paramName].ToString().Trim());
             if (flag4)
             {
                 hsql.ParamByName(paramName).Value = null;
             }
             else
             {
                 hsql.ParamByName(paramName).Value = this.RecordSet.Rows[this.ActivedIndex][paramName].ToString();
             }
         }
         else
         {
             bool flag5 = paramName == this.Entity.Table + "_WFID";
             if (flag5)
             {
                 hsql.ParamByName(paramName).Value = this.WorkflowId;
             }
             else
             {
                 bool flag6 = paramName == this.Entity.Table + "_WFRUNID";
                 if (flag6)
                 {
                     hsql.ParamByName(paramName).Value = this.WorkflowRunId;
                 }
             }
         }
     }
 }
コード例 #27
0
ファイル: AuthUtils.cs プロジェクト: zhaoxf101/Friend
        private static bool GetUltIdLastRefreshTimeAndDbTime(out DateTime lastRefreshTime, out DateTime dbTime)
        {
            Database database = LogicContext.GetDatabase();
            HSQL     sql      = new HSQL(database);

            sql.Clear();
            sql.Raw = true;
            bool flag2 = database.Driver == DbProviderType.MSSQL;

            if (flag2)
            {
                sql.Add("select AUTH_LASTREFRESH,getdate() as DBTIME");
            }
            else
            {
                bool flag3 = database.Driver == DbProviderType.ORACLE;
                if (flag3)
                {
                    sql.Add("select AUTH_LASTREFRESH,sysdate as DBTIME");
                }
            }
            sql.Add("from AUTH");
            sql.Add("where AUTH_SESSIONID = :AUTH_SESSIONID");
            sql.ParamByName("AUTH_SESSIONID").Value = "876978727978717673657871";
            DataTable dataTable = database.OpenDataSet(sql).Tables[0];
            bool      flag4     = dataTable.Rows.Count == 1;
            bool      flag;

            if (flag4)
            {
                DataRow dataRow = dataTable.Rows[0];
                flag            = true;
                lastRefreshTime = dataRow["AUTH_LASTREFRESH"].ToString().ToDateTime();
                dbTime          = dataRow["DBTIME"].ToString().ToDateTime();
            }
            else
            {
                flag            = false;
                lastRefreshTime = AppRuntime.UltDateTime;
                dbTime          = AppRuntime.UltDateTime;
            }
            return(flag);
        }
コード例 #28
0
        public static string GetBBLX(string sBBBH)
        {
            string   R_BBLX = "";
            Database db     = LogicContext.GetDatabase();

            try
            {
                HSQL hsql = new HSQL(db);
                hsql.Clear();
                hsql.Add("   select BBSZ_BBLX from BBSZ ");
                hsql.Add(" where BBSZ_BH=:BBSZ_BH ");
                hsql.ParamByName("BBSZ_BH").Value = sBBBH;
                DataSet ds   = db.OpenDataSet(hsql);
                bool    flag = ds.Tables[0].Rows.Count > 0;
                if (flag)
                {
                    R_BBLX = ds.Tables[0].Rows[0]["BBSZ_BBLX"].ToString().Trim();
                }
            }
            catch
            {
            }
            return(R_BBLX);
        }
コード例 #29
0
ファイル: DbTableCacheEvent.cs プロジェクト: zhaoxf101/Friend
        public static int InsertUCache(string tableName)
        {
            Database database = LogicContext.GetDatabase();
            HSQL     sql      = new HSQL(database);

            sql.Clear();
            sql.Add("insert into UCACHE(UCACHE_TABLENAME, UCACHE_UPDTIME)");
            bool flag = database.Driver == DbProviderType.MSSQL;

            if (flag)
            {
                sql.Add("values(:UCACHE_TABLENAME,getdate())");
            }
            else
            {
                bool flag2 = database.Driver == DbProviderType.ORACLE;
                if (flag2)
                {
                    sql.Add("values(:UCACHE_TABLENAME,sysdate)");
                }
            }
            sql.ParamByName("UCACHE_TABLENAME").Value = tableName;
            return(database.ExecSQL(sql));
        }
コード例 #30
0
ファイル: AuthUtils.cs プロジェクト: zhaoxf101/Friend
        internal static Auth SelectAuth(string sessionId)
        {
            Database database = LogicContext.GetDatabase();
            HSQL     sql      = new HSQL(database);

            sql.Add("select AUTH_SESSIONID,AUTH_USERID,USERS_USERNAME,AUTH_LOGINTIME,AUTH_LOGINTYPE,AUTH_CLIENTIP,AUTH_CLIENTNAME,AUTH_DBID");
            sql.Add(",AUTH_LASTREFRESH,AUTH_LASTREQUEST,AUTH_UPDATETIME,AUTH_EXINFO");
            sql.Add("from AUTH,USERS");
            sql.Add("where AUTH_SESSIONID=:AUTH_SESSIONID AND AUTH_USERID = USERS_USERID");
            sql.ParamByName("AUTH_SESSIONID").Value = sessionId;
            DataTable dataTable = database.OpenDataSet(sql).Tables[0];
            bool      flag      = dataTable.Rows.Count > 0;
            Auth      result;

            if (flag)
            {
                result = AuthUtils.GetObject(dataTable.Rows[0]);
            }
            else
            {
                result = null;
            }
            return(result);
        }