Ejemplo n.º 1
0
        public static Person ReturnItem(String email)
        {
            try {
                SqlConnection connect = RetaloDB.GetConnection();

                string selectStatement =
                    "Select *"
                    + " FROM Person"
                    + " Where Email = @email";

                SqlCommand selectCommand = new SqlCommand(selectStatement, connect);
                selectCommand.Parameters.AddWithValue("@email", email);

                Person person = PersonOperations.ReturnPerson(selectCommand, connect);
                return(person);
            } catch (Exception ex) {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        public static Boolean AddorUpdateItem(Person person)
        {
            try
            {
                if (ReturnItem(person) == null)
                {
                    return(PersonOperations.AddPerson(person));
                }
                else
                {
                    return(PersonOperations.UpdatePerson(person.ID, person));
                }
            }
            catch (Exception ex)
            {
                return(false);

                throw ex;
            }
        }
Ejemplo n.º 3
0
        public static Person ReturnItem(Person person)
        {
            if (person.ID.ToString() == "")
            {
                person = null;
                return(person);
            }
            try {
                SqlConnection connect = RetaloDB.GetConnection();

                string selectStatement =
                    "Select *"
                    + "FROM Person"
                    + " Where PerID = @id";
                SqlCommand selectCommand = new SqlCommand(selectStatement, connect);
                selectCommand.Parameters.AddWithValue("@id", person.ID);

                Person person2 = PersonOperations.ReturnPerson(selectCommand, connect);
                return(person2);
            }
            catch (Exception ex) {
                throw ex;
            }
        }