Пример #1
0
        public ResponseBase RegisterInstallInfo(RequestBase request)
        {
            RegisterInstallInfoRequset registerRequest = (RegisterInstallInfoRequset)request;

            return(Service <RegisterInstallInfoResponse>(() => {
                RegisterInstallInfoResponse response = new RegisterInstallInfoResponse();
                if (registerRequest == null)
                {
                    throw new Exception("null input!");
                }
                using (IUnitOfWork unitOfwork = RepositoryFactory.GetUnitOfWork())
                {
                    IInstallInfoRepository installRepository = (IInstallInfoRepository)RepositoryFactory
                                                               .Get(typeof(IInstallInfoRepository), unitOfwork);
                    InstallInfo register = new InstallInfo()
                    {
                        CNumber = registerRequest.CNumber,
                        InstallMethod = registerRequest.InstallMethod,
                        MaintancePeriod = registerRequest.MaintancePeriod,
                        Principal = registerRequest.Principal,
                        ProductId = registerRequest.ProductId,
                        Site = registerRequest.Site,
                        StartTime = registerRequest.StartTime
                    };
                    register.Register();
                    installRepository.Add(register);
                    unitOfwork.Commit();
                    response.IsSucess = true;
                    response.InstallInfo = register.Map <InstallInfoView, InstallInfo>();
                }
                return response;
            }));
        }
Пример #2
0
        public string RegisterInstallInfo(string principal, string cNumber, string installMethod, string maintancePeriod, string productId, string site, string startTime)
        {
            RegisterInstallInfoResponse response = (RegisterInstallInfoResponse)_productInfoService
                                                   .RegisterInstallInfo(new RegisterInstallInfoRequset()
            {
                CNumber         = cNumber,
                InstallMethod   = installMethod,
                MaintancePeriod = maintancePeriod,
                Principal       = principal,
                ProductId       = productId,
                Site            = site,
                StartTime       = Convert.ToDateTime(startTime)
            });

            if (response == null)
            {
                return(JsonHelper.SerializeObject("false:null return!"));
            }
            if (response.IsSucess == false)
            {
                return(JsonHelper.SerializeObject("false:" + response.Message));
            }
            if (response.InstallInfo == null)
            {
                return(JsonHelper.SerializeObject("false:null installinfo return!"));
            }
            return(JsonHelper.SerializeObject(response.InstallInfo));
        }