コード例 #1
0
        public EstimationModel GetEstimationByEstimationNo(BaseViewModel model, string EstimationID)
        {
            EstimationModel estimationModel = new EstimationModel();
            Estimation      estimation;

            try
            {
                Guid Id = new Guid(EstimationID);
                estimation      = _orderDetailsRepository.GetEstimationByEstimationID(Id);
                estimationModel = Mapper.Map <Estimation, EstimationModel>(estimation);
                estimationModel.CurrentUserID     = model.CurrentUserID;
                estimationModel.CurrentCulture    = model.CurrentCulture;
                estimationModel.EstimateRouteName = Utility.GetPropertyValue(estimation.Master_EstimationRoutes, "Name", model.CurrentCulture) == null ? string.Empty :
                                                    Utility.GetPropertyValue(estimation.Master_EstimationRoutes, "Name", model.CurrentCulture).ToString();
                estimationModel.ClientName = Utility.GetPropertyValue(estimation.Company, "Name", model.CurrentCulture) == null ? string.Empty :
                                             Utility.GetPropertyValue(estimation.Company, "Name", model.CurrentCulture).ToString();
                estimationModel.OutwardSalesName = Utility.GetPropertyValue(estimation.Employee, "Name", model.CurrentCulture) == null ? string.Empty :
                                                   Utility.GetPropertyValue(estimation.Employee, "Name", model.CurrentCulture).ToString();
                estimationModel.CoordinatorName = Utility.GetPropertyValue(estimation.Employee, "Name", model.CurrentCulture) == null ? string.Empty :
                                                  Utility.GetPropertyValue(estimation.Employee, "Name", model.CurrentCulture).ToString();
                estimationModel.SalesPersonName = Utility.GetPropertyValue(estimation.Employee, "Name", model.CurrentCulture) == null ? string.Empty :
                                                  Utility.GetPropertyValue(estimation.Employee, "Name", model.CurrentCulture).ToString();
                estimationModel.LargeSalesName = Utility.GetPropertyValue(estimation.Employee, "Name", model.CurrentCulture) == null ? string.Empty :
                                                 Utility.GetPropertyValue(estimation.Employee, "Name", model.CurrentCulture).ToString();
                estimationModel.TotalWithTax = estimation.TotalWithTax;
                //estimationModel.BusinessCategoryName = Utility.GetPropertyValue(estimation.master, "Name", model.CurrentCulture) == null ? string.Empty :
                //                               Utility.GetPropertyValue(estimation.Employee, "Name", model.CurrentCulture).ToString();
            }
            catch (Exception ex)
            {
                IErrorLogService errorLog = new ErrorLogService();
                string           message  = ex.InnerException != null ? ex.InnerException.InnerException.Message : ex.Message;
                errorLog.SetErrorLog(model.CurrentUserID, "OrderDetails", message);
                throw new Exception(message);
            }
            finally
            {
                _sqlConnService.CloseConnection();
            }
            return(estimationModel);
        }