Exemplo n.º 1
0
        public CompanyUserStruct GetCustomerUser(string mail, string pin)
        {
            _connection.SqlConnection.Open();

            var cmd = new SqlCommand("" +
                                     "SELECT [CustomerUser].[idCustomerUser], [CustomerUser].Name, [User].IsActive, [User].Mail, [CustomerUser].[idCompany], [CustomerUser].Pin, [CustomerUser].DateOfBirth " +
                                     "FROM [User] " +
                                     "INNER JOIN [CustomerUser] ON [CustomerUser].idCustomerUser = [User].idCustomerUser " +
                                     "WHERE [User].Mail = @mail AND [CustomerUser].pin = @pin", _connection.SqlConnection);

            cmd.Parameters.Add(new SqlParameter("mail", mail));
            cmd.Parameters.Add(new SqlParameter("pin", pin));

            var reader = cmd.ExecuteReader();

            CompanyUserStruct customerUserStruct = new CompanyUserStruct();

            while (reader.Read())
            {
                customerUserStruct = new CompanyUserStruct(
                    reader.GetInt32(0),                   //id
                    reader.GetString(1),                  //name
                    reader.GetBoolean(2),                 //active
                    reader.GetString(3),                  //mail
                    reader.GetInt32(4),                   //companyId
                    Convert.ToInt32(reader.GetString(5)), //pin
                    reader.GetDateTime(6)                 //birthdate
                    );
            }

            _connection.SqlConnection.Close();

            return(customerUserStruct);
        }
Exemplo n.º 2
0
 public CompanyUser(CompanyUserStruct UserStruct)
 {
     this.Id          = UserStruct.Id;
     this.Mail        = UserStruct.Mail;
     this.Name        = UserStruct.Name;
     this.IsActive    = UserStruct.IsActive;
     this.DateOfBirth = UserStruct.DateOfBirth;
     this.Pin         = UserStruct.Pin;
     this.CompanyId   = UserStruct.CompanyId;
 }
 public CompanyUserStruct NewCustomerUser(CompanyUserStruct NewCustomerUser)
 {
     return(CompanyContext.NewCustomerUser(NewCustomerUser));
 }
 public void DeleteCustomerUserForCompany(int CompanyId, CompanyUserStruct CustomerUser)
 {
     CompanyContext.DeleteCustomerUserForCompany(CompanyId, CustomerUser);
 }
Exemplo n.º 5
0
 public CompanyUserStruct NewCustomerUser(CompanyUserStruct NewCustomerUser)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 6
0
 public void DeleteCustomerUserForCompany(int CompanyId, CompanyUserStruct CustomerUser)
 {
     throw new NotImplementedException();
 }