Пример #1
0
        /// <summary>
        /// 复制数据对象
        /// </summary>
        /// <param name="sou">源对象,需从DataPacket继承</param>
        public override void AssignFrom(DataPacket sou)
        {
            base.AssignFrom(sou);
            CtaColData s = sou as CtaColData;

            if (s != null)
            {
                _ctaStatus = s._ctaStatus;
            }
        }
Пример #2
0
        /// <summary>
        /// 比较记录一致
        /// </summary>
        /// <param name="rec"></param>
        /// <param name="drec"></param>
        /// <param name="compd">比较子表记录</param>
        /// <returns></returns>
        public int CompareRec(CtaRecData rec, CtaRecData drec, bool compd = false)
        {
            int ret = 0;

            DataList fields = colList;

            if (compd)
            {
                fields = dcolList;
            }
            foreach (CtaColDef coldef in fields)
            {
                if (!coldef.unCheck)
                {
                    CtaColData coldata  = rec.GetColDataByCol(coldef.colIndx) as CtaColData;
                    CtaColData dcoldata = drec.GetColDataByCol(coldef.colIndx) as CtaColData;
                    bool       issame   = true;
                    switch (coldef.colType)
                    {
                    case (int)_dataType.dtInt:
                    case (int)_dataType.dtFloat:
                    {
                        double v1 = 0, v2 = 0;
                        if (coldata != null)
                        {
                            double.TryParse(coldata.express, out v1);
                        }
                        if (dcoldata != null)
                        {
                            double.TryParse(dcoldata.express, out v2);
                        }
                        issame = (v1 == v2);
                        break;
                    }

                    case (int)_dataType.dtBoolean:
                    {
                        bool v1 = false, v2 = false;
                        if (coldata != null)
                        {
                            bool.TryParse(coldata.express, out v1);
                        }
                        if (dcoldata != null)
                        {
                            bool.TryParse(dcoldata.express, out v2);
                        }
                        issame = (v1 == v2);
                        break;
                    }

                    default:
                    {
                        string v1 = ""; string v2 = "";
                        if (coldata != null)
                        {
                            v1 = coldata.express;
                        }
                        if (dcoldata != null)
                        {
                            v2 = dcoldata.express;
                        }
                        issame = (v1 == v2);
                        break;
                    }
                    }
                    if (!issame)
                    {
                        if (coldata != null)
                        {
                            coldata.ctaStatus = (int)_ctaStatusEnum.csDiff;
                        }
                        if (dcoldata != null)
                        {
                            dcoldata.ctaStatus = (int)_ctaStatusEnum.csDiff;
                        }
                        ret = (int)_ctaStatusEnum.csDiff;
                    }
                }
            }

            return(ret);
        }