Exemple #1
0
 //================================================================================
 // Addresses
 //================================================================================
 /// <summary>
 /// Creates an address
 /// </summary>
 /// <returns>ID of the new address</returns>
 public int AddressCreate(Address address)
 {
     try
     {
         CustomerService client = WebServiceUtils.GetEndpointService <CustomerService>(CustomerServiceInfo.ENDPOINT_NAME);
         return(client.AddressCreateOrUpdate(address));
     } catch {
         return(-1);
     }
 }
Exemple #2
0
 public List <User> GetUsersByStoreCode(String storeCode)
 {
     try
     {
         UserService client = WebServiceUtils.GetEndpointService <UserService>(UserServiceInfo.ENDPOINT_NAME);
         return(client.GetUsersByStoreCode(storeCode));
     }
     catch (Exception e)
     {
         return(null);
     }
 }
Exemple #3
0
 public bool CustomerUpdateDefaultAddress(int AddressId, int CustomerId)
 {
     try
     {
         CustomerService customerService = WebServiceUtils.GetEndpointService <CustomerService>(CustomerServiceInfo.ENDPOINT_NAME);
         return(customerService.CustomerUpdateDefaultAddress(AddressId, CustomerId));
     }
     catch
     {
         return(false);
     }
 }
Exemple #4
0
 public User GetUserById(int id)
 {
     try
     {
         UserService client = WebServiceUtils.GetEndpointService <UserService>(UserServiceInfo.ENDPOINT_NAME);
         return(client.GetUserById(id));
     }
     catch (Exception e)
     {
         return(null);
     }
 }
Exemple #5
0
 //================================================================================
 // Users
 //================================================================================
 public List <User> GetAllUsers()
 {
     try
     {
         UserService client = WebServiceUtils.GetEndpointService <UserService>(UserServiceInfo.ENDPOINT_NAME);
         return(client.GetAllUsers());
     }
     catch (Exception e)
     {
         return(null);
     }
 }
Exemple #6
0
        public static Interface GetEndpointService <Interface>(String serviceUri)
        {
            RoleInstance         role     = WebServiceUtils.GetRandomWorkerInstance();
            RoleInstanceEndpoint endpoint = role.InstanceEndpoints[SERVICE_ENDPOINT_NAME];
            NetTcpBinding        binding  = new NetTcpBinding(SecurityMode.None, false);
            EndpointAddress      address  = new EndpointAddress(String.Format(serviceUri, endpoint.IPEndpoint));
            // actually open
            ChannelFactory <Interface> factory = new ChannelFactory <Interface>(binding, address);
            Interface client = factory.CreateChannel();

            return(client);
        }
Exemple #7
0
        //================================================================================
        // Site Areas
        //================================================================================

        public List <SiteArea> SiteAreasForStoreCode(String storecode)
        {
            List <SiteArea>  result = null;
            List <StoreInfo> stores = this.GetStoreInfoByStoreCode(storecode);

            if (stores.Count > 0)
            {
                StoreInfo      info           = stores.First();
                ProductService productService = WebServiceUtils.GetEndpointService <ProductService>(ProductServiceInfo.ENDPOINT_NAME);
                result = productService.SiteAreasForStoreCode(info);
            }
            return(result);
        }
Exemple #8
0
        //========================================================================================
        // CUSTOMERS
        //========================================================================================

        public List <Customers> CustomerListGetByAssociate(int Id)
        {
            try
            {
                CustomerService  customerService = WebServiceUtils.GetEndpointService <CustomerService>(CustomerServiceInfo.ENDPOINT_NAME);
                List <Customers> customerList    = customerService.GetCustomerListBySalesAssociate(Id);
                return(customerList);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
Exemple #9
0
 public int AddUser(String firstname, String lastname, String username, String storecode, int role = 1)
 {
     try
     {
         User newUser = new User();
         newUser.firstName = firstname;
         newUser.lastName  = lastname;
         newUser.userName  = username;
         newUser.storeCode = storecode;
         newUser.roleid    = role;
         UserService client = WebServiceUtils.GetEndpointService <UserService>(UserServiceInfo.ENDPOINT_NAME);
         return(client.AddUser(newUser));
     }
     catch (Exception e)
     {
         return(-1);
     }
 }
Exemple #10
0
        //============================================================================================
        //  Projects
        //============================================================================================

        /// <summary>
        /// This creates a record attaching a project and a customer.
        /// </summary>
        /// <param name="?"></param>
        /// <param name="?"></param>
        /// <returns></returns>
        internal int ProjectAttachCustomer(int CustomerId, int ProjectId)
        {
            ProjectService projectService = WebServiceUtils.GetEndpointService <ProjectService>(ProjectServiceInfo.ENDPOINT_NAME);

            return(projectService.ProjectAttachCustomer(CustomerId, ProjectId));
        }
Exemple #11
0
        internal bool ProductInstanceDelete(int id)
        {
            ProductService productService = WebServiceUtils.GetEndpointService <ProductService>(ProductServiceInfo.ENDPOINT_NAME);

            return(productService.ProductInstanceDelete(id));
        }
Exemple #12
0
        internal RoomsCategory CategoriesForRoomsCategory(String name)
        {
            ProductService productService = WebServiceUtils.GetEndpointService <ProductService>(ProductServiceInfo.ENDPOINT_NAME);

            return(productService.CategoriesForRoomsCategory(name));
        }
Exemple #13
0
        /// <summary>
        /// Creates a new project in the database and returns the Id.
        /// </summary>
        /// <param name="project"></param>
        /// <returns></returns>
        internal int ProjectCreateNew(Project project)
        {
            ProjectService projectService = WebServiceUtils.GetEndpointService <ProjectService>(ProjectServiceInfo.ENDPOINT_NAME);

            return(projectService.ProjectCreateNew(project));
        }
Exemple #14
0
        /// <summary>
        ///  Feed this an existing project ID and we create the whole quote.
        /// </summary>
        /// <param name="project">Project ID to Turn into a Quote</param>
        /// <returns></returns>
        ///  Here we copy an entire project into a quote.  To do so we need to
        ///  1.  Copy the project row itself, setting a new FKParent and updating the ProjectStatus
        ///  2.  Copy all the rooms, setting new FKParentRoom and new FKProject
        ///  3.  Copy all the ProductInstances, setting a new FKParentInstance and FKRoom
        internal int ProjectCreateFromProject(Project project, int statusId)
        {
            ProjectService projectService = WebServiceUtils.GetEndpointService <ProjectService>(ProjectServiceInfo.ENDPOINT_NAME);

            return(projectService.ProjectCreateFromProject(project, statusId));
        }
Exemple #15
0
        //  Updates  or adds customer an existing customer
        public int CustomerUpdateOrAdd(Customers customer)
        {
            CustomerService customerService = WebServiceUtils.GetEndpointService <CustomerService>(CustomerServiceInfo.ENDPOINT_NAME);

            return(customerService.CustomerUpdateOrAdd(customer));
        }
Exemple #16
0
        internal Project ProjectCollectFirstIfExists(int CustomerId, int StatusId)
        {
            ProjectService projectService = WebServiceUtils.GetEndpointService <ProjectService>(ProjectServiceInfo.ENDPOINT_NAME);

            return(projectService.ProjectCollectFirstIfExists(CustomerId, StatusId));
        }
Exemple #17
0
        internal List <Project> ProjectFindChildren(int ProjectId, int StatusId)
        {
            ProjectService projectService = WebServiceUtils.GetEndpointService <ProjectService>(ProjectServiceInfo.ENDPOINT_NAME);

            return(projectService.ProjectFindChildren(ProjectId, StatusId));
        }
Exemple #18
0
        ///<summary>
        ///  This collects a JSON object that can power the entire projects/customers section of the app.  It returns by ID
        ///</summary>
        public Customers CustomerGetById(int id)
        {
            CustomerService customerService = WebServiceUtils.GetEndpointService <CustomerService>(CustomerServiceInfo.ENDPOINT_NAME);

            return(customerService.CustomerGetById(id));
        }
Exemple #19
0
        internal bool ProjectDeleteFromUsers(int ProjectId)
        {
            ProjectService projectService = WebServiceUtils.GetEndpointService <ProjectService>(ProjectServiceInfo.ENDPOINT_NAME);

            return(projectService.ProjectDeleteFromUsers(ProjectId));
        }
Exemple #20
0
        public Customers CustomerGetByGUID(String CustomerGUID)
        {
            CustomerService customerService = WebServiceUtils.GetEndpointService <CustomerService>(CustomerServiceInfo.ENDPOINT_NAME);

            return(customerService.CustomerGetByGUID(CustomerGUID));
        }
Exemple #21
0
        //============================================================================================
        //  Categories
        //============================================================================================

        internal List <RoomsCategory> RoomsCategoryReadAll()
        {
            ProductService productService = WebServiceUtils.GetEndpointService <ProductService>(ProductServiceInfo.ENDPOINT_NAME);

            return(productService.GetAllRoomsCategories());
        }
Exemple #22
0
        //==============================================================================================
        //  Product Types
        //==============================================================================================

        internal Dictionary <string, ProductType> ProductsGetAll()
        {
            ProductService productService = WebServiceUtils.GetEndpointService <ProductService>(ProductServiceInfo.ENDPOINT_NAME);

            return(productService.ProductGetAll());
        }
Exemple #23
0
        internal ProductCategory ProductsForCategory(String guid)
        {
            ProductService productService = WebServiceUtils.GetEndpointService <ProductService>(ProductServiceInfo.ENDPOINT_NAME);

            return(productService.ProductsForCategory(guid));
        }
Exemple #24
0
        internal SiteArea ProductsForSiteArea(SiteArea siteArea)
        {
            ProductService productService = WebServiceUtils.GetEndpointService <ProductService>(ProductServiceInfo.ENDPOINT_NAME);

            return(productService.ProductsForSiteArea(siteArea));
        }
Exemple #25
0
        //==============================================================================================
        //  Product Instances
        //==============================================================================================

        /// <summary>
        ///  Creates or updates a product instance depending on whether or not we have an Id.
        /// </summary>
        /// <param name="ProductInstance">ProductInstance</param>
        /// <returns></returns>
        internal int ProductInstanceCreateOrUpdate(ProductInstance ProductInstance)
        {
            ProductService productService = WebServiceUtils.GetEndpointService <ProductService>(ProductServiceInfo.ENDPOINT_NAME);

            return(productService.ProductInstanceCreateOrUpdate((ProductInstance)ProductInstance));
        }
Exemple #26
0
        public SiteArea SiteAreaById(String guid)
        {
            ProductService productService = WebServiceUtils.GetEndpointService <ProductService>(ProductServiceInfo.ENDPOINT_NAME);

            return(productService.GetSiteArea(guid));
        }