Exemplo n.º 1
0
 protected override WorkStationInfo GetingItemByID(string id, ParkDataContext parking)
 {
     return(parking.GetTable <WorkStationInfo>().SingleOrDefault(w => w.StationID == id));
 }
Exemplo n.º 2
0
 protected override SysparameterInfo GetingItemByID(string id, ParkDataContext parking)
 {
     return(parking.Sysparameter.SingleOrDefault(s => s.Parameter == id));
 }
Exemplo n.º 3
0
 protected override ParkInfo GetingItemByID(int id, ParkDataContext parking)
 {
     return(parking.Park.Single(p => p.ParkID == id));
 }
Exemplo n.º 4
0
 protected override CardEventRecord GetingItemByID(RecordID id, ParkDataContext parking)
 {
     return(parking.CardEvent.SingleOrDefault(c => c.CardID == id.CardID && c.EventDateTime == id.RecordDateTime));
 }
Exemplo n.º 5
0
 protected override OperatorSettleLog GetingItemByID(DateTime id, ParkDataContext parking)
 {
     return(parking.OperatorLog.SingleOrDefault(o => o.SettleDateTime == id));
 }
Exemplo n.º 6
0
 protected override WaitingCommandInfo GetingItemByID(WaitingCommandID id, ParkDataContext parking)
 {
     return(parking.GetTable <WaitingCommandInfo>().SingleOrDefault(w => w.EntranceID == id.EntranceID && w.Command == id.Command && w.CardID == id.CardID));
 }
Exemplo n.º 7
0
        protected override void DeletingItem(WaitingCommandInfo info, ParkDataContext parking)
        {
            string cmd = @"delete WaitingCommand where EntranceID=@p0 and  Command=@p1 and CardID=@p2";

            parking.ExecuteCommand(cmd, info.EntranceID, info.Command, info.CardID);
        }
Exemplo n.º 8
0
 protected virtual List <TInfo> GetingAllItems(ParkDataContext parking)
 {
     //如果实体类要加载其关联数据,就重写此方法
     return(parking.GetTable <TInfo>().Select(t => t).ToList());
 }
Exemplo n.º 9
0
 protected virtual List <TInfo> GetingItems(ParkDataContext parking, SearchCondition search)
 {
     //如果要实现这个功能,子类一定要重写这个方法
     throw new NotImplementedException("子类没有重写GetingItems方法");
 }
Exemplo n.º 10
0
 protected override EntranceInfo GetingItemByID(int id, ParkDataContext Parking)
 {
     return(Parking.Entrance.SingleOrDefault(e => e.EntranceID == id));
 }
Exemplo n.º 11
0
 protected virtual TInfo GetingItemByID(TID id, ParkDataContext parking)
 {
     //每一个子类都要重写这个方法
     throw new Exception("子类没有重写GetingItemByID方法!");
 }
Exemplo n.º 12
0
 protected override void DeletingItem(PRERoleInfo info, ParkDataContext parking)
 {
     parking.PRERole.Attach(info);
     parking.PRERole.DeleteOnSubmit(info);
 }
Exemplo n.º 13
0
 protected override PRERoleInfo GetingItemByID(string id, ParkDataContext parking)
 {
     return(parking.PRERole.SingleOrDefault(r => r.RoleID == id));
 }
 protected override ServerSwitchRecord GetingItemByID(int id, ParkDataContext parking)
 {
     return(parking.ServerSwitchRecord.SingleOrDefault(s => s.RecordID == id));
 }
Exemplo n.º 15
0
 protected override PREBusinesses GetingItemByID(string id, ParkDataContext parking)
 {
     return(parking.PREBusinesses.SingleOrDefault(r => r.BusinessesID.ToString() == id));
 }
Exemplo n.º 16
0
 protected virtual void InsertingItem(TInfo info, ParkDataContext parking)
 {
     parking.GetTable <TInfo>().InsertOnSubmit(info);
 }
Exemplo n.º 17
0
 protected override void DeletingItem(PREBusinesses info, ParkDataContext parking)
 {
     parking.PREBusinesses.Attach(info);
     parking.PREBusinesses.DeleteOnSubmit(info);
 }
Exemplo n.º 18
0
 protected virtual void UpdatingItem(TInfo newVal, TInfo original, ParkDataContext parking)
 {
     //所有实体都可以用这个方法来更新数据
     parking.GetTable <TInfo>().Attach(newVal, original);
 }
Exemplo n.º 19
0
 protected override List <WaitingCommandInfo> GetingAllItems(ParkDataContext parking)
 {
     return(parking.GetTable <WaitingCommandInfo>().Select(t => t).OrderBy(t => t.EntranceID).ToList());
 }
Exemplo n.º 20
0
 protected virtual void DeletingItem(TInfo info, ParkDataContext parking)
 {
     //如果删除实体时要删除其关联数据,就得重写这个方法
     parking.GetTable <TInfo>().Attach(info);
     parking.GetTable <TInfo>().DeleteOnSubmit(info);
 }
Exemplo n.º 21
0
 protected override SnapShot GetingItemByID(SnapShotID id, ParkDataContext parking)
 {
     return(parking.SnapShot.SingleOrDefault(s => s.ShotAt == id.ShotAt && s.VideoSourceID == id.VideoSourceID));
 }
Exemplo n.º 22
0
 protected override YCTBlacklist GetingItemByID(string id, ParkDataContext parking)
 {
     return(parking.GetTable <YCTBlacklist>().SingleOrDefault(item => item.LCN == id));
 }
Exemplo n.º 23
0
        protected override List <CardEventRecord> GetingItems(ParkDataContext parking, SearchCondition search)
        {
            List <CardEventRecord>       items  = new List <CardEventRecord>();
            IQueryable <CardEventRecord> result = parking.CardEvent;

            if (search is RecordSearchCondition)
            {
                RecordSearchCondition condition = search as RecordSearchCondition;
                if (condition.RecordDateTimeRange != null)
                {
                    result = result.Where(c => c.EventDateTime >= condition.RecordDateTimeRange.Begin).AsQueryable();
                    result = result.Where(c => c.EventDateTime <= condition.RecordDateTimeRange.End).AsQueryable();
                }
                if (!string.IsNullOrEmpty(condition.CardID))
                {
                    result = result.Where(c => c.CardID == condition.CardID);
                }
                if (condition.Operator != null)
                {
                    result = result.Where(c => c.OperatorID == condition.Operator.OperatorName);
                }
                if (!string.IsNullOrEmpty(condition.StationID))
                {
                    result = result.Where(c => c.StationID == condition.StationID);
                }
                if (!string.IsNullOrEmpty(condition.OwnerName))
                {
                    result = result.Where(c => c.OwnerName.Contains(condition.OwnerName));
                }
                if (!string.IsNullOrEmpty(condition.Department))
                {
                    result = result.Where(c => c.Department == condition.Department);
                }
                if (condition.IsUnSettled != null)
                {
                    if (condition.IsUnSettled.Value)
                    {
                        result = result.Where(c => c.SettleDateTime == null);
                    }
                    else
                    {
                        result = result.Where(c => c.SettleDateTime != null);
                    }
                }
                if (condition.SettleDateTime != null)
                {
                    result = result.Where(c => c.SettleDateTime == condition.SettleDateTime.Value);
                }
                if (condition.CarType != null)
                {
                    result = result.Where(c => c.CarType == condition.CarType);
                }
                if (!string.IsNullOrEmpty(condition.CardCertificate))
                {
                    result = result.Where(c => c.CardCertificate.Contains(condition.CardCertificate));
                }
                if (condition.UpdateFlag != null)
                {
                    result = result.Where(c => c.UpdateFlag == condition.UpdateFlag);
                }
                if (search is CardEventSearchCondition)
                {
                    CardEventSearchCondition s = search as CardEventSearchCondition;
                    if (s.CarType != null)
                    {
                        result = result.Where(item => item.CarType == s.CarType);
                    }
                    if (!string.IsNullOrEmpty(s.CarPlate))
                    {
                        result = result.Where(c => c.CarPlate.Contains(s.CarPlate));
                    }
                    if (s.OnlyExitEvent)
                    {
                        result = result.Where(item => item.IsExitEvent == true);
                    }
                    if (s.OnlyEnterEvent)
                    {
                        result = result.Where(item => item.IsExitEvent == false);
                    }
                }
                items = result.ToList();
                if (condition.CardType != null)
                {
                    items = items.Where(c => c.CardType == condition.CardType).ToList();
                }
                if (search is CardEventSearchCondition)
                {
                    CardEventSearchCondition s = search as CardEventSearchCondition;
                    if (s.Source != null && s.Source.Count > 0)
                    {
                        items = (from c in items join e in s.Source on c.EntranceID equals e.EntranceID select c).ToList();
                    }
                }
            }
            return(items);
        }
Exemplo n.º 24
0
 protected override APMLog GetingItemByID(int id, ParkDataContext parking)
 {
     return(parking.GetTable <APMLog>().SingleOrDefault(item => item.ID == id));
 }
Exemplo n.º 25
0
 protected override YCTPaymentRecord GetingItemByID(int id, ParkDataContext parking)
 {
     return(parking.GetTable <YCTPaymentRecord>().SingleOrDefault(item => item.ID == id));
 }
Exemplo n.º 26
0
 protected override DeptInfo GetingItemByID(string id, ParkDataContext parking)
 {
     return(parking.Dept.SingleOrDefault(r => r.DeptID.ToString() == id));
 }
Exemplo n.º 27
0
 protected override VideoSourceInfo GetingItemByID(int id, ParkDataContext parking)
 {
     return(parking.VideoSource.SingleOrDefault(v => v.VideoID == id));
 }
Exemplo n.º 28
0
 protected override void DeletingItem(DeptInfo info, ParkDataContext parking)
 {
     parking.Dept.Attach(info);
     parking.Dept.DeleteOnSubmit(info);
 }
Exemplo n.º 29
0
 public UnitWork(string connStr)
 {
     _Parking = ParkDataContextFactory.CreateParking(connStr);
 }
Exemplo n.º 30
0
        protected override CardInfo GetingItemByID(string id, ParkDataContext parking)
        {
            CardInfo info = parking.Card.SingleOrDefault(c => c.CardID == id);

            return(info);
        }