Ejemplo n.º 1
0
        //*********************************************************************
        ///
        /// <summary>
        ///
        /// </summary>
        /// <param name="tagId"></param>
        ///
        //*********************************************************************

        public void DeleteRequestByTagId(int tagId)
        {
            var outList = new List <Models.Request>();

            try
            {
                using (var db = new Models.AzureFileTransferContext())
                {
                    db.Database.Connection.ConnectionString = _ConnectionString;

                    var foundReqList = from rb in db.Requests
                                       where rb.TagID == tagId
                                       select rb;

                    foreach (var req in foundReqList)
                    {
                        db.Requests.Remove(req);
                    }

                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Exception in AftsDb.DeleteRequestByTagId() : "
                                    + Utilities.UnwindExceptionMessages(ex));
            }
        }
Ejemplo n.º 2
0
        //*********************************************************************
        ///
        /// <summary>
        ///
        /// </summary>
        /// <param name="transferRequest"></param>
        /// <param name="db"></param>
        ///
        //*********************************************************************

        public void InsertTransferRequest(Models.Request transferRequest,
                                          Models.AzureFileTransferContext db)
        {
            try
            {
                db.Database.Connection.ConnectionString = _ConnectionString;
                db.Requests.Add(transferRequest);
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                throw new Exception("Exception in AftsDb.InsertTransferRequest() : "
                                    + Utilities.UnwindExceptionMessages(ex));
            }
        }
Ejemplo n.º 3
0
        //*********************************************************************
        ///
        /// <summary>
        ///
        /// </summary>
        /// <param name="reqId"></param>
        /// <returns></returns>
        ///
        //*********************************************************************

        public Models.Request FetchRequest(int reqId)
        {
            try
            {
                using (var db = new Models.AzureFileTransferContext())
                {
                    db.Database.Connection.ConnectionString = _ConnectionString;

                    var foundReq = (from rb in db.Requests
                                    where rb.RequestID == reqId
                                    select rb).First();

                    return(foundReq);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Exception in AftsDb.FetchRequest() : "
                                    + Utilities.UnwindExceptionMessages(ex));
            }
        }
Ejemplo n.º 4
0
        //*********************************************************************
        ///
        /// <summary>
        ///
        /// </summary>
        /// <param name="transferRequest"></param>
        /// <param name="db"></param>
        ///
        //*********************************************************************

        public void ResubmitTransferRequest(Models.Request transferRequest,
                                            Models.AzureFileTransferContext db)
        {
            try
            {
                db.Database.Connection.ConnectionString = _ConnectionString;

                var foundReq = (from rb in db.Requests
                                where rb.RequestID == transferRequest.RequestID
                                select rb).First();

                foundReq.ResultStatusCode = "Submitted";
                foundReq.AgentName        = null;

                db.SaveChanges();
            }
            catch (Exception ex)
            {
                throw new Exception("Exception in AftsDb.ResubmitTransferRequest() : "
                                    + Utilities.UnwindExceptionMessages(ex));
            }
        }
Ejemplo n.º 5
0
        //*********************************************************************
        ///
        /// <summary>
        ///
        /// </summary>
        /// <param name="db"></param>
        /// <returns></returns>
        ///
        //*********************************************************************

        public int FetchMaxRequestId(Models.AzureFileTransferContext db)
        {
            try
            {
                db.Database.Connection.ConnectionString = _ConnectionString;

                var maxId = (from rb in db.Requests
                             select rb.RequestID).Max();

                return(maxId);
            }
            catch (InvalidOperationException)
            {
                return(0);
            }
            catch (Exception ex)
            {
                return(0);

                //throw new Exception("Exception in AftsDb.FetchMaxRequestID() : "
                //    + Utilities.UnwindExceptionMessages(ex));
            }
        }
Ejemplo n.º 6
0
        //*********************************************************************
        ///
        /// <summary>
        ///
        /// </summary>
        /// <param name="tagId"></param>
        /// <returns></returns>
        ///
        //*********************************************************************

        public List <Models.Request> FetchRequestByTagId(int tagId)
        {
            var outList = new List <Models.Request>();

            try
            {
                using (var db = new Models.AzureFileTransferContext())
                {
                    db.Database.Connection.ConnectionString = _ConnectionString;

                    var foundReqList = (from rb in db.Requests
                                        where rb.TagID == tagId
                                        select rb);

                    outList.AddRange(foundReqList);
                    return(outList);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Exception in AftsDb.FetchRequestByTagID() : "
                                    + Utilities.UnwindExceptionMessages(ex));
            }
        }