Example #1
0
        public override bool SetObject(int nRow, int nCol, AFIDENTID 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_OBJECT)
                {
                    if (valueList.ObjectVal(nCol) != value)
                    {
                        AFCDataList oldValue = new AFCDataList();
                        oldValue.AddObject(valueList.ObjectVal(nCol));

                        valueList.SetObject(nCol, value);

                        AFCDataList newValue = new AFCDataList();
                        newValue.AddObject(valueList.ObjectVal(nCol));

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

                return(true);
            }

            return(false);
        }
Example #2
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;
                }
            }
        }
Example #3
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);
        }
Example #4
0
        public override AFIDENTID QueryObject(int nRow, int nCol)
        {
            AFIDataList valueList = QueryRow(nRow);

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

            return(new AFIDENTID());
        }
Example #5
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);
        }
Example #6
0
        public override AFIObject CreateObject(AFIDENTID self, int nContainerID, int nGroupID, string strClassName, string strConfigIndex, AFIDataList arg)
        {
            if (!mhtObject.ContainsKey(self))
            {
                AFIObject xNewObject = new AFCObject(self, nContainerID, nGroupID, strClassName, strConfigIndex);
                mhtObject.Add(self, xNewObject);

                AFCDataList varConfigID = new AFCDataList();
                varConfigID.AddString(strConfigIndex);
                xNewObject.GetPropertyManager().AddProperty("ConfigID", varConfigID);

                AFCDataList varConfigClass = new AFCDataList();
                varConfigClass.AddString(strClassName);
                xNewObject.GetPropertyManager().AddProperty("ClassName", varConfigClass);

                if (arg.Count() % 2 == 0)
                {
                    for (int i = 0; i < arg.Count() - 1; i += 2)
                    {
                        string strPropertyName         = arg.StringVal(i);
                        AFIDataList.VARIANT_TYPE eType = arg.GetType(i + 1);
                        switch (eType)
                        {
                        case AFIDataList.VARIANT_TYPE.VTYPE_INT:
                        {
                            AFIDataList xDataList = new AFCDataList();
                            xDataList.AddInt64(arg.Int64Val(i + 1));
                            xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                        }
                        break;

                        case AFIDataList.VARIANT_TYPE.VTYPE_FLOAT:
                        {
                            AFIDataList xDataList = new AFCDataList();
                            xDataList.AddFloat(arg.FloatVal(i + 1));
                            xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                        }
                        break;

                        case AFIDataList.VARIANT_TYPE.VTYPE_DOUBLE:
                        {
                            AFIDataList xDataList = new AFCDataList();
                            xDataList.AddDouble(arg.DoubleVal(i + 1));
                            xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                        }
                        break;

                        case AFIDataList.VARIANT_TYPE.VTYPE_STRING:
                        {
                            AFIDataList xDataList = new AFCDataList();
                            xDataList.AddString(arg.StringVal(i + 1));
                            xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                        }
                        break;

                        case AFIDataList.VARIANT_TYPE.VTYPE_OBJECT:
                        {
                            AFIDataList xDataList = new AFCDataList();
                            xDataList.AddObject(arg.ObjectVal(i + 1));
                            xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                        }
                        break;

                        default:
                            break;
                        }
                    }
                }

                InitProperty(self, strClassName);
                InitRecord(self, strClassName);

                if (mhtClassHandleDel.ContainsKey(strClassName))
                {
                    ClassHandleDel xHandleDel = (ClassHandleDel)mhtClassHandleDel[strClassName];
                    if (null != xHandleDel && null != xHandleDel.GetHandler())
                    {
                        AFIObject.ClassEventHandler xHandlerList = xHandleDel.GetHandler();
                        xHandlerList(self, nContainerID, nGroupID, AFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE, strClassName, strConfigIndex);
                        xHandlerList(self, nContainerID, nGroupID, AFIObject.CLASS_EVENT_TYPE.OBJECT_LOADDATA, strClassName, strConfigIndex);
                        xHandlerList(self, nContainerID, nGroupID, AFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE_FINISH, strClassName, strConfigIndex);
                    }
                }

                //AFCLog.Instance.Log(AFCLog.LOG_LEVEL.DEBUG, "Create object: " + self.ToString() + " ClassName: " + strClassName + " SceneID: " + nContainerID + " GroupID: " + nGroupID);
                return(xNewObject);
            }

            return(null);
        }