Exemplo n.º 1
0
        public void depositmoney(decimal amount, int cartNumber)
        {
            string     query      = "update BankAccounts set Balance = Balance + @currnetbalance where CardNumber=@cartNumber";
            SqlCommand sqlCommand = new SqlCommand();

            sqlCommand.CommandText = query;

            sqlCommand.Parameters.AddWithValue("@currnetbalance", amount);
            sqlCommand.Parameters.AddWithValue("@cartNumber", cartNumber);
            DataAccesLayer dal = new DataAccesLayer();

            try
            {
                dal.connctionOpen();
                dal.queryExecution(sqlCommand);
                dal.connctionClosed();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }


            MessageBox.Show("WPŁACONO " + amount.ToString() + " zł na konto");
        }
Exemplo n.º 2
0
        public string addCustomer()
        {
            string     query      = "insert into Customers values(@name, @surname,@phone,@Addres, @personaLID)";
            SqlCommand sqlCommand = new SqlCommand();

            sqlCommand.CommandText = query;
            sqlCommand.Parameters.AddWithValue("@name", this.Name);
            sqlCommand.Parameters.AddWithValue("@surname", this.Surname);
            sqlCommand.Parameters.AddWithValue("@phone", this.PhoneNumber);
            sqlCommand.Parameters.AddWithValue("@Addres", this.Address);
            sqlCommand.Parameters.AddWithValue("@personaLID", this.PersonalID);
            DataAccesLayer dal = new DataAccesLayer();

            try
            {
                dal.connctionOpen();
                dal.queryExecution(sqlCommand);
                dal.connctionClosed();
            }
            catch (Exception e)
            {
                return(e.ToString());
            }


            return("Customer Inserted");
        }