private void GenerterCarheaderlVData()
        {
            if (mCarHeaderVs == null)
            {
                mCarHeaderVs = new List <CarHeaderV>();
            }
            if (carNeedRefresh == false)
            {
                return;
            }
            else
            {
                mCarHeaderVs.Clear();
            }
            List <CarHeader> cates = new List <CarHeader>();
            String           sql   = DatabaseOPtionHelper.GetInstance().getSelectSql(DataTabeName.car_header.ToString(), null, null, null, null, CarHeaderEnum.content.ToString() + " asc ");

            cates = DatabaseOPtionHelper.GetInstance().select <CarHeader>(sql);
            if (cates.Count > 0)
            {
                if (cates == null || cates.Count <= 0)
                {
                    FillMaterialAlretData();
                    return;
                }
                CarHeader ch        = null;
                String    condition = string.Empty;
                String    carsql    = string.Empty;
                for (int i = 0; i < cates.Count; i++)
                {
                    ch        = cates[i];
                    condition = CarInfoEnum.car_number + " like " + Constract.valueSplit + ch.content + "%" + Constract.valueSplit;
                    sql       = DatabaseOPtionHelper.GetInstance().getSelectSql(DataTabeName.car_info.ToString(), null, condition);
                    List <CarInfo> mlist = DatabaseOPtionHelper.GetInstance().select <CarInfo>(sql);
                    if (mlist.Count > 0)
                    {
                        CarHeaderV v = new CarHeaderV()
                        {
                            head     = ch,
                            carInfos = mlist
                        };
                        mCarHeaderVs.Add(v);
                    }
                }
            }
        }
Пример #2
0
        private void AddCarHeader()
        {
            String           header    = mCarInfo.carNumber.Substring(0, 2);
            String           condition = CarHeaderEnum.content.ToString() + "=" + Constract.valueSplit + header + Constract.valueSplit;
            String           sql       = DatabaseOPtionHelper.GetInstance().getSelectSqlNoSoftDeleteCondition(DataTabeName.car_header.ToString(), CarHeaderEnum.content.ToString(), condition);
            List <CarHeader> list      = DatabaseOPtionHelper.GetInstance().select <CarHeader>(sql);

            if (list.Count <= 0)
            {
                CarHeader carHeader = new CarHeader()
                {
                    id       = Guid.NewGuid().ToString(),
                    content  = header,
                    syncTime = DateTimeHelper.GetTimeStamp()
                };
                DatabaseOPtionHelper.GetInstance().insert(carHeader);
            }
        }