/// <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); } }
/// <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); }
/// <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); } }
/// <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); } }