Exemple #1
0
    static public SYSLOG[] GetLog(uint dwDateMin, uint dwDateMax, uint dwRetCode, uint dwCmd, ref ParamExt ext)
    {
        SYSLOG[] ret = new SYSLOG[0];
        ext.nTotalCount = 0;

        try
        {
            lock (m_lockobj)
            {
                SQLiteConnection conn = GetConn();
                SQLiteCommand    cmd  = conn.CreateCommand();

                string szSubCMD = "";
                if (dwCmd != 0)
                {
                    //4294901760 === 0xFFFF0000
                    szSubCMD = " (dwCmd & 4294901760) = " + dwCmd + " and ";
                }

                //GetTotalCount
                if (dwRetCode == 0)
                {
                    cmd.CommandText = "select count(*) from log where " + szSubCMD + " dwDate >=@dwDateMin and dwDate <=@dwDateMax;";
                }
                else
                {
                    cmd.CommandText = "select count(*) from log where " + szSubCMD + " dwRetCode != 0 and dwDate >=@dwDateMin and dwDate <=@dwDateMax;";
                }
                cmd.Parameters.Add(new SQLiteParameter("dwDateMin", dwDateMin));
                cmd.Parameters.Add(new SQLiteParameter("dwDateMax", dwDateMax));
                SQLiteDataReader sdr = cmd.ExecuteReader();
                if (sdr.HasRows)
                {
                    DataTable datatbl = new DataTable();
                    datatbl.Load(sdr);
                    sdr.Close();
                    ext.nTotalCount = (uint)(long)datatbl.Rows[0][0];
                }
                //=============
                if (ext.nStartPage < 0)
                {
                    ext.nStartPage = 0;
                }
                if (ext.nStartPage > ext.nTotalCount)
                {
                    ext.nStartPage = ext.nTotalCount;
                }
                if (ext.nPageCount == 0)
                {
                    ext.nPageCount = ext.nTotalCount;
                }
                if (string.IsNullOrEmpty(ext.szOrderField))
                {
                    ext.szOrderField = "dwDate";
                }
                if (string.IsNullOrEmpty(ext.szOrder))
                {
                    ext.szOrder = "asc";
                }

                if (dwRetCode == 0)
                {
                    cmd.CommandText = "select rowid,* from log where " + szSubCMD + " dwDate >=@dwDateMin and dwDate <=@dwDateMax order by " + ext.szOrderField + " " + ext.szOrder + ",rowid " + ext.szOrder + " limit " + ext.nStartPage + "," + ext.nPageCount + ";";
                }
                else
                {
                    cmd.CommandText = "select rowid,* from log where " + szSubCMD + " dwRetCode != 0 and dwDate >=@dwDateMin and dwDate <=@dwDateMax order by " + ext.szOrderField + " " + ext.szOrder + ",rowid " + ext.szOrder + "  limit " + ext.nStartPage + "," + ext.nPageCount + ";";
                }
                cmd.Parameters.Add(new SQLiteParameter("dwDateMin", dwDateMin));
                cmd.Parameters.Add(new SQLiteParameter("dwDateMax", dwDateMax));
                sdr = cmd.ExecuteReader();
                if (sdr.HasRows)
                {
                    DataTable datatbl = new DataTable();
                    datatbl.Load(sdr);
                    sdr.Close();
                    ret = new SYSLOG[datatbl.Rows.Count];
                    for (int i = 0; i < ret.Length; i++)
                    {
                        ret[i]              = new SYSLOG();
                        ret[i].dwID         = GetDW(datatbl.Rows[i], "rowid");
                        ret[i].dwDate       = GetDW(datatbl.Rows[i], "dwDate");
                        ret[i].dwTime       = GetDW(datatbl.Rows[i], "dwTime");
                        ret[i].dwCmd        = GetDW(datatbl.Rows[i], "dwCmd");
                        ret[i].dwRetCode    = GetDW(datatbl.Rows[i], "dwRetCode");
                        ret[i].dwUseTime    = GetDW(datatbl.Rows[i], "dwUseTime");
                        ret[i].dwParamSize  = GetDW(datatbl.Rows[i], "dwParamSize");
                        ret[i].dwResultSize = GetDW(datatbl.Rows[i], "dwResultSize");
                        //ret[i].param = GetDW(datatbl.Rows[i],"param");
                        ret[i].szMessage   = GetSZ(datatbl.Rows[i], "szMessage");
                        ret[i].szSessionID = GetSZ(datatbl.Rows[i], "szSessionID");
                        ret[i].szStationSN = GetSZ(datatbl.Rows[i], "szStationSN");
                    }
                }
                cmd.Dispose();
            }
        }
        catch (Exception e)
        {
            Logger.Trace(e.Message);
        }
        return(ret);
    }
Exemple #2
0
 public bool ValidateShowParam(bool createMissing = true)
 {
     UnityEditor.Animations.AnimatorController c;
     return(ParamEditorExt.GetAnimatorController(this, out c) &&
            ParamEditorExt.ValidateAnimatorControllerParam(c, ParamExt.DefaultParamName <Show> (), typeof(bool), createMissing));
 }
Exemple #3
0
 public bool ValidateImmediateParam(bool createMissing = true)
 {
     UnityEditor.Animations.AnimatorController c;
     return(ParamEditorExt.GetAnimatorController(this, out c) &&
            ParamEditorExt.ValidateAnimatorControllerParam(c, ParamExt.DefaultParamNameRemovingSuffixes <ImmediateTrigger> ("Trigger"), typeof(Invocable), createMissing));
 }
Exemple #4
0
    static public WORK_DATA[] GetWork(uint dwUserID, uint dwDateMin, uint dwDateMax, uint dwID, uint dwFlag, ref ParamExt ext)
    {
        WORK_DATA[] ret = null;
        ext.nTotalCount = 0;

        try
        {
            lock (m_lockobj)
            {
                SQLiteConnection conn = GetConn();
                SQLiteCommand    cmd  = conn.CreateCommand();

                string szSubCMD = "";
                if (dwFlag != 0)
                {
                    //4294901760 === 0xFFFF0000
                    szSubCMD = " dwFlag = " + dwFlag + " and ";
                }
                if (dwID != 0)
                {
                    szSubCMD += " rowid = " + dwID + " and ";
                }

                cmd.CommandText = "select count(*) from work where " + szSubCMD + " dwDate >=@dwDateMin and dwDate <=@dwDateMax and dwUserID == @dwUserID;";

                cmd.Parameters.Add(new SQLiteParameter("dwDateMin", dwDateMin));
                cmd.Parameters.Add(new SQLiteParameter("dwDateMax", dwDateMax));
                cmd.Parameters.Add(new SQLiteParameter("dwUserID", dwUserID));
                SQLiteDataReader sdr = cmd.ExecuteReader();
                if (sdr.HasRows)
                {
                    DataTable datatbl = new DataTable();
                    datatbl.Load(sdr);
                    sdr.Close();
                    ext.nTotalCount = (uint)(long)datatbl.Rows[0][0];
                }
                //=============
                if (ext.nStartPage < 0)
                {
                    ext.nStartPage = 0;
                }
                if (ext.nStartPage > ext.nTotalCount)
                {
                    ext.nStartPage = ext.nTotalCount;
                }
                if (ext.nPageCount == 0)
                {
                    ext.nPageCount = ext.nTotalCount;
                }
                if (string.IsNullOrEmpty(ext.szOrderField))
                {
                    ext.szOrderField = "dwDate";
                }
                if (string.IsNullOrEmpty(ext.szOrder))
                {
                    ext.szOrder = "asc";
                }

                cmd.CommandText = "select rowid,* from work where " + szSubCMD + " dwDate >=@dwDateMin and dwDate <=@dwDateMax and dwUserID == @dwUserID order by " + ext.szOrderField + " " + ext.szOrder + ",rowid " + ext.szOrder + " limit " + ext.nStartPage + "," + ext.nPageCount + ";";

                cmd.Parameters.Add(new SQLiteParameter("dwDateMin", dwDateMin));
                cmd.Parameters.Add(new SQLiteParameter("dwDateMax", dwDateMax));
                cmd.Parameters.Add(new SQLiteParameter("dwUserID", dwUserID));
                sdr = cmd.ExecuteReader();
                if (sdr.HasRows)
                {
                    DataTable datatbl = new DataTable();
                    datatbl.Load(sdr);
                    sdr.Close();
                    ret = new WORK_DATA[datatbl.Rows.Count];
                    for (int i = 0; i < ret.Length; i++)
                    {
                        ret[i]                = new WORK_DATA();
                        ret[i].dwID           = GetDW(datatbl.Rows[i], "rowid");
                        ret[i].dwDate         = GetDW(datatbl.Rows[i], "dwDate");
                        ret[i].dwTime         = GetDW(datatbl.Rows[i], "dwTime");
                        ret[i].szTitle        = GetSZ(datatbl.Rows[i], "szTitle");
                        ret[i].dwFlag         = GetDW(datatbl.Rows[i], "dwFlag");
                        ret[i].szFileName     = GetSZ(datatbl.Rows[i], "szFileName");
                        ret[i].szUserFileName = GetSZ(datatbl.Rows[i], "szUserFileName");
                    }
                }
            }
        }
        catch (Exception e)
        {
            //Logger.Trace(e.Message);
        }
        return(ret);
    }