Exemplo n.º 1
0
        public override bool SetInt(int nRow, int nCol, Int64 value)
        {
            if (nRow >= 0 && nRow < mnRow)
            {
                if (!mhtRecordVec.ContainsKey(nRow))
                {
                    AddRow(nRow);
                }
                AFIDataList valueList = (AFIDataList)mhtRecordVec[nRow];
                if (valueList.GetType(nCol) == AFIDataList.VARIANT_TYPE.VTYPE_INT)
                {
                    if (valueList.Int64Val(nCol) != value)
                    {
                        AFCDataList oldValue = new AFCDataList();
                        oldValue.AddInt64(valueList.Int64Val(nCol));

                        valueList.SetInt64(nCol, value);

                        AFCDataList newValue = new AFCDataList();
                        newValue.AddInt64(valueList.Int64Val(nCol));

                        if (null != doHandleDel)
                        {
                            doHandleDel(mSelf, mstrRecordName, eRecordOptype.Updata, nRow, nCol, oldValue, newValue);
                        }
                    }
                }
                return(true);
            }
            return(false);
        }
Exemplo n.º 2
0
 public override void DoEvent(AFIDataList valueList)
 {
     if (null != mHandlerDel)
     {
         mHandlerDel(mSelf, mnEventID, mArgValueList, valueList);
     }
 }
Exemplo n.º 3
0
        public override void Update(float fPassTime)
        {
            AFIDataList keyList = null;

            foreach (KeyValuePair <string, AFIHeartBeat> kv in mhtHeartBeat)
            {
                AFIHeartBeat heartBeat = (AFIHeartBeat)kv.Value;
                if (heartBeat.Update(fPassTime))
                {
                    if (null == keyList)
                    {
                        keyList = new AFCDataList();
                    }

                    keyList.AddString((string)kv.Key);
                }
            }

            if (null != keyList)
            {
                for (int i = 0; i < keyList.Count(); i++)
                {
                    mhtHeartBeat.Remove(keyList.StringVal(i));
                }
            }
        }
Exemplo n.º 4
0
        //public override int FindRow( int nRow );
        public override int FindColValue(int nCol, AFIDataList var)
        {
            for (int i = 0; i < mhtRecordVec.Count; i++)
            {
                AFIDataList valueList = (AFIDataList)mhtRecordVec[i];
                switch (valueList.GetType(0))
                {
                case AFIDataList.VARIANT_TYPE.VTYPE_INT:
                    return(FindInt(nCol, var.Int64Val(0)));

                case AFIDataList.VARIANT_TYPE.VTYPE_FLOAT:
                    return(FindInt(nCol, var.Int64Val(0)));

                case AFIDataList.VARIANT_TYPE.VTYPE_DOUBLE:
                    return(FindInt(nCol, var.Int64Val(0)));

                case AFIDataList.VARIANT_TYPE.VTYPE_STRING:
                    return(FindInt(nCol, var.Int64Val(0)));

                case AFIDataList.VARIANT_TYPE.VTYPE_OBJECT:
                    return(FindObject(nCol, var.ObjectVal(0)));

                default:
                    break;
                }
            }


            return(-1);
        }
Exemplo n.º 5
0
        public override bool SetDouble(int nRow, int nCol, double value)
        {
            if (nRow >= 0 && nRow < mnRow)
            {
                if (!mhtRecordVec.ContainsKey(nRow))
                {
                    AddRow(nRow);
                }

                AFIDataList valueList = (AFIDataList)mhtRecordVec[nRow];
                if (valueList.GetType(nCol) == AFIDataList.VARIANT_TYPE.VTYPE_DOUBLE)
                {
                    if (valueList.DoubleVal(nCol) - value > 0.01f ||
                        valueList.DoubleVal(nCol) - value < -0.01f)
                    {
                        AFCDataList oldValue = new AFCDataList();
                        oldValue.AddDouble(valueList.DoubleVal(nCol));

                        valueList.SetDouble(nCol, value);

                        AFCDataList newValue = new AFCDataList();
                        newValue.AddDouble(valueList.DoubleVal(nCol));

                        if (null != doHandleDel)
                        {
                            doHandleDel(mSelf, mstrRecordName, eRecordOptype.Updata, nRow, nCol, oldValue, newValue);
                        }
                    }
                }

                return(true);
            }
            return(false);
        }
Exemplo n.º 6
0
 public AFCRecord(AFIDENTID self, string strRecordName, int nRow, AFIDataList varData)
 {
     mSelf          = self;
     mnRow          = nRow;
     mstrRecordName = strRecordName;
     mVarRecordType = new AFCDataList(varData);
 }
Exemplo n.º 7
0
        public AFCDataList(AFIDataList src)
        {
            for (int i = 0; i < src.Count(); i++)
            {
                switch (src.GetType(i))
                {
                case VARIANT_TYPE.VTYPE_INT:
                    AddInt64(src.Int64Val(i));
                    break;

                case VARIANT_TYPE.VTYPE_FLOAT:
                    AddFloat(src.FloatVal(i));
                    break;

                case VARIANT_TYPE.VTYPE_DOUBLE:
                    AddDouble(src.DoubleVal(i));
                    break;

                case VARIANT_TYPE.VTYPE_STRING:
                    AddString(src.StringVal(i));
                    break;

                case VARIANT_TYPE.VTYPE_OBJECT:
                    AddObject(src.ObjectVal(i));
                    break;

                default:
                    break;
                }
            }
        }
Exemplo n.º 8
0
        public override AFIRecord AddRecord(string strRecordName, int nRow, AFIDataList varData)
        {
            AFIRecord record = new AFCRecord(mSelf, strRecordName, nRow, varData);

            mhtRecord.Add(strRecordName, record);

            return(record);
        }
Exemplo n.º 9
0
 public override void DoEvent(int nEventID, AFIDataList valueList)
 {
     if (mhtEvent.ContainsKey(nEventID))
     {
         AFIEvent identEvent = (AFIEvent)mhtEvent[nEventID];
         identEvent.DoEvent(valueList);
     }
 }
Exemplo n.º 10
0
 public AFCHeartBeat(AFIDENTID self, string strHeartBeatName, float fTime, AFIDataList valueList)
 {
     mSelf             = self;
     mstrHeartBeatName = strHeartBeatName;
     mfTime            = fTime;
     mfOldTime         = fTime;
     mArgValueList     = valueList;
 }
Exemplo n.º 11
0
        public override AFIDENTID QueryObject(int nRow, int nCol)
        {
            AFIDataList valueList = QueryRow(nRow);

            if (null != valueList)
            {
                return(valueList.ObjectVal(nCol));
            }

            return(new AFIDENTID());
        }
Exemplo n.º 12
0
        public override string QueryString(int nRow, int nCol)
        {
            AFIDataList valueList = QueryRow(nRow);

            if (null != valueList)
            {
                return(valueList.StringVal(nCol));
            }

            return("");
        }
Exemplo n.º 13
0
        public override double QueryDouble(int nRow, int nCol)
        {
            AFIDataList valueList = QueryRow(nRow);

            if (null != valueList)
            {
                return(valueList.DoubleVal(nCol));
            }

            return(0.0);
        }
Exemplo n.º 14
0
        public override float QueryFloat(int nRow, int nCol)
        {
            AFIDataList valueList = QueryRow(nRow);

            if (null != valueList)
            {
                return(valueList.FloatVal(nCol));
            }

            return(0.0f);
        }
Exemplo n.º 15
0
        public override Int64 QueryInt(int nRow, int nCol)
        {
            AFIDataList valueList = QueryRow(nRow);

            if (null != valueList)
            {
                return(valueList.Int64Val(nCol));
            }

            return(0);
        }
Exemplo n.º 16
0
        public override AFCoreEx.AFIDataList.Var_Data QueryDataObject(int nRow, int nCol)
        {
            AFIDataList valueList = QueryRow(nRow);

            if (null != valueList)
            {
                return(valueList.VarVal(nCol));
            }

            return(new AFCoreEx.AFIDataList.Var_Data());
        }
Exemplo n.º 17
0
 static void OnPropertydHandler(AFIDENTID self, string strProperty, AFIDataList oldVar, AFIDataList newVar)
 {
     Debug.Log(self);
     Debug.Log(" ");
     Debug.Log(strProperty);
     Debug.Log(" ");
     Debug.Log(oldVar.Int64Val(0));
     Debug.Log(" ");
     Debug.Log(newVar.Int64Val(0));
     Debug.Log(" ");
 }
Exemplo n.º 18
0
 static void OnPropertydHandler(AFIDENTID self, string strProperty, AFIDataList oldVar, AFIDataList newVar)
 {
     Console.Write(self);
     Console.Write(" ");
     Console.Write(strProperty);
     Console.Write(" ");
     Console.Write(oldVar.Int64Val(0));
     Console.Write(" ");
     Console.Write(newVar.Int64Val(0));
     Console.WriteLine(" ");
 }
Exemplo n.º 19
0
        public override AFIProperty AddProperty(string strPropertyName, AFIDataList varData)
        {
            AFIProperty xProperty = null;

            if (!mhtProperty.ContainsKey(strPropertyName))
            {
                xProperty = new AFCProperty(mSelf, strPropertyName, varData);
                mhtProperty[strPropertyName] = xProperty;
            }

            return(xProperty);
        }
Exemplo n.º 20
0
 public override int FindFloat(int nCol, float value)
 {
     foreach (int i in mhtRecordVec.Keys)
     {
         AFIDataList valueList = (AFIDataList)mhtRecordVec[i];
         if (valueList.FloatVal(nCol) == value)
         {
             return(i);
         }
     }
     return(-1);
 }
Exemplo n.º 21
0
 public override int FindDouble(int nCol, double value)
 {
     foreach (int i in mhtRecordVec.Keys)
     {
         AFIDataList valueList = (AFIDataList)mhtRecordVec[i];
         if (valueList.DoubleVal(nCol) == value)
         {
             return(i);
         }
     }
     return(-1);
 }
Exemplo n.º 22
0
 public override bool SetProperty(string strPropertyName, AFIDataList varData)
 {
     if (mhtProperty.ContainsKey(strPropertyName))
     {
         AFIProperty xProperty = (AFCProperty)mhtProperty[strPropertyName];
         if (null != xProperty)
         {
             xProperty.SetValue(varData);
         }
     }
     return(true);
 }
Exemplo n.º 23
0
        public override int FindObject(int nCol, AFIDENTID value)
        {
            foreach (int i in mhtRecordVec.Keys)
            {
                AFIDataList valueList = (AFIDataList)mhtRecordVec[i];
                if (valueList.ObjectVal(nCol) == value)
                {
                    return(i);
                }
            }

            return(-1);
        }
Exemplo n.º 24
0
        public override int FindString(int nCol, string value)
        {
            foreach (int i in mhtRecordVec.Keys)
            {
                AFIDataList valueList = (AFIDataList)mhtRecordVec[i];
                if (valueList.StringVal(nCol) == value)
                {
                    return(i);
                }
            }

            return(-1);
        }
Exemplo n.º 25
0
        // set data
        public override int SetValue(int nRow, AFIDataList var)
        {
            if (nRow >= 0 && nRow < mnRow)
            {
                if (!mhtRecordVec.ContainsKey(nRow))
                {
                    AddRow(nRow);
                }

                mhtRecordVec[nRow] = var;
                return(nRow);
            }
            return(-1);
        }
Exemplo n.º 26
0
        void AddBasePropertyFormOther(string strName, string strOther)
        {
            AFILogicClass xOtherClass = GetElement(strOther);
            AFILogicClass xLogicClass = GetElement(strName);

            if (null != xLogicClass && null != xOtherClass)
            {
                AFIDataList xValue = xOtherClass.GetPropertyManager().GetPropertyList();
                for (int i = 0; i < xValue.Count(); ++i)
                {
                    AFIProperty xProperty = xOtherClass.GetPropertyManager().GetProperty(xValue.StringVal(i));
                    xLogicClass.GetPropertyManager().AddProperty(xValue.StringVal(i), xProperty.GetValue());
                }
            }
        }
Exemplo n.º 27
0
        public override bool SwapRow(int nOriginRow, int nTargetRow)
        {
            if (nOriginRow >= 0 && nOriginRow < mnRow && nTargetRow >= 0 && nTargetRow < mnRow)
            {
                AFIDataList valueOriginList = null;
                AFIDataList valueTargetList = null;

                if (mhtRecordVec.ContainsKey(nOriginRow))
                {
                    valueOriginList = (AFIDataList)mhtRecordVec[nOriginRow];
                }
                if (mhtRecordVec.ContainsKey(nTargetRow))
                {
                    valueTargetList = (AFIDataList)mhtRecordVec[nOriginRow];
                }

                if (null == valueTargetList)
                {
                    if (mhtRecordVec.ContainsKey(nOriginRow))
                    {
                        mhtRecordVec.Remove(nOriginRow);
                    }
                }
                else
                {
                    mhtRecordVec[nOriginRow] = valueTargetList;
                }

                if (null == valueOriginList)
                {
                    if (mhtRecordVec.ContainsKey(nTargetRow))
                    {
                        mhtRecordVec.Remove(nTargetRow);
                    }
                }
                else
                {
                    mhtRecordVec[nTargetRow] = valueOriginList;
                }

                if (null != doHandleDel)
                {
                    doHandleDel(mSelf, mstrRecordName, eRecordOptype.Swap, nOriginRow, nTargetRow, new AFCDataList(), new AFCDataList());
                }
                return(true);
            }
            return(false);
        }
Exemplo n.º 28
0
        public override int AddRow(int nRow, AFIDataList var)
        {
            if (nRow >= 0 && nRow < mnRow)
            {
                if (!mhtRecordVec.ContainsKey(nRow))
                {
                    mhtRecordVec[nRow] = new AFCDataList(var);

                    if (null != doHandleDel)
                    {
                        doHandleDel(mSelf, mstrRecordName, eRecordOptype.Add, nRow, 0, var, var);
                    }
                    return(nRow);
                }
            }


            return(-1);
        }
Exemplo n.º 29
0
        public override bool SetDataObject(int nRow, int nCol, AFCoreEx.AFIDataList.Var_Data value)
        {
            if (nRow >= 0 && nRow < mnRow)
            {
                if (!mhtRecordVec.ContainsKey(nRow))
                {
                    AddRow(nRow);
                }

                AFIDataList valueList = (AFIDataList)mhtRecordVec[nRow];
                if (valueList.GetType(nCol) == value.nType)
                {
                    if (valueList.VarVal(nCol) != value)
                    {
                        AFCDataList oldValue = new AFCDataList();
                        AFCoreEx.AFIDataList.Var_Data xOld = valueList.VarVal(nCol);
                        oldValue.AddDataObject(ref xOld);

                        valueList.SetDataObject(nCol, value);

                        AFCDataList newValue = new AFCDataList();
                        AFCoreEx.AFIDataList.Var_Data xNew = valueList.VarVal(nCol);
                        newValue.AddDataObject(ref xNew);

                        if (null != doHandleDel)
                        {
                            doHandleDel(mSelf, mstrRecordName, eRecordOptype.Updata, nRow, nCol, oldValue, newValue);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }

                return(true);
            }

            return(false);
        }
Exemplo n.º 30
0
        void InitRecord(AFIDENTID self, string strClassName)
        {
            AFILogicClass xLogicClass = AFCLogicClassManager.Instance.GetElement(strClassName);

            if (null == xLogicClass)
            {
                return;
            }

            AFIDataList xDataList = xLogicClass.GetRecordManager().GetRecordList();

            for (int i = 0; i < xDataList.Count(); ++i)
            {
                string    strRecordyName = xDataList.StringVal(i);
                AFIRecord xRecord        = xLogicClass.GetRecordManager().GetRecord(strRecordyName);

                AFIObject        xObject        = GetObject(self);
                AFIRecordManager xRecordManager = xObject.GetRecordManager();

                xRecordManager.AddRecord(strRecordyName, xRecord.GetRows(), xRecord.GetColsData());
            }
        }