예제 #1
0
        /// <summary>
        /// method to add Request PDF uri to Request entity
        /// </summary>
        /// <param name="urivalue">takes temp blob uri as input</param>
        public void AddPDFUriToRequest(Uri urivalue, string userID, string RequestID)
        {
            //Get Caller Method name
            string callerMethodName = string.Empty;

            try
            {
                //Get Caller Method name from CallerInformation class
                callerMethodName = CallerInformation.TrackCallerMethodName();
                //call dataprovider method to get entities from azure table
                RequsetEntity updateEntity = DataProvider.Retrieveentity <RequsetEntity>(CoreConstants.AzureTables.RequestTransactions, string.Concat(CoreConstants.AzureTables.RequestsPK, userID), RequestID);
                //check for null
                if (updateEntity != null)
                {
                    // Add the PDFUri.
                    updateEntity.PDFUri = urivalue.ToString();
                    //call dataprovider method to update entity to azure table
                    DataProvider.UpdateEntity <RequsetEntity>(CoreConstants.AzureTables.RequestTransactions, updateEntity);
                }
            }
            catch (Exception exception)
            {
                //write exception into application insights
                InsightLogger.Exception(exception.Message + " - Error while updating request update PDF uri into request entitty in DAL", exception, callerMethodName);
                throw new DataAccessException();
            }
        }
예제 #2
0
        /// <summary>
        /// BL method to add request entity into azure table
        /// </summary>
        /// <param name="request">takes request as input</param>
        public void AddUpdateRequest(BackendRequest backendrequest, string UserID, string backendId)
        {
            //Get Caller Method name
            string callerMethodName = string.Empty;

            try
            {
                //Get Caller Method name from CallerInformation class
                callerMethodName = CallerInformation.TrackCallerMethodName();
                RequestUpdateDAL requestupdatedal = new RequestUpdateDAL();
                //get the request to update
                RequsetEntity existingrequest = requestupdatedal.GetRequest(string.Concat(CoreConstants.AzureTables.RequestsPK, UserID), backendrequest.RequestsList.ID);
                //if request exists update otherwise craete new request
                if (existingrequest != null)
                {
                    existingrequest.Created         = backendrequest.RequestsList.Created;
                    existingrequest.LastUpdate      = DateTime.Now;
                    existingrequest.Status          = backendrequest.RequestsList.Status;
                    existingrequest.Title           = backendrequest.RequestsList.Title;
                    existingrequest.UpdateTriggered = false;
                    //calling DAL method to update request entity
                    requestupdatedal.AddUpdateRequest(existingrequest);
                }
                else
                {
                    //generating request entity from input request obj by adding partitionkey and rowkey
                    RequsetEntity requestentity = DataProvider.ResponseObjectMapper <RequsetEntity, Request>(backendrequest.RequestsList);
                    requestentity.PartitionKey = string.Concat(CoreConstants.AzureTables.RequestsPK, UserID);
                    requestentity.RowKey       = backendrequest.RequestsList.ID;
                    //adding service layer requestid to entity
                    requestentity.ServiceLayerReqID = backendrequest.ServiceLayerReqID;
                    requestentity.BackendID         = backendId;
                    requestentity.UpdateTriggered   = false;
                    requestentity.LastUpdate        = DateTime.Now;
                    //add requester deatils to request entity
                    if (backendrequest.RequestsList.Requester != null)
                    {
                        requestentity.RequesterID   = backendrequest.RequestsList.Requester.UserID;
                        requestentity.RequesterName = backendrequest.RequestsList.Requester.Name;
                    }
                    //calling DAL method to add request entity
                    requestupdatedal.AddUpdateRequest(requestentity);
                }
            }
            catch (DataAccessException DALexception)
            {
                throw DALexception;
            }
            catch (Exception exception)
            {
                //write exception into application insights
                InsightLogger.Exception(exception.Message + " - Error in BL while inserting request", exception, callerMethodName);
                throw new BusinessLogicException();
            }
        }
예제 #3
0
        /// <summary>
        /// method to add/upadte Request entity to azure table
        /// </summary>
        /// <param name="request">takes request entity as input</param>
        public void AddUpdateRequest(RequsetEntity request)
        {
            //Get Caller Method name
            string callerMethodName = string.Empty;

            try
            {
                //Get Caller Method name from CallerInformation class
                callerMethodName = CallerInformation.TrackCallerMethodName();
                //call dataprovider method to insert entity into azure table
                DataProvider.InsertReplaceEntity <RequsetEntity>(CoreConstants.AzureTables.RequestTransactions, request);
            }
            catch (Exception exception)
            {
                //write exception into application insights
                InsightLogger.Exception(exception.Message + " - Error while inserting request into requestTransactions azure table in DAL", exception, callerMethodName);
                throw new DataAccessException();
            }
        }