Example #1
0
        public int AddOrUpdateTrainInfo(TrainInfo traininfo, string keyValue)
        {
            int result = 0;

            if (string.IsNullOrEmpty(keyValue))
            {
                TrainInfo model = new TrainInfo();
                model.Create();
                model.TrainTitle  = traininfo.TrainTitle;
                model.Address     = traininfo.Address;
                model.ApplyETime  = traininfo.ApplyETime;
                model.ApplySTime  = traininfo.ApplySTime;
                model.StartTime   = traininfo.StartTime;
                model.EndTime     = traininfo.EndTime;
                model.Content     = traininfo.Content;
                model.PartNumber  = 0;
                model.LimitNumber = traininfo.LimitNumber;
                model.PhotoID     = traininfo.PhotoID;
                model.PublishTime = traininfo.PublishTime;
                model.UserID      = traininfo.UserID;
                model.Host        = traininfo.Host;
                model.DeleteMark  = false;
                model.StatusCode  = GetStatuCode(traininfo.StartTime, traininfo.EndTime, traininfo.ApplySTime, traininfo.ApplyETime);
                result            = service.Insert(model);
            }
            else
            {
                var train = service.FindEntity(keyValue);
                train.TrainTitle  = traininfo.TrainTitle;
                train.ApplyETime  = traininfo.ApplyETime;
                train.ApplySTime  = traininfo.ApplySTime;
                train.StartTime   = traininfo.StartTime;
                train.EndTime     = traininfo.EndTime;
                train.Content     = traininfo.Content;
                train.PartNumber  = traininfo.PartNumber;
                train.LimitNumber = traininfo.LimitNumber;
                train.PhotoID     = traininfo.PhotoID;
                train.PublishTime = traininfo.PublishTime;
                train.UserID      = traininfo.UserID;
                train.Host        = traininfo.Host;
                train.Address     = traininfo.Address;
                train.StatusCode  = GetStatuCode(traininfo.StartTime, traininfo.EndTime, traininfo.ApplySTime, traininfo.ApplyETime);
                result            = service.Update(train);
            }
            return(result);
        }
Example #2
0
        public TrainInfo GetTrainDetail(string trainID)
        {
            TrainInfo traininfo = trainInfoDal.FindEntity(trainID);

            if (traininfo != null)
            {
                traininfo.PhotoID = adminurl + traininfo.PhotoID;
            }
            return(traininfo);
        }