Exemple #1
0
        public IList <Models.ProductStatusType> Get_LookupProductStatusTypes()
        {
            ILookupBS bs = DIFactoryDesigntime.GetInstance <ILookupBS>();
            IList <Models.ProductStatusType> rtnList = bs.LookupProductStatusTypes();

            return(rtnList);
        }
Exemple #2
0
        public IList <Models.ProductCM> GetAllProductsByCategoryId(int categoryId)
        {
            //IProductBS bs = default(IProductBS);
            IProductBS bs = DIFactoryDesigntime.GetInstance <IProductBS>();

            return(bs.GetAllProductsByCategoryId(categoryId));
        }
Exemple #3
0
        public IList <Models.Category> Get_LookupCategories()
        {
            ILookupBS bs = DIFactoryDesigntime.GetInstance <ILookupBS>();
            IList <Models.Category> rtnList = bs.LookupCategories();

            return(rtnList);
        }
Exemple #4
0
        public void Post_UpdateContact([FromBody] Models.Contact mContact)
        {
            IContactBS bs = DIFactoryDesigntime.GetInstance <IContactBS>();
            IBaseConverter <Models.Contact, Entities.Contact> convtResult = new AutoMapConverter <Models.Contact, Entities.Contact>();

            Entities.Contact eContact = convtResult.ConvertObject(mContact);
            bs.UpdateContact(eContact);
        }
        public IHttpActionResult GetInterface(int id)
        {
            IInterfaceBS bs         = DIFactoryDesigntime.GetInstance <IInterfaceBS>();
            Interface    _interface = bs.GetInterfacesById(id);

            if (_interface == null)
            {
                return(NotFound());
            }

            return(Ok(_interface));
        }
Exemple #6
0
        public IHttpActionResult GetDevice(int id)
        {
            IDeviceBS bs     = DIFactoryDesigntime.GetInstance <IDeviceBS>();
            Device    device = bs.GetDevicesById(id);

            if (device == null)
            {
                return(NotFound());
            }

            return(Ok(device));
        }
Exemple #7
0
        public void Post_DeleteContact(List <int> ids)
        {
            IContactBS bs = DIFactoryDesigntime.GetInstance <IContactBS>();

            if (ids.Count > 0)
            {
                ids.ForEach(delegate(int id)
                {
                    bs.DeleteContact(id);
                });
            }
        }
        public IHttpActionResult GetLocation(int id)
        {
            ILocationBS bs       = DIFactoryDesigntime.GetInstance <ILocationBS>();
            Location    location = bs.GetLocationsById(id);

            if (location == null)
            {
                return(NotFound());
            }

            return(Ok(location));
        }
Exemple #9
0
        public ProductListResponse GetAllProducts([ModelBinder(typeof(FieldValueModelBinder))] GetProductsBySearchRequest request)
        {
            var resp = new ProductListResponse();

            resp.Products = new Models.Products();
            int        totalCount            = 0;
            IProductBS bs                    = DIFactoryDesigntime.GetInstance <IProductBS>();
            IList <Models.ProductCM> rtnList = bs.GetFullProducts(0, request.PaginationRequest, out totalCount);

            resp.Products.AddRange(rtnList);
            resp.TotalCount = totalCount;
            return(resp);
        }
Exemple #10
0
        public IHttpActionResult GetIPAddress(int id)
        {
            IIPAddressBS bs = DIFactoryDesigntime.GetInstance <IIPAddressBS>();

            PingCo.Model.IPAddress IPAddress = bs.GetIPAddressesById(id);

            if (IPAddress == null)
            {
                return(NotFound());
            }

            return(Ok(IPAddress));
        }
Exemple #11
0
        public ProductListResponse Post_GetProductList([FromBody] GetProductsBySearchRequest request)
        {
            var resp = new ProductListResponse();

            resp.Products = new Models.Products();

            Models.ProductSearchField searchField = 0;
            string   searchText = null;
            Decimal? priceLow   = null;
            Decimal? priceHigh  = null;
            DateTime?dateFrom   = null;
            DateTime?dateTo     = null;

            if (request.ProductSearchFilter != null)
            {
                searchField = request.ProductSearchFilter.ProductSearchField;
                searchText  = request.ProductSearchFilter.ProductSearchText;
            }
            if (request.PriceSearchFilter != null)
            {
                if (!String.IsNullOrEmpty(request.PriceSearchFilter.SearchPriceLow))
                {
                    priceLow = Convert.ToDecimal(request.PriceSearchFilter.SearchPriceLow);
                }
                if (!String.IsNullOrEmpty(request.PriceSearchFilter.SearchPriceHigh))
                {
                    priceHigh = Convert.ToDecimal(request.PriceSearchFilter.SearchPriceHigh);
                }
            }
            if (request.DateSearchFilter != null)
            {
                if (!String.IsNullOrEmpty(request.DateSearchFilter.SearchDateFrom))
                {
                    dateFrom = Convert.ToDateTime(request.DateSearchFilter.SearchDateFrom);
                }
                if (!String.IsNullOrEmpty(request.DateSearchFilter.SearchDateTo))
                {
                    dateTo = Convert.ToDateTime(request.DateSearchFilter.SearchDateTo);
                }
            }
            int totalCount = 0;

            IProductBS bs = DIFactoryDesigntime.GetInstance <IProductBS>();
            IList <Models.ProductCM> rtnList = bs.GetProductList(searchField, searchText,
                                                                 priceLow, priceHigh, dateFrom, dateTo, request.StatusCode, request.PaginationRequest, out totalCount);

            resp.Products.AddRange(rtnList);
            resp.TotalCount = totalCount;
            return(resp);
        }
Exemple #12
0
        public ContactListResponse GetContactList()
        {
            var resp = new ContactListResponse();

            resp.Contacts = new Models.Contacts();

            IContactBS bs = DIFactoryDesigntime.GetInstance <IContactBS>();
            IList <Entities.Contact> rtnList = bs.GetContacts();
            IBaseConverter <Entities.Contact, Models.Contact> convtResult = new AutoMapConverter <Entities.Contact, Models.Contact>();
            var convtList = convtResult.ConvertObjectCollection(rtnList);

            resp.Contacts.AddRange(convtList);
            return(resp);
        }
        public IHttpActionResult PostInterface(Interface _interface)
        {
            ModelState.Remove("_interface.Id");

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            IInterfaceBS bs = DIFactoryDesigntime.GetInstance <IInterfaceBS>();

            bs.AddInterfaces(_interface);

            return(CreatedAtRoute("DefaultApi", new { id = _interface.Id }, _interface));
        }
Exemple #14
0
        public IHttpActionResult PostDevice(Device device)
        {
            ModelState.Remove("device.Id");

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            IDeviceBS bs = DIFactoryDesigntime.GetInstance <IDeviceBS>();

            bs.AddDevices(device);

            return(CreatedAtRoute("DefaultApi", new { id = device.Id }, device));
        }
        public IHttpActionResult PostLocation(Location location)
        {
            ModelState.Remove("location.Id");

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            ILocationBS bs = DIFactoryDesigntime.GetInstance <ILocationBS>();

            bs.AddLocations(location);

            return(CreatedAtRoute("DefaultApi", new { id = location.Id }, location));
        }
Exemple #16
0
        public AddContactResponse Post_AddContact([FromBody] Models.Contact mContact)
        {
            IContactBS bs = DIFactoryDesigntime.GetInstance <IContactBS>();
            IBaseConverter <Models.Contact, Entities.Contact> convtResult = new AutoMapConverter <Models.Contact, Entities.Contact>();

            Entities.Contact eContact = convtResult.ConvertObject(mContact);
            bs.AddContact(eContact);

            var addContactResponse = new AddContactResponse()
            {
                ContactID = eContact.ContactID
            };

            return(addContactResponse);
        }
Exemple #17
0
        public IHttpActionResult PostIPAddress(PingCo.Model.IPAddress IPAddress)
        {
            ModelState.Remove("IPAddress.Id");

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            IIPAddressBS bs = DIFactoryDesigntime.GetInstance <IIPAddressBS>();

            bs.AddIPAddresses(IPAddress);

            return(CreatedAtRoute("DefaultApi", new { id = IPAddress.Id }, IPAddress));
        }
Exemple #18
0
        public IHttpActionResult GetContactById(int id)
        {
            IContactBS bs       = DIFactoryDesigntime.GetInstance <IContactBS>();
            var        eContact = bs.GetContactById(id);

            if (eContact == null)
            {
                return(NotFound());
            }
            else
            {
                IBaseConverter <Entities.Contact, Models.Contact> convtResult = new AutoMapConverter <Entities.Contact, Models.Contact>();
                Models.Contact mContact = convtResult.ConvertObject(eContact);
                return(Ok(mContact));
            }
        }
Exemple #19
0
        public IList <Models.ProductCM> GetAllProducts()
        {
            //IProductBS bs = default(IProductBS);
            IProductBS bs = DIFactoryDesigntime.GetInstance <IProductBS>();
            IList <Models.ProductCM> rtn = default(IList <Models.ProductCM>);

            //try
            //{
            rtn = bs.GetAllProductsByCategoryId(0);
            //}
            //catch (Exception ex)
            //{
            //    var msg = ex.Message;
            //}
            return(rtn);
        }
Exemple #20
0
        public HttpResponseMessage Post_AddProduct([FromBody] Models.Product mProduct)
        {
            IProductBS bs = DIFactoryDesigntime.GetInstance <IProductBS>();
            IBaseConverter <Models.Product, Entities.Product> convtResult = new AutoMapConverter <Models.Product, Entities.Product>();

            Entities.Product eProduct = convtResult.ConvertObject(mProduct);
            bs.AddProduct(eProduct);

            var response = Request.CreateResponse(HttpStatusCode.Created);

            // Generate a link to the new product and set the Location header in the response.
            string uri = Url.Link("GetProductById", new { id = eProduct.ProductID });

            response.Headers.Location = new Uri(uri);
            return(response);
        }
Exemple #21
0
        public AddContactsResponse Post_AddContacts([FromBody] List <Models.Contact> mContactList)
        {
            var        contactIdList = new List <int>();
            IContactBS bs            = DIFactoryDesigntime.GetInstance <IContactBS>();

            foreach (var mContact in mContactList)
            {
                IBaseConverter <Models.Contact, Entities.Contact> convtResult = new AutoMapConverter <Models.Contact, Entities.Contact>();
                Entities.Contact eContact = convtResult.ConvertObject(mContact);
                bs.AddContact(eContact);
                contactIdList.Add(eContact.ContactID);
            }
            var resp = new AddContactsResponse();

            resp.ContactIdList = contactIdList;
            return(resp);
        }
        public IHttpActionResult PutLocation(int id, Interface _interface)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != _interface.Id)
            {
                return(BadRequest());
            }

            IInterfaceBS bs = DIFactoryDesigntime.GetInstance <IInterfaceBS>();

            bs.UpdateInterfaces(_interface);


            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemple #23
0
        public IHttpActionResult PutIPAddress(int id, PingCo.Model.IPAddress IPAddress)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != IPAddress.Id)
            {
                return(BadRequest());
            }

            IIPAddressBS bs = DIFactoryDesigntime.GetInstance <IIPAddressBS>();

            bs.UpdateIPAddresses(IPAddress);


            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult PutLocation(int id, Location location)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != location.Id)
            {
                return(BadRequest());
            }

            ILocationBS bs = DIFactoryDesigntime.GetInstance <ILocationBS>();

            bs.UpdateLocations(location);


            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemple #25
0
        public IHttpActionResult PutDevice(int id, Device device)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != device.Id)
            {
                return(BadRequest());
            }

            IDeviceBS bs = DIFactoryDesigntime.GetInstance <IDeviceBS>();

            bs.UpdateDevices(device);


            return(StatusCode(HttpStatusCode.NoContent));
        }
        // GET: api/Locations
        public IQueryable <Location> GetLocations()
        {
            ILocationBS bs = DIFactoryDesigntime.GetInstance <ILocationBS>();

            return(bs.GetLocations());
        }
Exemple #27
0
        public ProductListResponse GetProductList([ModelBinder(typeof(FieldValueModelBinder))] GetProductsBySearchRequest request)
        {
            var resp = new ProductListResponse();

            resp.Products = new Models.Products();

            Models.ProductSearchField searchField = 0;
            string   searchText = null;
            Decimal? priceLow   = null;
            Decimal? priceHigh  = null;
            DateTime?dateFrom   = null;
            DateTime?dateTo     = null;

            if (request.ProductSearchFilter != null)
            {
                searchField = request.ProductSearchFilter.ProductSearchField;
                searchText  = request.ProductSearchFilter.ProductSearchText;
            }
            if (request.PriceSearchFilter != null)
            {
                if (!String.IsNullOrEmpty(request.PriceSearchFilter.SearchPriceLow))
                {
                    priceLow = Convert.ToDecimal(request.PriceSearchFilter.SearchPriceLow);
                }
                if (!String.IsNullOrEmpty(request.PriceSearchFilter.SearchPriceHigh))
                {
                    priceHigh = Convert.ToDecimal(request.PriceSearchFilter.SearchPriceHigh);
                }
            }
            if (request.DateSearchFilter != null)
            {
                if (!String.IsNullOrEmpty(request.DateSearchFilter.SearchDateFrom))
                {
                    dateFrom = Convert.ToDateTime(request.DateSearchFilter.SearchDateFrom);
                }
                if (!String.IsNullOrEmpty(request.DateSearchFilter.SearchDateTo))
                {
                    dateTo = Convert.ToDateTime(request.DateSearchFilter.SearchDateTo);
                }
            }
            int totalCount = 0;

            IProductBS bs = default(IProductBS);

            //IProductBS prodBs = DIFactoryDesigntime.GetInstance<IProductBS>();
            //try
            //{
            bs = DIFactoryDesigntime.GetInstance <IProductBS>();
            //}
            //catch (Exception ex)
            //{
            //    var msg = ex.Message;
            //}

            //IProductRepository productRepo = new ProductRepository(new StoreDataModelUnitOfWork());
            IEnumerable <ProductCM> rtnList = bs.GetProductList(searchField, searchText,
                                                                priceLow, priceHigh, dateFrom, dateTo, request.StatusCode, request.PaginationRequest, out totalCount);

            resp.Products.AddRange(rtnList);
            resp.TotalCount = totalCount;
            return(resp);
        }
        // GET: api/Interfaces
        public IQueryable <Interface> GetInterfaces()
        {
            IInterfaceBS bs = DIFactoryDesigntime.GetInstance <IInterfaceBS>();

            return(bs.GetInterfaces());
        }
Exemple #29
0
        public void DeleteProduct(int id)
        {
            IProductBS bs = DIFactoryDesigntime.GetInstance <IProductBS>();

            bs.DeleteProduct(id);
        }
Exemple #30
0
        public void DeleteContact(int id)
        {
            IContactBS bs = DIFactoryDesigntime.GetInstance <IContactBS>();

            bs.DeleteContact(id);
        }