Ejemplo n.º 1
0
        // ISPLATI BANKA
        public static string IsplatiBanka(int sumaUplata, int buildingNo, string ticketNo, string comment)
        {
            //   DataTable
            int          numberApt = 0; int Income = 0; DateTime dateIncomeFor = DateTime.Now; DateTime dateNow = DateTime.Now;
            string       query = null;
            transactions saldo = getSaldo(buildingNo);

            try
            {
                conn.Open();


                int    vtor    = 0;
                float  Isplata = 0;
                string Kasa    = "kasa";



                query = string.Format("INSERT INTO transactions VALUES ('{0}', '{1}', '{2}', '{3}', '{4}',  '{5}' ,'{6}',  '{7}' ,  '{8}' ,  '{9}' ,  '{10}' ,  '{11}',  '{12}' ,  '{13}' ,  '{14}')", numberApt, buildingNo, Income, vtor, ticketNo, dateIncomeFor, dateNow, saldo.Budget, comment, vtor, vtor, Isplata, vtor, saldo.BudgetBank + saldo.Budget - sumaUplata, saldo.BudgetBank - sumaUplata);
                command.CommandText = query;                                                                                 //   int Stan, int Uplata , DateTimeOffset date ,int Building, string Komentar)
                command.ExecuteNonQuery();
                return("Успешна исплата од банка");
            }
            finally
            {
                conn.Close();
            }
        }
Ejemplo n.º 2
0
        //get last numbers in db table.
        public static transactions getSaldo(int buildingNo)
        {
            double       Budget     = 0.0;
            double       BankBudget = 0.0;
            double       AllBudget  = 0.0;
            transactions trans      = new transactions();
            string       query1     = string.Format("SELECT * FROM transactions WHERE building =  '{0}'", buildingNo);

            try
            {
                conn.Open();
                command.CommandText = query1;
                SqlDataReader reader = command.ExecuteReader();

                while (reader.Read())
                {
                    Budget     = reader.GetDouble(8);
                    BankBudget = reader.GetDouble(15);
                    AllBudget  = reader.GetDouble(14);
                }
            }
            finally
            {
                trans.Budget     = Budget;
                trans.BudgetBank = BankBudget;
                conn.Close();
            }
            return(trans);
        }