Esempio n. 1
0
        // Log the Transactions
        public bool OracleTransactionLog(CAR_USER_VIEW carUserBlocked, CAR_USER_VIEW carUserBlocker, car_request id)
        {
            try
            {
                //Mail & SMS to Blocker


                using (MySqlConnection connection = new MySqlConnection("SERVER = localhost ; DATABASE= Oracledb ; UID= root ; PASSWORD=;Charset=utf8;"))
                {
                    string sql =
                        "INSERT INTO `CAR_LOG` (`CAR_REQUEST_ID`,`CAR_NOTIFICATION_ID`,`BLOCKED_USER`,`BLOCKER_USER`,`REQUEST_DATE`) " +
                        "VALUES(@CAR_REQUEST_ID , @CAR_NOTIFICATION_ID , @BLOCKED_USER , @BLOCKER_USER , @REQUEST_DATE)";

                    connection.Open();

                    using (MySqlCommand cmd = new MySqlCommand(sql, connection))
                    {
                        cmd.Parameters.AddWithValue("@CAR_REQUEST_ID", 123); // Need To be Changed
                        cmd.Parameters.AddWithValue("@CAR_NOTIFICATION_ID", 7357);
                        cmd.Parameters.AddWithValue("@BLOCKED_USER", carUserBlocked.CAR_USERNAME ?? " ");
                        cmd.Parameters.AddWithValue("@BLOCKER_USER", carUserBlocked.CAR_USERNAME ?? " ");
                        cmd.Parameters.AddWithValue("@REQUEST_DATE", DateTime.Now);
                        //Execute command
                        cmd.ExecuteNonQuery();
                    }

                    return(true);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public bool Notification(CAR_USER_VIEW carUserBlocked, string notificationMsg, car_request req)
        {
            try
            {
                //Mail & SMS to Blocker
                car_notification notification = new car_notification
                {
                    MOBILE_ID        = "",
                    NOTIFICATION_MSG = notificationMsg,
                    REQUEST_ID       = req.ID
                };
                //notification.car_request = "";
                MySqldb.car_notification.Add(notification);
                MySqldb.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
                //throw;
            }
        }