예제 #1
0
        /// <summary>
        /// Authenticates a specified user
        /// </summary>
        /// <returns>Customer id</returns>
        public int Logon(string email, string password)
        {
            try
            {
                int customerId = 0;

                CustomerDS   customerDS   = new CustomerDS();
                CustomerDALC customerDALC = new CustomerDALC();

                customerDALC.GetCustomerByEmail(customerDS, email);

                if (customerDS.Customers.Rows.Count > 0)
                {
                    if ((string)customerDS.Customers[0].Password == password)
                    {
                        customerId = (int)customerDS.Customers[0].CustomerId;
                    }
                }

                return(customerId);
            }
            catch (Exception e)
            {
                throw new ApplicationException(ResourceManager.GetString("RES_ExceptionCantAuthenticateCustomer"), e);
            }
        }
예제 #2
0
        /// <summary>
        /// Gets customer information
        /// </summary>
        /// <param name="logon">customer logon</param>
        public CustomerDS GetCustomerByLogon(string logon)
        {
            CustomerDS   customerDS   = new CustomerDS();
            CustomerDALC customerDALC = new CustomerDALC();

            customerDALC.GetCustomerByEmail(customerDS, logon);

            return(customerDS);
        }
예제 #3
0
        /// <summary>
        /// Creates a new task for the specified user
        /// </summary>
        public void CreateTask(Guid taskId, string logon)
        {
            try
            {
                CustomerDS   customerDS   = new CustomerDS();
                CustomerDALC customerDALC = new CustomerDALC();
                customerDALC.GetCustomerByEmail(customerDS, logon);

                int customerId = customerDS.Customers[0].CustomerId;

                CartTaskDALC cartTaskDALC = new CartTaskDALC();
                cartTaskDALC.CreateTask(taskId, customerId);
            }
            catch (Exception e)
            {
                throw new ApplicationException(ResourceManager.GetString("RES_ExceptionCreateTask"), e);
            }
        }
예제 #4
0
        /// <summary>
        /// Gets the task related to the specified user
        /// </summary>
        public Guid GetTask(string logon)
        {
            try
            {
                CustomerDS   customerDS   = new CustomerDS();
                CustomerDALC customerDALC = new CustomerDALC();
                customerDALC.GetCustomerByEmail(customerDS, logon);

                int customerId = customerDS.Customers[0].CustomerId;

                CartTaskDALC cartTaskDALC = new CartTaskDALC();
                return(cartTaskDALC.GetTask(customerId));
            }
            catch (Exception e)
            {
                throw new ApplicationException(ResourceManager.GetString("RES_ExceptionGetTask"), e);
            }
        }