protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (_context != null)
         {
             _context.Dispose();
             _context = null;
         }
     }
 }
Beispiel #2
0
 public CustomersController(CustomersContext context)
 {
     _context = context;
 }
 public TypeInitializer(CustomersContext context)
 {
     _context = context;
 }
 public CustomersRepository(CustomersContext context)
 {
     this.context = context;
 }
 public CustomersRepository(CustomersContext context)
 {
     _context = context ?? throw new ArgumentNullException(nameof(context));
 }
Beispiel #6
0
 public Pets(ILogger <Pets> logger, CustomersContext dbContext)
 {
     _logger    = logger;
     _dbContext = dbContext;
 }
 public MockCustomers(CustomersContext context)
 {
     _context = context;
 }
Beispiel #8
0
 public CustomerService(CustomersContext dbContext)
 {
     _dbContext = dbContext;
 }
Beispiel #9
0
 public SampleDataController(CustomersContext context)
 {
     _context = context;
 }
 public CustomersRepository(CustomersContext db, CustomersContext context)
 {
     Entity   = db.Customers.AsQueryable();
     _context = context;
 }
 public void LoadDescriptions(CustomersContext AContext)
 {
     AudiogramTypeOutDescription = AContext.CU_S_AUDIOGRAM_TYPE.FirstOrDefault(E => E.AUDIOGRAM_TYPE_CODE == AudiogramTypeOutCode)?.AUDIOGRAM_TYPE_DESCR;
     HiConditionDescription      = AContext.CU_S_HICONDITION.FirstOrDefault(E => E.HICONDITION_CODE == HiConditionCode)?.HICONDITION_DESCR;
 }
Beispiel #12
0
 protected BaseRepository(CustomersContext context, IMapper mapper)
 {
     dbContext   = context;
     this.mapper = mapper;
 }
 public CustomerRepository(CustomersContext ctx)
 {
     _ctx = ctx;
 }
 public ManagersRepository(CustomersContext context, IMapper mapper)
 {
     this.context = context;
     this.mapper  = mapper;
 }
Beispiel #15
0
 public BaseRepository(CustomersContext customersContext) => _customersContext = customersContext;
 public CustomerRepository(CustomersContext ctx)
 {
     _ctx = ctx;
 }
        public override void LoadData <T>(DbContext context, dynamic entity)
        {
            base.LoadData <T>(context, (T)entity);

            if (entity is CU_B_ADDRESS_BOOK)
            {
                CustomersContext DBContext = (CustomersContext)context;
                CU_B_PROFILE_ATTRIBUTE_LOOKUP ProfileAttribute = DBContext.CU_B_PROFILE_ATTRIBUTE_LOOKUP.FirstOrDefault(E => E.CUSTOMER_CODE == ID && E.ATTRIBUTE_CODE == "SMF");
                PreferredContactMethod = EnumHelper.GetEnumFromValue <PreferredContactMethods>(ProfileAttribute?.VALUE_CODE, PreferredContactMethods.Any);
                CU_B_PROFILE_ATTRIBUTE_LOOKUP Attribute = DBContext.CU_B_PROFILE_ATTRIBUTE_LOOKUP.FirstOrDefault(E => E.CUSTOMER_CODE == ID && E.ATTRIBUTE_CODE == "PCT");
                IsOtherContactPreferred = Attribute?.VALUE_CODE == "02";
                CU_B_PROFILE_ATTRIBUTE_LOOKUP PreferredTimeOfContactAttribute = DBContext.CU_B_PROFILE_ATTRIBUTE_LOOKUP.FirstOrDefault(E => E.CUSTOMER_CODE == ID && E.ATTRIBUTE_CODE == "CTP");
                PreferredTimeOfContactCode = PreferredTimeOfContactAttribute?.VALUE_CODE ?? "06";

                List <Address> Addrs = new List <Address>();
                foreach (CU_B_ADDRESS Item in ((CU_B_ADDRESS_BOOK)entity).CU_B_ADDRESS.OrderBy(E => E.ADDRESS_COUNTER))
                {
                    try
                    {
                        Addrs.Add(new Address(Item));
                    }
                    catch
                    {
                    }
                }
                Addresses = Addrs.ToArray();
            }
            else if (entity is CU_B_LEAD_EXT_AUS)
            {
                CustomersContext DBContext = (CustomersContext)context;
                string           XID       = entity.XID;
                List <Address>   Addrs     = new List <Address>();
                int AddressCounter         = 1;
                foreach (CU_B_LEAD_ADDRESS_EXT_AUS Item in DBContext.CU_B_LEAD_ADDRESS_EXT_AUS.Where(E => E.XID == XID).OrderBy(E => E.ADDRESSTYPE))
                {
                    try
                    {
                        Address address = EntityMapper.Map <Address, CU_B_LEAD_ADDRESS_EXT_AUS>(DBContext, Item);
                        if (Item.ADDRESSTYPE == "1")                         //Residential
                        {
                            address.IsHomeAddress    = true;
                            address.IsMailingDefault = true;
                            address.IsInvoiceDefault = true;
                        }
                        else if (Item.ADDRESSTYPE == "2")                         //Postal
                        {
                            address.IsHomeAddress    = false;
                            address.IsMailingDefault = true;
                        }

                        address.AddressCounter = AddressCounter++;
                        Addrs.Add(address);
                    }
                    catch
                    {
                    }
                }

                //Ensure existance of the home address
                if (Addrs.Count == 1 || (Addrs.Count > 0 && !Addrs.Any(E => E.IsHomeAddress)))
                {
                    Addrs[0].IsHomeAddress    = true;
                    Addrs[0].IsMailingDefault = true;
                    Addrs[0].IsInvoiceDefault = true;
                }

                Address HomeAddress    = Addrs.FirstOrDefault(E => E.IsHomeAddress);
                Address MailingAddress = Addrs.FirstOrDefault(E => !E.IsHomeAddress && E.IsMailingDefault);
                HomeAddress.IsMailingDefault = (MailingAddress == null);

                Addresses = Addrs.ToArray();
            }
        }
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger <Startup> logger, CustomersContext dbContext)
        {
            switch (Environment.EnvironmentName)
            {
            case ("Development"):
            case ("Docker"):
                logger.LogInformation($"Running as {Environment.EnvironmentName} environment");
                app.UseDeveloperExceptionPage();
                break;

            default:
                break;
            }
            ;

            dbContext.SeedAll();

            //app.UseHttpsRedirection();

            app.UseRouting();

            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Pet Clinic Customers Service");
            });

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
Beispiel #19
0
 public CustomersController(CustomersContext context)
 {
     this.context = context;
 }
Beispiel #20
0
        public IActionResult Display(string sortOrder, string searchTitle, string searchGivenName, string searchMiddleInitial, string searchSurname, string searchGender, string searchCompany, string searchOccupation, string searchEmailAddress, string columnName, int NoOfRows, int?page)
        {
            ViewBag.NameSortParm        = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            ViewBag.SearchTitle         = searchTitle;
            ViewBag.SearchGivenName     = searchGivenName;
            ViewBag.SearchMiddleInitial = searchMiddleInitial;
            ViewBag.SearchSurname       = searchSurname;
            ViewBag.SearchGender        = searchGender;
            ViewBag.SearchCompany       = searchCompany;
            ViewBag.SearchOccupation    = searchOccupation;
            ViewBag.SearchEmailAddress  = searchEmailAddress;

            var context       = new CustomersContext();
            var customersSort = from s in context.Customers
                                select s;

            if (!String.IsNullOrEmpty(searchTitle))
            {
                customersSort = customersSort.Where(s => s.Title.Equals(searchTitle));
            }
            if (!String.IsNullOrEmpty(searchGivenName))
            {
                customersSort = customersSort.Where(s => s.GivenName.Contains(searchGivenName));
            }
            if (!String.IsNullOrEmpty(searchMiddleInitial))
            {
                customersSort = customersSort.Where(s => s.MiddleInitial.Equals(searchMiddleInitial));
            }
            if (!String.IsNullOrEmpty(searchSurname))
            {
                customersSort = customersSort.Where(s => s.Surname.Contains(searchSurname));
            }
            if (!String.IsNullOrEmpty(searchGender))
            {
                customersSort = customersSort.Where(s => s.Gender.Equals(searchGender));
            }
            if (!String.IsNullOrEmpty(searchCompany))
            {
                customersSort = customersSort.Where(s => s.Company.Contains(searchCompany));
            }
            if (!String.IsNullOrEmpty(searchOccupation))
            {
                customersSort = customersSort.Where(s => s.Occupation.Equals(searchOccupation));
            }
            if (!String.IsNullOrEmpty(searchEmailAddress))
            {
                customersSort = customersSort.Where(s => s.EmailAddress.Equals(searchEmailAddress));
            }

            switch (columnName)
            {
            case "Title":
                customersSort = ViewBag.NameSortParm == "name_desc" ? customersSort.OrderBy(s => s.Title) : customersSort.OrderByDescending(s => s.Title);
                break;

            case "Given Name":
                customersSort = ViewBag.NameSortParm == "name_desc" ? customersSort.OrderBy(s => s.GivenName) : customersSort.OrderByDescending(s => s.GivenName);
                break;

            case "Middle Initial":
                customersSort = ViewBag.NameSortParm == "name_desc" ? customersSort.OrderBy(s => s.MiddleInitial) : customersSort.OrderByDescending(s => s.MiddleInitial);
                break;

            case "Surname":
                customersSort = ViewBag.NameSortParm == "name_desc" ? customersSort.OrderBy(s => s.Surname) : customersSort.OrderByDescending(s => s.Surname);
                break;

            case "Gender":
                customersSort = ViewBag.NameSortParm == "name_desc" ? customersSort.OrderBy(s => s.Gender) : customersSort.OrderByDescending(s => s.Gender);
                break;

            case "Company":
                customersSort = ViewBag.NameSortParm == "name_desc" ? customersSort.OrderBy(s => s.Company) : customersSort.OrderByDescending(s => s.Company);
                break;

            case "Occupation":
                customersSort = ViewBag.NameSortParm == "name_desc" ? customersSort.OrderBy(s => s.Occupation) : customersSort.OrderByDescending(s => s.Occupation);
                break;

            case "Email Address":
                customersSort = ViewBag.NameSortParm == "name_desc" ? customersSort.OrderBy(s => s.EmailAddress) : customersSort.OrderByDescending(s => s.EmailAddress);
                break;

            default:
                customersSort = customersSort.OrderBy(s => s.Title);
                break;
            }
            //return View(customersSort);

            int pageSize   = NoOfRows == 0 ? 10: NoOfRows;
            int pageNumber = (page ?? 1);

            return(View(customersSort.ToPagedList(pageNumber, pageSize)));
        }
Beispiel #21
0
 public UnitOfWork(CustomersContext context)
 {
     _context = context;
 }
Beispiel #22
0
 protected BaseRepository(CustomersContext context)
 {
     Context = context;
 }
Beispiel #23
0
 /// <summary>
 /// Initializes the <see cref="T:System.Web.Http.ApiController" /> instance with the specified controllerContext.
 /// </summary>
 /// <param name="controllerContext">The <see cref="T:System.Web.Http.Controllers.HttpControllerContext" /> object that is used for the initialization.</param>
 protected override void Initialize(HttpControllerContext controllerContext)
 {
     base.Initialize(controllerContext);
     _context      = new CustomersContext();
     DomainManager = new CustomerDomainManager(_context, Request, Services);
 }
Beispiel #24
0
 public CustomerRepository(CustomersContext context)
 {
     _context = context;
 }
Beispiel #25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CustomerDomainManager"/> class.
 /// </summary>
 /// <param name="context">
 /// The context.
 /// </param>
 /// <param name="request">
 /// The request.
 /// </param>
 /// <param name="services">
 /// The services.
 /// </param>
 public CustomerDomainManager(CustomersContext context, HttpRequestMessage request, ApiServices services)
     : base(context, request, services)
 {
     Request  = request;
     _context = context;
 }
Beispiel #26
0
 public UserRepository(CustomersContext context) : base(context)
 {
 }
 public DepartmentRepository(CustomersContext context) : base(context)
 {
 }
Beispiel #28
0
 public Owners(ILogger <Owners> logger, CustomersContext dbContext)
 {
     _logger    = logger;
     _dbContext = dbContext;
 }
 public ClientesRepository(CustomersContext customersContext)
 {
     _customersContext = customersContext;
 }
Beispiel #30
0
 public CustomersRepository(CustomersContext context, IMapper mapper)
     : base(context, mapper)
 {
 }
Beispiel #31
0
 public ContactRepository(CustomersContext context) : base(context)
 {
 }
Beispiel #32
0
 public CustomersRepository(CustomersContext db)
 {
     Entity = db.Customers.AsQueryable();
 }
 public CustomersController()
 {
     _context = new CustomersContext();
 }