Пример #1
0
 public DepositReturn(int returnID, Deposit deposit, Profile profile, User user, int count, DateTime created)
 {
     this.returnID = returnID;
     this.deposit = deposit;
     this.profile = profile;
     this.user = user;
     this.count = count;
     this.created = created;
 }
Пример #2
0
 // methods
 public Article()
 {
     this.deposit = Deposit.NullDeposit;
 }
Пример #3
0
        private static Deposit GetDeposit(string depositname, int profileID)
        {
            Deposit deposit = null;

            try
            {
                SqlConnection connection = new SqlConnection(ConnectionString);
                SqlCommand cmd = new SqlCommand("SELECT * FROM Deposit WHERE Name = '" + depositname + "' AND ProfileID = " + profileID, connection);
                connection.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    deposit = new Deposit();
                    deposit.DepositID = Convert.ToInt32(reader["DepositID"]);
                    deposit.Name = reader["Name"].ToString();
                    deposit.Amount = Convert.ToDouble(reader["Amount"]);
                    deposit.IsDeleted = Convert.ToBoolean(reader["IsDeleted"]);
                    deposit.Created = Convert.ToDateTime(reader["Created"]);
                }
                connection.Close();
            }
            catch (Exception ex)
            {
                LogWriter.Write(ex, LOGFILE_NAME);
                string errmsg = "Fehler beim Abrufen des Pfandes.\n\n";
                errmsg += "DatabaseHandler.GetDeposit(depositname, profileID): " + ex.Message;
                throw new Exception(errmsg);
            }

            return deposit;
        }
Пример #4
0
        private static List<Deposit> GetDeposites()
        {
            List<Deposit> deposites = new List<Deposit>();
            deposites.Add(Deposit.NullDeposit);

            try
            {
                SqlConnection connection = new SqlConnection(ConnectionString);
                SqlCommand cmd = new SqlCommand("SELECT * FROM Deposit", connection);
                connection.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    Deposit deposit = new Deposit();
                    deposit = new Deposit();
                    deposit.DepositID = Convert.ToInt32(reader["DepositID"]);
                    deposit.Name = reader["Name"].ToString();
                    deposit.Amount = Convert.ToDouble(reader["Amount"]);
                    deposit.IsDeleted = Convert.ToBoolean(reader["IsDeleted"]);
                    deposit.Created = Convert.ToDateTime(reader["Created"]);
                    deposites.Add(deposit);
                }
                connection.Close();
            }
            catch (Exception ex)
            {
                LogWriter.Write(ex, LOGFILE_NAME);
                string errmsg = "Fehler beim Abrufen der Pfandobjekte eines Profils.\n\n";
                errmsg += "DatabaseHandler.GetDeposites(profileID): " + ex.Message;
                throw new Exception(errmsg);
            }

            return deposites;
        }