Пример #1
0
        public CheckUpResult Convert(Data.Entity.CheckUp param)
        {
            CheckUpResult result = new CheckUpResult()
            {
                Code        = param.Code,
                Id          = param.Id,
                Description = param.Description,
                Name        = param.Name,

                CheckUpEnd        = param.CheckUpEnd,
                CheckUpStart      = param.CheckUpStart,
                CustomerId        = param.Customer.Id,
                CustomerName      = param.Customer.Name,
                EmployeeId        = param.Employee.Id,
                EmployeeName      = param.Employee.Name,
                IssueList         = param.IssueList,
                PartList          = param.PartList,
                Price             = param.Price,
                VehicleId         = param.Vehicle.Id,
                VehicleName       = param.Vehicle.Name,
                CheckUpStatusId   = param.CheckUpStatus.Id,
                CheckUpStatusName = param.CheckUpStatus.Name
            };

            return(result);
        }
        public Data.Entity.CheckUp Convert(CheckUpParam param, Data.Entity.CheckUp oldentity)
        {
            Data.Entity.CheckUp entity = null;

            if (oldentity != null)
            {
                entity = oldentity;
            }
            else
            {
                entity = new Data.Entity.CheckUp
                {
                    Code        = param.Code,
                    Id          = param.Id,
                    Description = param.Description,
                    Name        = param.Name
                };
            }

            entity.CheckUpEnd    = param.CheckUpEnd;
            entity.CheckUpStart  = param.CheckUpStart;
            entity.CheckUpStatus = CheckUpStatusDao.Find(param.CheckUpStatusId);
            entity.Customer      = CustomerDao.Find(param.CustomerId);
            entity.Employee      = EmployeeDao.Find(param.EmployeeId);
            entity.IssueList     = param.IssueList;
            entity.PartList      = param.PartList;
            entity.Price         = param.Price;
            entity.Vehicle       = VehicleDao.Find(param.VehicleId);

            return(entity);
        }
Пример #3
0
        public CheckUpResult Find(long id)
        {
            Data.Entity.CheckUp entity = CheckUpDao.Find(id);
            CheckUpResult       result = CheckUpResultConverter.Convert(entity);

            return(result);
        }
Пример #4
0
        public Data.Entity.CheckUp Save(Data.Entity.CheckUp entity)
        {
            CheckUpStorage.CheckUpList.Add(entity);
            CheckUpStorage.CheckUpDictionary.Add(entity.Id, entity);

            return(entity);
        }
Пример #5
0
        public CheckUpResult Create(CheckUpParam param)
        {
            Data.Entity.CheckUp entity = CheckUpParamConverter.Convert(param, null);
            CheckUpDao.Save(entity);

            return(CheckUpResultConverter.Convert(entity));
        }
Пример #6
0
        static CheckUpStorage()
        {
            Data.Entity.CheckUp CheckUp1 = new Data.Entity.CheckUp
            {
            };

            Data.Entity.CheckUp CheckUp2 = new Data.Entity.CheckUp
            {
            };

            Data.Entity.CheckUp CheckUp3 = new Data.Entity.CheckUp
            {
            };
            Data.Entity.CheckUp CheckUp4 = new Data.Entity.CheckUp
            {
            };
            Data.Entity.CheckUp CheckUp5 = new Data.Entity.CheckUp
            {
            };
            Data.Entity.CheckUp CheckUp6 = new Data.Entity.CheckUp
            {
            };
            Data.Entity.CheckUp CheckUp7 = new Data.Entity.CheckUp
            {
            };
            Data.Entity.CheckUp CheckUp8 = new Data.Entity.CheckUp
            {
            };
            Data.Entity.CheckUp CheckUp9 = new Data.Entity.CheckUp
            {
            };
            Data.Entity.CheckUp CheckUp10 = new Data.Entity.CheckUp
            {
            };

            CheckUpList.Add(CheckUp1);
            CheckUpList.Add(CheckUp2);
            CheckUpList.Add(CheckUp3);
            CheckUpList.Add(CheckUp4);
            CheckUpList.Add(CheckUp5);
            CheckUpList.Add(CheckUp6);
            CheckUpList.Add(CheckUp7);
            CheckUpList.Add(CheckUp8);
            CheckUpList.Add(CheckUp9);
            CheckUpList.Add(CheckUp10);

            CheckUpDictionary.Add(CheckUp1.Id, CheckUp1);
            CheckUpDictionary.Add(CheckUp2.Id, CheckUp2);
            CheckUpDictionary.Add(CheckUp3.Id, CheckUp3);
            CheckUpDictionary.Add(CheckUp4.Id, CheckUp4);
            CheckUpDictionary.Add(CheckUp5.Id, CheckUp5);
            CheckUpDictionary.Add(CheckUp6.Id, CheckUp6);
            CheckUpDictionary.Add(CheckUp7.Id, CheckUp7);
            CheckUpDictionary.Add(CheckUp8.Id, CheckUp8);
            CheckUpDictionary.Add(CheckUp9.Id, CheckUp9);
            CheckUpDictionary.Add(CheckUp10.Id, CheckUp10);
        }
Пример #7
0
        public void Update(List <CheckUpParam> param)
        {
            List <Data.Entity.CheckUp> entity = new List <Data.Entity.CheckUp>();

            foreach (var item in param)
            {
                Data.Entity.CheckUp oldEntity = CheckUpDao.Find(item.Id);
                Data.Entity.CheckUp newEntity = CheckUpParamConverter.Convert(item, null);
                CheckUpDao.Update(newEntity);
            }
        }
Пример #8
0
 public Data.Entity.CheckUp Update(Data.Entity.CheckUp entity)
 {
     Delete(entity.Id);
     Save(entity);
     return(entity);
 }
Пример #9
0
 public void Delete(Data.Entity.CheckUp entity)
 {
     CheckUpStorage.CheckUpList.Remove(entity);
     CheckUpStorage.CheckUpDictionary.Remove(entity.Id);
 }
Пример #10
0
 public void Delete(long id)
 {
     Data.Entity.CheckUp entity = Find(id);
     Delete(entity);
 }
Пример #11
0
 public void Update(long id, CheckUpParam param)
 {
     Data.Entity.CheckUp oldEntity = CheckUpDao.Find(id);
     Data.Entity.CheckUp newEntity = CheckUpParamConverter.Convert(param, null);
     CheckUpDao.Update(newEntity);
 }