Esempio n. 1
0
        /// <summary>
        /// Get the next available request.
        /// </summary>
        /// <returns>The next available request. If no more request is available, null will be returned.</returns>
        public FoeRequester GetNextRequest()
        {
            FoeRequester req = null;

            // check if we are currently connected to DB
            if ((_conn != null) && (_conn.State != System.Data.ConnectionState.Open))
            {
                _conn.Close();
            }

            LoadRequests();

            // Load request messages
            while (_reader.Read())
            {
                req                = new FoeRequester();
                req.Id             = (int)FoeServerDb.GetInt32(_reader, "Id");
                req.Type           = _requestType;
                req.UserEmail      = FoeServerDb.GetString(_reader, "UserEmail");
                req.RequestId      = FoeServerDb.GetString(_reader, "RequestId");
                req.ProcessorEmail = FoeServerDb.GetString(_reader, "ProcessorEmail");
                req.RequestMessage = FoeServerDb.GetString(_reader, "RequestMessage");
                req.DtReceived     = (DateTime)FoeServerDb.GetDateTime(_reader, "DtReceived");
                req.DtProcessed    = null;
                req.Status         = FoeServerDb.GetString(_reader, "Status");
            }

            return(req);
        }
Esempio n. 2
0
 public void UpdateRequestStatus(FoeRequester req, string status)
 {
     try
     {
         // Update the status of a request
         SqlConnection conn = FoeServerDb.OpenDb();
         SqlCommand    cmd  = conn.CreateCommand();
         cmd.CommandText = "update Requests set Status=@status, DtProcessed=@dtProcessed where Id=@id";
         cmd.Parameters.Add("@status", System.Data.SqlDbType.NChar, 1);
         cmd.Parameters.Add("@dtProcessed", System.Data.SqlDbType.DateTime);
         cmd.Parameters.Add("@id", System.Data.SqlDbType.Int);
         cmd.Prepare();
         cmd.Parameters["@status"].Value      = status;
         cmd.Parameters["@dtProcessed"].Value = DateTime.Now;
         cmd.Parameters["@id"].Value          = req.Id;
         cmd.ExecuteNonQuery();
         conn.Close();
     }
     catch (Exception except)
     {
         throw except;
     }
 }
 public void UpdateRequestStatus(FoeRequester req, string status)
 {
     try
     {
         // Update the status of a request
         SqlConnection conn = FoeServerDb.OpenDb();
         SqlCommand cmd = conn.CreateCommand();
         cmd.CommandText = "update Requests set Status=@status, DtProcessed=@dtProcessed where Id=@id";
         cmd.Parameters.Add("@status", System.Data.SqlDbType.NChar, 1);
         cmd.Parameters.Add("@dtProcessed", System.Data.SqlDbType.DateTime);
         cmd.Parameters.Add("@id", System.Data.SqlDbType.Int);
         cmd.Prepare();
         cmd.Parameters["@status"].Value = status;
         cmd.Parameters["@dtProcessed"].Value = DateTime.Now;
         cmd.Parameters["@id"].Value = req.Id;
         cmd.ExecuteNonQuery();
         conn.Close();
     }
     catch (Exception except)
     {
         throw except;
     }
 }
        /// <summary>
        /// Get the next available request.
        /// </summary>
        /// <returns>The next available request. If no more request is available, null will be returned.</returns>
        public FoeRequester GetNextRequest()
        {
            FoeRequester req = null;

            // check if we are currently connected to DB
            if ((_conn != null) && (_conn.State != System.Data.ConnectionState.Open))
            {
                _conn.Close();
            }

            LoadRequests();

            // Load request messages
            while (_reader.Read())
            {
                req = new FoeRequester();
                req.Id = (int)FoeServerDb.GetInt32(_reader, "Id");
                req.Type = _requestType;
                req.UserEmail = FoeServerDb.GetString(_reader, "UserEmail");
                req.RequestId = FoeServerDb.GetString(_reader, "RequestId");
                req.ProcessorEmail = FoeServerDb.GetString(_reader, "ProcessorEmail");
                req.RequestMessage = FoeServerDb.GetString(_reader, "RequestMessage");
                req.DtReceived = (DateTime)FoeServerDb.GetDateTime(_reader, "DtReceived");
                req.DtProcessed = null;
                req.Status = FoeServerDb.GetString(_reader, "Status");

            }

            return req;
        }