Esempio n. 1
0
        public ResponseMasterDataInfo DeserializeResponseMasterDataInfo(string responseMasterDataInfo)
        {
            ResponseMasterDataInfo response= new ResponseMasterDataInfo{ MasterData = new MasterDataInfo()};
            //try 
            //{
                JObject jo = JObject.Parse(responseMasterDataInfo);
                string entityName = (string)jo["MasterData"]["EntityName"];
                string errorInfo = (string)jo["ErrorInfo"];
                response.MasterData.EntityName = entityName;
                response.ErrorInfo = errorInfo;
                string listJson = jo["MasterData"]["MasterDataItems"].ToString();
            MasterBaseDTO[] dtos = null;
                if (entityName == "Inventory")
                {
                    dtos= DeserialiseToInventoryDTOArray(listJson);
                }
                else if (entityName == "Payment")
                {
                    dtos = DeserialiseToPaymentDTOArray(listJson);
                }
                else
                {
                    dtos= DeserialiseToDTOArray(entityName, listJson);
                }
            response.MasterData.MasterDataItems = dtos;

            //}
            //catch(Exception ex)
            //{
             //   _logger.Error(ex);
            //}
            return response;
        }
Esempio n. 2
0
 public HttpResponseMessage GetEntityMasterData(Guid costCentreApplicationId, string entityName)
 {
     HttpStatusCode returnCode = HttpStatusCode.OK;
     ResponseMasterDataInfo response = new ResponseMasterDataInfo();
     try
     {
         _logger.InfoFormat("Get Entity Master Data  {0} -- {1} ", entityName, costCentreApplicationId);
          response = _masterDataResponseBuilder.GetTableContents(costCentreApplicationId, entityName);
        
     }
     catch(Exception ex)
     {
         response.ErrorInfo = ex.Message;
         returnCode=HttpStatusCode.ServiceUnavailable;
     }
     return Request.CreateResponse(returnCode, response);
 }
Esempio n. 3
0
        public ResponseMasterDataInfo DeserializeResponseMasterDataInfo(string responseMasterDataInfo)
        {
            ResponseMasterDataInfo response= new ResponseMasterDataInfo{ MasterData = new MasterDataInfo()};
            //try 
            //{
                JObject jo = JObject.Parse(responseMasterDataInfo);
                string entityName = (string)jo["MasterData"]["EntityName"];
                string errorInfo = (string)jo["ErrorInfo"];
                var datelastsyncInfo = jo["MasterData"]["LastSyncTimeStamp"];

                if (datelastsyncInfo != null && (DateTime)datelastsyncInfo > new DateTime(1900, 01, 01))
                {
                    response.MasterData.LastSyncTimeStamp = (DateTime)datelastsyncInfo;
                }
            response.MasterData.EntityName = entityName;
                response.ErrorInfo = errorInfo;
                string listJson = jo["MasterData"]["MasterDataItems"].ToString();
                List<Guid> deletedlistJson = JsonConvert.DeserializeObject<List<Guid>>(jo["DeletedItems"].ToString(), new IsoDateTimeConverter());
            MasterBaseDTO[] dtos = null;
                if (entityName == "Inventory")
                {
                    dtos= DeserialiseToInventoryDTOArray(listJson);
                }
                else if (entityName == "Payment")
                {
                    dtos = DeserialiseToPaymentDTOArray(listJson);
                }
                else if (entityName == "UnderBanking")
                {
                    dtos = DeserialiseToUnderBankingDTOArray(listJson);
                }
                else
                {
                    dtos= DeserialiseToDTOArray(entityName, listJson);
                }
            response.DeletedItems = deletedlistJson;
            response.MasterData.MasterDataItems = dtos;

            //}
            //catch(Exception ex)
            //{
             //   _logger.Error(ex);
            //}
            return response;
        }