コード例 #1
0
        public void GetJob()
        {
            try
                {
                    if (_view.JobId.HasValue)
                    {
                        CS_CustomerInfo customerInfo = null;

                        using (_model = new JobModel())
                        {
                            _view.Job = _model.GetJobById(_view.JobId.Value);
                        }

                        using (_model = new JobModel())
                        {
                            _view.SpecialPricingEntity = _model.GetSpecialPricing(_view.JobId.Value);
                            _view.PresetInfoEntity = _model.GetPresetInfo(_view.JobId.Value);
                            _view.LostJobEntity = _model.GetLostJob(_view.JobId.Value);
                            _view.JobDivisionEntityList = _model.ListJobDivision(_view.JobId.Value);
                            _view.JobDescriptionEntity = _model.GetJobDescriptionByJobId(_view.JobId.Value);

                            if (null != _view.Job.CS_JobInfo && !string.IsNullOrEmpty(_view.Job.CS_JobInfo.CustomerSpecificInfo))
                                _view.CustomerSpecificFields = CustomerSpecificInfo.DeserializeObject(_view.Job.CS_JobInfo.CustomerSpecificInfo);

                            customerInfo = _model.GetCustomerInfoByJobId(_view.JobId.Value);
                        }

                        using (_customerModel = new CustomerModel())
                        {
                            if (null != customerInfo)
                                _view.CustomerContract = _customerModel.ListAllCustomerContracts(customerInfo.CustomerId);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logger.Write(string.Format("An error has occurred while trying to load Job Info section!\n{0}\n{1}", ex.Message, ex.StackTrace));
                    _view.DisplayMessage("An error has occurred while trying to load Job Info Section.", false);
                }
        }