public CustomersPresenter(ICustomersView view, CustomerDao dao) { m_view = view; m_customerDao = dao; Update(); }
public CustomerService( ICustomerDao customerDao) { _customerDao = customerDao ?? throw new System.ArgumentNullException(nameof(customerDao)); }
/// <summary> /// Checks if a customer already exists with the same customer ID. /// </summary> private bool IsDuplicateOfExisting(Customer newCustomer, ICustomerDao customerDao) { // Whenever possible, I *really* don't like using assigned IDs. I think they // should only be used when working with a legacy database. Among other ugliness, // assigned IDs force us to try/catch when checking for duplicates because NHibernate // will throw an ObjectNotFoundException if no entity with the provided ID is found. // Consequently, we also have to have a reference to the NHibernate assembly from within // our business object. // To overcome these drawbacks, I'd recommend adding a DoesEntityExist(string assignedId) // method to the DAO to check for the existence of entities by its assigned ID. This would remove the // ugly try/catch from this method and it would also remove the local dependency on the NHibernate // assembly. I've chosen not to go ahead and do this because my assumption is that // the use of assigned IDs will be the exception rather than the norm...so I want to keep // the generic DAO as clean as possible for the example demo. try { Customer duplicateCustomer = customerDao.GetById(newCustomer.ID, false); return(duplicateCustomer != null); } // Only catch ObjectNotFoundException, throw everything else. catch (NHibernate.ObjectNotFoundException) { // Since the duplicate we were looking for wasn't found, then, through difficult // logical deduction, this object isn't a duplicat return(false); } }
public CustomerApi(ICustomerDao customerDao) : base("customers") { Get["/{customerId}"] = o => GetCustomerById((int)o.customerId); this.customerDao = customerDao; }
/// <summary> /// Checks if a customer already exists with the same customer ID. /// </summary> private bool IsDuplicateOfExisting(Customer newCustomer, ICustomerDao customerDao) { // Whenever possible, I *really* don't like using assigned IDs. I think they // should only be used when working with a legacy database. Among other ugliness, // assigned IDs force us to try/catch when checking for duplicates because NHibernate // will throw an ObjectNotFoundException if no entity with the provided ID is found. // Consequently, we also have to have a reference to the NHibernate assembly from within // our business object. // To overcome these drawbacks, I'd recommend adding a DoesEntityExist(string assignedId) // method to the DAO to check for the existence of entities by its assigned ID. This would remove the // ugly try/catch from this method and it would also remove the local dependency on the NHibernate // assembly. I've chosen not to go ahead and do this because my assumption is that // the use of assigned IDs will be the exception rather than the norm...so I want to keep // the generic DAO as clean as possible for the example demo. try { Customer duplicateCustomer = customerDao.GetById(newCustomer.ID, false); return duplicateCustomer != null; } // Only catch ObjectNotFoundException, throw everything else. catch (NHibernate.ObjectNotFoundException) { // Since the duplicate we were looking for wasn't found, then, through difficult // logical deduction, this object isn't a duplicat return false; } }
public ReportViewPresenter(IReportView p_view) { this.m_view = p_view; m_customerDao = new CustomerDao(); m_laundryReportDao = new LaundryReportDao(); m_refillReportDao = new RefillReportDao(); }
protected void btnAdd_OnClick(object sender, EventArgs e) { if (txtCustomerID.Text.Trim().Length == 5) { Customer newCustomer = new Customer(txtCompanyName.Text); newCustomer.SetAssignedIdTo(txtCustomerID.Text); newCustomer.ContactName = txtContactName.Text; IDaoFactory daoFactory = new NHibernateDaoFactory(); ICustomerDao customerDao = daoFactory.GetCustomerDao(); if (!IsDuplicateOfExisting(newCustomer, customerDao)) { customerDao.Save(newCustomer); Response.Redirect("ListCustomers.aspx?action=added"); } else { lblMessage.Text = "<span style=\"color:red\">The ID you provided is already in use.</span><br />Please change the ID and try again."; } } else { lblMessage.Text = "<span style=\"color:red\">The ID you provide must be exactly 5 characters long.</span><br />Please change the ID and try again."; } }
public HotelReservationService(ISession session) { _session = session; _roomRegisterDao = new RoomRegisterDao() { Session = session }; _roomTypeDao = new RoomTypeDao() { Session = session }; _roomDao = new RoomDao() { Session = session }; _roomHistoryDao = new RoomHistoryDao() { Session = session }; _customerDao = new CustomerDao() { Session = session }; _bookingDao = new BookingDao() { Session = session }; }
public SalesController(ISalesDao salesDao, ICustomerDao customerDao, IProductDao productDao, IStoreDao storeDao) { this._salesDao = salesDao; this._customerDao = customerDao; this._productDao = productDao; this._storeDao = storeDao; }
public CustomerLogic(ICustomerDao iCustomerDao, ILoggerDao iLoggerDao) { NullCheck(iCustomerDao); NullCheck(iLoggerDao); customerDao = iCustomerDao; loggerDao = iLoggerDao; }
private void DisplayAllCustomers() { IDaoFactory daoFactory = new NHibernateDaoFactory(); ICustomerDao customerDao = daoFactory.GetCustomerDao(); grdEmployees.DataSource = customerDao.GetAll(); grdEmployees.DataBind(); }
public CustomerController(ICustomerDao customerDao, ILogger <CustomerController> logger, IPropertyMappingService propertyMappingService, IPropertyCheckerService propertyCheckerService, IMapper mapper) { this._logger = logger ?? throw new ArgumentNullException(nameof(logger)); this._customerDao = customerDao ?? throw new ArgumentNullException(nameof(customerDao)); this._propertyMappingService = propertyMappingService ?? throw new ArgumentNullException(nameof(propertyMappingService)); this._propertyCheckerService = propertyCheckerService ?? throw new ArgumentNullException(nameof(propertyCheckerService)); this._mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); }
public void TestGetById() { IDaoFactory daoFactory = new NHibernateDaoFactory(); ICustomerDao customerDao = daoFactory.GetCustomerDao(); Customer foundCustomer = customerDao.GetById(TestGlobals.TestCustomer.ID, false); Assert.AreEqual(TestGlobals.TestCustomer.CompanyName, foundCustomer.CompanyName); }
public SelectionController(ICustomerDao customerDao, IEventDao eventDao, IInvitationDao invitationDao, IOccassionDao occassionDao, IGiftDao giftDao, ILog logger) { this.customerDao = customerDao; this.eventDao = eventDao; this.occassionDao = occassionDao; this.invitationDao = invitationDao; this.giftDao = giftDao; this.logger = logger; }
public void CanGetByExample() { IDaoFactory daoFactory = new NHibernateDaoFactory(); ICustomerDao customerDao = daoFactory.GetCustomerDao(); Customer exampleCustomer = new Customer(TestGlobals.TestCustomer.CompanyName); Customer foundCustomer = customerDao.GetUniqueByExample(exampleCustomer); Assert.AreEqual(TestGlobals.TestCustomer.CompanyName, foundCustomer.CompanyName); }
private void DisplayCustomerToEdit() { IDaoFactory daoFactory = new NHibernateDaoFactory(); ICustomerDao customerDao = daoFactory.GetCustomerDao(); // No need to lock the customer since we're just viewing the data Customer customerToEdit = customerDao.GetById(Request.QueryString["customerID"], false); ShowCustomerDetails(customerToEdit); ShowPastOrders(customerToEdit); ShowProductsOrdered(customerToEdit); }
private void UpdateCustomer() { IDaoFactory daoFactory = new NHibernateDaoFactory(); ICustomerDao customerDao = daoFactory.GetCustomerDao(); // Now that we're about to update the customer, be sure to lock the entity Customer customerToUpdate = customerDao.GetById(hidCustomerID.Value, true); // Changes to the customer object will be automatically committed at the end of the HTTP request customerToUpdate.CompanyName = txtCompanyName.Text; customerToUpdate.ContactName = txtContactName.Text; }
public AddCustomerPresenter(IAddCustomerView p_view, ICustomerDao p_customerDao) { m_view = p_view; m_customerDao = p_customerDao; CustomerDataEntity customerDataEntity = p_customerDao.CreateCustomerDataEntity(); CustomerViewModel customerViewModel = new CustomerViewModel(customerDataEntity); m_viewModel = customerViewModel; m_view.ShowCustomer(customerViewModel); }
public RefillingReturnPaymentPresenter(IRefillReturnPaymentView m_view) { this.m_view = m_view; m_customerDao = new CustomerDao(); m_refillDao = new RefillDao(); m_refillReportDao = new RefillReportDao(); m_custInvDao = new RefillCustomerInventoryDao(); m_daysummaryDao = new RefillDaySummaryDao(); m_invDao = new RefillInventoryDao(); customer = new CustomerDataEntity(); custInv = new RefillCustInventoryHeaderDataEntity(); }
public void CanGetOrdersShippedTo() { IDaoFactory daoFactory = new NHibernateDaoFactory(); ICustomerDao customerDao = daoFactory.GetCustomerDao(); IOrderDao orderDao = daoFactory.GetOrderDao(); Customer customer = customerDao.GetById(TestGlobals.TestCustomer.ID, false); // Give the customer its DAO dependency via a public setter IList <Order> ordersMatchingDate = orderDao.GetOrdersOrderedOn(customer, new DateTime(1998, 3, 10)); Assert.AreEqual(1, ordersMatchingDate.Count); Assert.AreEqual(10937, ordersMatchingDate[0].ID); }
public RefillingViewPresenter(IRefillingView p_view, IRefillDao p_refillDao) { this.m_view = p_view; this.m_refillDao = p_refillDao; this.m_transTypeDao = new RefillTransactionTypeDao(); this.m_customerDao = new CustomerDao(); this.m_productDao = new RefillProductTypeDao(); m_summaryDao = new RefillDaySummaryDao(); m_customerInvDao = new RefillCustomerInventoryDao(); m_refillInvDao = new RefillInventoryDao(); m_refillInvDetailDao = new RefillInventoryDetailDao(); m_printerDao = new PrinterDao(); m_companyDao = new CompanyDao(); }
public CustomerService() { #region Define the Base Map _getDaoManager = ServiceConfig.GetInstance().DaoManager; if (_getDaoManager != null) _getbaseService = _getDaoManager.GetDao(typeof(CustomerMapDao)) as ICustomerDao; #endregion #region Use SqlMaper Style to Soleuv this Connection Problem f**k =--- DomSqlMapBuilder getbuilder = new DomSqlMapBuilder(); if (getbuilder != null) _getsqlmaper = getbuilder.Configure() as SqlMapper; #endregion }
public LaundryViewPresenter(ILaundryView p_view, ILaundryDao p_laundryDao) { this.m_view = p_view; m_laundryDao = p_laundryDao; m_categoryDao = new LaundryCategoryDao(); m_serviceDao = new LaundryServiceDao(); m_customerDao = new CustomerDao(); m_chargeDao = new LaundryChargeDao(); m_summaryDao = new LaundryDaySummaryDao(); m_priceDao = new LaundryPriceSchemeDao(); m_jobChargeDao = new LaundryJobChargesDao(); m_jobChecklistDao = new LaundryJobCheckListDao(); m_paymentDetailDao = new LaundryPaymentDetailDao(); m_checklistDao = new LaundryChecklistDao(); m_detailDao = new LaundryDetailDao(); m_printerDao = new PrinterDao(); m_companyDao = new CompanyDao(); }
public CustomerService() { #region Define the Base Map _getDaoManager = ServiceConfig.GetInstance().DaoManager; if (_getDaoManager != null) { _getbaseService = _getDaoManager.GetDao(typeof(CustomerMapDao)) as ICustomerDao; } #endregion #region Use SqlMaper Style to Soleuv this Connection Problem f**k =--- DomSqlMapBuilder getbuilder = new DomSqlMapBuilder(); if (getbuilder != null) { _getsqlmaper = getbuilder.Configure() as SqlMapper; } #endregion }
public CustomerMgr(ICustomerDao entityDao, IAddressMgr addressMgr, IWorkCenterMgr workCenterMgr, ICriteriaMgr criteriaMgr, IPermissionMgr permissionMgr, IPermissionCategoryMgr permissionCategoryMgr, IUserPermissionMgr userPermissionMgr, IUserMgr userMgr, IPartyDao partyDao, ISqlHelperDao sqlHelperDao) : base(entityDao) { this.addressMgr = addressMgr; this.workCenterMgr = workCenterMgr; this.criteriaMgr = criteriaMgr; this.permissionMgr = permissionMgr; this.permissionCategoryMgr = permissionCategoryMgr; this.userPermissionMgr = userPermissionMgr; this.userMgr = userMgr; this.partyDao = partyDao; this.sqlHelperDao = sqlHelperDao; }
public CustomerReportDataAccessObject() { _customerDao = new CustomerDao(); var report1 = new Report { Id = 1, CustomerId = 1, ReportData = "Some old report1 data", CreatedUtc = DateTime.UtcNow }; var report2 = new Report { Id = 2, CustomerId = 2, ReportData = "Some old report2 data", CreatedUtc = DateTime.UtcNow }; _reportList = new List <Report> { report1, report2 }; }
public MyNewService1(ICustomerDao cusomerDao, ICusomerReportDao cusomerReportDao) { _cusomerDao = cusomerDao; _cusomerReportDao = cusomerReportDao; }
public EditCustomerModel() { customerDao = DaoFactory.GetCustomerDao(); }
static Dependencies() { var roleDaoSet = ConfigurationManager.AppSettings["roleDaoSet"]; switch (roleDaoSet) { case "1": roleDao = new RoleDaoDb(); break; default: throw new ConfigurationErrorsException($"Can't find settings for {nameof(roleDaoSet)}!"); } var userDaoSet = ConfigurationManager.AppSettings["userDaoSet"]; switch (userDaoSet) { case "1": userDao = new UserDaoDb(); break; default: throw new ConfigurationErrorsException($"Can't find settings for {nameof(userDaoSet)}!"); } var customerDaoSet = ConfigurationManager.AppSettings["customerDaoSet"]; switch (customerDaoSet) { case "1": productDao = new ProductDaoDb(); break; default: throw new ConfigurationErrorsException($"Can't find settings for {nameof(customerDaoSet)}!"); } var productDaoSet = ConfigurationManager.AppSettings["productDaoSet"]; switch (productDaoSet) { case "1": customerDao = new CustomerDaoDb(); break; default: throw new ConfigurationErrorsException($"Can't find settings for {nameof(productDaoSet)}!"); } var orderDaoSet = ConfigurationManager.AppSettings["orderDaoSet"]; switch (orderDaoSet) { case "1": orderDao = new OrderDaoDb(); break; default: throw new ConfigurationErrorsException($"Can't find settings for {nameof(orderDaoSet)}!"); } var orderProductDaoSet = ConfigurationManager.AppSettings["orderProductDaoSet"]; switch (orderProductDaoSet) { case "1": orderProductDao = new OrderProductDaoDb(); break; default: throw new ConfigurationErrorsException($"Can't find settings for {nameof(orderProductDaoSet)}!"); } var managerDaoSet = ConfigurationManager.AppSettings["managerDaoSet"]; switch (managerDaoSet) { case "1": managerDao = new ManagerDaoDb(); break; default: throw new ConfigurationErrorsException($"Can't find settings for {nameof(managerDaoSet)}!"); } var loggerDaoSet = ConfigurationManager.AppSettings["loggerDaoSet"]; switch (loggerDaoSet) { case "2": loggerDao = new LoggerDaoFile(); break; default: throw new ConfigurationErrorsException($"Can't find settings for {nameof(loggerDaoSet)}!"); } var feedbackDaoSet = ConfigurationManager.AppSettings["feedbackDaoSet"]; switch (feedbackDaoSet) { case "1": feedbackDao = new FeedbackDaoDb(); break; default: throw new ConfigurationErrorsException($"Can't find settings for {nameof(feedbackDaoSet)}!"); } RoleLogic = new RoleLogic(roleDao, loggerDao); UserLogic = new UserLogic(userDao, loggerDao); CustomerLogic = new CustomerLogic(customerDao, loggerDao); ProductLogic = new ProductLogic(productDao, loggerDao); OrderLogic = new OrderLogic(orderDao, loggerDao); OrderProductLogic = new OrderProductLogic(orderProductDao, loggerDao); ManagerLogic = new ManagerLogic(managerDao, loggerDao); LoggerLogic = new LoggerLogic(loggerDao); FeedbackLogic = new FeedbackLogic(feedbackDao, loggerDao); }
public void InitView() { ICustomerDao customerDao = DaoFactory.GetCustomerDao(); view.Customers = customerDao.GetAll(); }
//private readonly ICustomerDao customerDao; public CustomerProcessDb() { customerDao = DaoFactory.GetCustomerDao(); }
public AddCustomerView(ICustomerDao dao) { InitializeComponent(); m_presenter = new AddCustomerPresenter(this, dao); }
public CustomerService(ICustomerDao customerDao) { _customerDao = customerDao; }
public CustomerServiceImpl(ICustomerDao customerDao, CustomerEventPublisher publisher) { _customerDao = customerDao; _publisher = publisher; }
public CustomerCheckManager(ICustomerDao customerDao) { _customerDao = customerDao; }
/// <summary> /// We inject a DAO object into the object via the constructor /// </summary> public CustomersController(ICustomerDao dao) { _dao = dao; }
public AddCustomerPresenter(IAddCustomerView p_view, ICustomerDao p_customerDao) { m_view = p_view; m_customerDao = p_customerDao; }
public CustomerService(ICustomerDao dao, IGeocodeAdapter geocoder) { _dao = dao; _geocoder = geocoder; }
public CustomerApiStatesService(ICustomerDao fakeCustomerDao) : base("/customer-provider-states") { this.fakeCustomerDao = fakeCustomerDao; Post[""] = o => PostState(); }
Customer ICustomerDao.getNormalCustomer() { ICustomerDao dao = this; return(dao.getSingleCustomer(normal)); }
public AddCustomerModel() { customerDao = DaoFactory.GetCustomerDao(); }
public CustomerBll(ICustomerDao dao, Logger logger) { this.dao = dao; this.logger = logger; }
public CustomerBaseMgr(ICustomerDao entityDao) { this.entityDao = entityDao; }