Exemple #1
0
        public Resp_Binary Add_One(RecordManagerDTO model)
        {
            var old_model = _repository.GetByWhere(t => t.CarNumber == model.CarNumber && t.Channel == model.Channel && t.IsValid == 1).FirstOrDefault();

            if (old_model.IsNotNull())
            {
                return(Resp_Binary.Add_Repeated);
            }

            var record = model.GetPrototype <RecordManagerDTO, RecordManager>();

            record.IsValid = 1;
            _repository.Insert(record);
            if (_repository.UnitOfWork.Commite() > 0)
            {
                return(Resp_Binary.Add_Sucess);
            }
            return(Resp_Binary.Add_Failed);
        }
Exemple #2
0
        public Resp_Binary Modify(RecordManagerDTO model)
        {
            var entity = _repository.GetById(model.ID.ToInt());

            if (entity.IsNull())
            {
                return new Resp_Binary {
                           message = "未找到对应操作记录,请重新查询数据"
                }
            }
            ;

            DateTime?dt = null;

            entity.CarType      = model.CarType;
            entity.CarColor     = model.CarColor;
            entity.Type         = (int)Enum.Parse(typeof(RecordManagerTypeEnum), model.Type);
            entity.TLicense     = model.TLicense;
            entity.DLicense     = model.DLicense;
            entity.Driver       = model.Driver;
            entity.Channel      = model.Channel;
            entity.Creater      = model.Creater ?? "";
            entity.Contact      = model.Contact;
            entity.Organization = model.Organization;
            entity.SysUserId    = model.SysUserId.ToInt();
            entity.CreateTime   = DateTime.Now;
            entity.ValideTime   = string.IsNullOrEmpty(model.ValideTime) ? dt : model.ValideTime.ToDateTime();
            entity.RecordMGrade = model.RecordMGrade;

            _repository.Update(entity);
            if (_repository.UnitOfWork.Commite() > 0)
            {
                return(Resp_Binary.Modify_Sucess);
            }
            return(Resp_Binary.Modify_Failed);
        }