Exemplo n.º 1
0
        public RequestPagingResult <DriverInfoModel> GetDrivers(PagingSearchCondition <DriverSearch> condition)
        {
            RequestPagingResult <DriverInfoModel> rsts = new RequestPagingResult <DriverInfoModel>();

            try
            {
                using (ydvsEntities entities = new ydvsEntities())
                {
                    bool isCondition = condition == null || string.IsNullOrWhiteSpace(condition.SearchCondition.Card);
                    var  temp        = entities.base_driver_info.Where(d => true);
                    rsts.TotalCount = temp.Count();
                    if (!isCondition)
                    {
                        temp = temp.Where(d => isCondition || d.card.Contains(condition.SearchCondition.Card));
                    }
                    rsts.ResultDatas = temp.Select(d => new DriverInfoModel
                    {
                        Id              = d.id,
                        Order           = d.order,
                        Card            = d.card,
                        Name            = d.name,
                        LocomotiveDepot = d.locomotive_depot,
                        Team            = d.team
                    }).OrderBy(d => d.Order).ToList();
                }
                return(rsts);
            }
            catch (Exception ex)
            {
                CommonLibrary.LogHelper.Log4Helper.Error(this.GetType(), "查找机车信息", ex);
                return(rsts);
            }
        }
Exemplo n.º 2
0
 public bool DelTrainProprietorshipsByIds(List <int> ids, User user = null)
 {
     try
     {
         using (ydvsEntities entities = new ydvsEntities())
         {
         }
         return(true);
     }
     catch (Exception ex)
     {
         CommonLibrary.LogHelper.Log4Helper.Error(this.GetType(), "删除机车配属段信息", ex);
         return(false);
     }
 }
Exemplo n.º 3
0
 public bool AddTrainProprietorships(List <TrainProprietorshipModel> addDrivers, User user = null)
 {
     try
     {
         using (ydvsEntities entities = new ydvsEntities())
         {
         }
         return(true);
     }
     catch (Exception ex)
     {
         CommonLibrary.LogHelper.Log4Helper.Error(this.GetType(), "添加机车配属段信息", ex);
         return(false);
     }
 }
Exemplo n.º 4
0
 public bool DelDrivers(List <DriverInfoModel> addDrivers, User user = null)
 {
     try
     {
         using (ydvsEntities entities = new ydvsEntities())
         {
         }
         return(true);
     }
     catch (Exception ex)
     {
         CommonLibrary.LogHelper.Log4Helper.Error(this.GetType(), "删除司机信息", ex);
         return(false);
     }
 }
Exemplo n.º 5
0
        public RequestPagingResult <TrainProprietorshipModel> GetTrainProprietorships(PagingSearchCondition <TrainProprietorshipSearch> condition)
        {
            RequestPagingResult <TrainProprietorshipModel> rsts = new RequestPagingResult <TrainProprietorshipModel>();

            try
            {
                rsts.Flag = true;
                using (ydvsEntities entities = new ydvsEntities())
                {
                    bool isCondition = condition == null || string.IsNullOrWhiteSpace(condition.SearchCondition.TrainShortName);
                    var  temp        = entities.base_train_proprietorship.Where(d => true);
                    if (!isCondition)
                    {
                        temp = temp.Where(d => isCondition || d.train_type.Contains(condition.SearchCondition.TrainShortName) || d.train_no.Contains(condition.SearchCondition.TrainShortName));
                    }
                    rsts.TotalCount = temp.Count();
                    int startIndex = condition.StartIndex <= 0 ? 0 : (condition.StartIndex - 1);
                    int pageSize   = condition.PageSize <= 0 ? rsts.TotalCount : condition.PageSize;
                    var temp2      = temp.Select(d => new TrainProprietorshipModel
                    {
                        Id              = d.id,
                        Order           = d.order,
                        TrainType       = d.train_type,
                        TrainNo         = d.train_no,
                        LocomotiveDepot = d.locomotive_depot,
                        WorkShop        = d.work_shop
                    }).OrderBy(d => d.Order).Skip(startIndex * condition.PageSize);
                    rsts.ResultDatas = pageSize == 0 ? temp2.ToList() : temp2.Take(pageSize).ToList();
                }
                rsts.Msg = "";
                return(rsts);
            }
            catch (Exception ex)
            {
                CommonLibrary.LogHelper.Log4Helper.Error(this.GetType(), "查找机车配属段信息", ex);
                rsts.Flag = false;
                rsts.Msg  = ex.ToString();
                return(rsts);
            }
        }