示例#1
0
        public DC_Message SyncGeographyData(DataContracts.DC_MongoDbSyncRQ RQ)
        {
            DC_Message _msg = new DC_Message();

            try
            {
                Guid LogId = new Guid();
                IncomingWebRequestContext woc = WebOperationContext.Current.IncomingRequest;
                string strURI = null;
                using (ConsumerEntities context = new ConsumerEntities())
                {
                    var iScheduledCount = context.DistributionLayerRefresh_Log.AsNoTracking()
                                          .Where(w => (w.Status.ToUpper().Trim() == "RUNNING" || w.Status.ToUpper().Trim() == "SCHEDULED") && w.Element.ToUpper().Trim() == RQ.Element.ToUpper().Trim() && w.Type.ToUpper().Trim() == RQ.Type.ToUpper().Trim()).Count();

                    if (iScheduledCount > 0)
                    {
                        _msg.StatusMessage = RQ.Element + " " + RQ.Type + " sync has already been scheduled.";
                        _msg.StatusCode    = ReadOnlyMessage.StatusCode.Information;
                        return(_msg);
                    }
                    else
                    {
                        LogId = Guid.NewGuid();
                        _msg  = InsertDistributionLogNewEntry(LogId, RQ.Element, RQ.Type, "Scheduled", woc.Headers["CallingUser"]);
                    }
                }
                using (DHSVCProxyAsync DHP = new DHSVCProxyAsync())
                {
                    string NewElement = RQ.Element.ToUpper().Trim();
                    string newType    = RQ.Type.ToUpper().Trim();
                    if (NewElement == "HOTEL" && newType == "MAPPING")
                    {
                        strURI = string.Format(System.Configuration.ConfigurationManager.AppSettings["Load_ProductMapping"], LogId.ToString(), (Guid.Empty).ToString());
                    }
                    else if (NewElement == "HOTEL" && newType == "MAPPINGLITE")
                    {
                        strURI = string.Format(System.Configuration.ConfigurationManager.AppSettings["Load_ProductMappingLite"], LogId.ToString(), (Guid.Empty).ToString());
                    }
                    else if (NewElement == "ZONE" && newType == "MASTER")
                    {
                        strURI = string.Format(System.Configuration.ConfigurationManager.AppSettings["Load_ZoneMaster"], LogId.ToString());
                    }
                    else if (NewElement == "ZONETYPE" && newType == "MASTER")
                    {
                        strURI = string.Format(System.Configuration.ConfigurationManager.AppSettings["Load_ZoneTypeMaster"], LogId.ToString());
                    }
                    if (strURI != null)
                    {
                        DHP.GetAsync(ProxyFor.SqlToMongo, strURI);
                    }
                }
                return(_msg);
            }
            catch (Exception ex)
            {
                return(new DC_Message {
                    StatusMessage = ex.Message, StatusCode = ReadOnlyMessage.StatusCode.Failed
                });
            }
        }
示例#2
0
 public DC_Message SyncGeographyData(DataContracts.DC_MongoDbSyncRQ RQ)
 {
     using (DataLayer.DL_MongoPush obj = new DataLayer.DL_MongoPush())
     {
         return(obj.SyncGeographyData(RQ));
     }
 }
示例#3
0
 public DC_Message SyncGeographyData(DataContracts.DC_MongoDbSyncRQ RQ)
 {
     using (BusinessLayer.BL_RefreshDistributionData obj = new BL_RefreshDistributionData())
     {
         return(obj.SyncGeographyData(RQ));
     }
 }