public DC_Message SyncSupplierStaticHotel(Guid log_id, Guid supplier_Id, string CreatedBy) { try { Guid LogId; using (ConsumerEntities context = new ConsumerEntities()) { var iScheduledCount = (from dlr in context.DistributionLayerRefresh_Log where (dlr.Status == "Scheduled" || dlr.Status == "Running") && dlr.Element == "Hotels" && dlr.Type == "Static" select true).Count(); if (iScheduledCount > 0) { return(new DC_Message { StatusMessage = "Supplier Static Hotel sync has already been scheduled.", StatusCode = ReadOnlyMessage.StatusCode.Information }); } else { LogId = Guid.NewGuid(); DataLayer.DistributionLayerRefresh_Log objNew = new DistributionLayerRefresh_Log(); objNew.Id = LogId; objNew.Element = "Hotels"; objNew.Type = "Static"; objNew.Create_Date = DateTime.Now; objNew.Create_User = CreatedBy;// System.Web.HttpContext.Current.User.Identity.Name; objNew.Status = "Scheduled"; objNew.Supplier_Id = supplier_Id; objNew.Edit_Date = DateTime.Now; objNew.Edit_User = CreatedBy; context.DistributionLayerRefresh_Log.Add(objNew); context.SaveChanges(); } if (log_id == Guid.Empty) { using (DHSVCProxyAsync DHP = new DHSVCProxyAsync()) { string strURI = string.Format(System.Configuration.ConfigurationManager.AppSettings["Load_SupplierStaticHotels"], LogId.ToString(), supplier_Id.ToString()); DHP.GetAsync(ProxyFor.SqlToMongo, strURI); } } else { //Code goes here for Indert Update or Delete of a specific country } return(new DC_Message { StatusMessage = "Supplier Static Hotel sync has been scheduled successfully.", StatusCode = ReadOnlyMessage.StatusCode.Success }); } } catch (Exception ex) { return(new DC_Message { StatusMessage = ex.Message, StatusCode = ReadOnlyMessage.StatusCode.Failed }); } }
public DC_Message SyncHotelRoomTypeMapping(Guid LogId, Guid Supplier_Id) { try { using (ConsumerEntities context = new ConsumerEntities()) { var iScheduledCount = (from dlr in context.DistributionLayerRefresh_Log where (dlr.Status == "Scheduled" || dlr.Status == "Running") && dlr.Element.ToUpper() == "ROOMTYPE" && dlr.Type.ToUpper() == "MAPPING" select true).Count(); if (iScheduledCount > 0) { return(new DC_Message { StatusMessage = "RoomType Mapping sync has already been scheduled.", StatusCode = ReadOnlyMessage.StatusCode.Information }); } } using (DHSVCProxyAsync DHP = new DHSVCProxyAsync()) { string strURI = string.Format(System.Configuration.ConfigurationManager.AppSettings["Load_RoomTypeMapping"], LogId.ToString(), Supplier_Id.ToString()); DHP.GetAsync(ProxyFor.SqlToMongo, strURI); } return(new DC_Message { StatusMessage = "RoomType Mapping sync has been scheduled successfully.", StatusCode = ReadOnlyMessage.StatusCode.Success }); } catch (Exception ex) { return(new DC_Message { StatusMessage = ex.Message, StatusCode = ReadOnlyMessage.StatusCode.Failed }); } }
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 }); } }
public void SyncActivityFlavour(Guid Activity_Flavour_id) { if (Activity_Flavour_id != Guid.Empty) { DHSVCProxyAsync DHP = new DHSVCProxyAsync(); string strURI = string.Format(System.Configuration.ConfigurationManager.AppSettings["Sync_Activity_Flavour"], Convert.ToString(Activity_Flavour_id)); DHP.GetAsync(ProxyFor.SqlToMongo, strURI); } }
public DC_Message SyncAccommodationMaster(Guid LogId, Guid Accommodation_Id, string CreatedBy) { if ((Accommodation_Id == Guid.Empty && LogId == Guid.Empty) || (Accommodation_Id != Guid.Empty && LogId != Guid.Empty)) { return(new DC_Message { StatusMessage = "Invalid Request.", StatusCode = ReadOnlyMessage.StatusCode.Warning });; } try { if (Accommodation_Id == Guid.Empty && LogId != Guid.Empty) { using (ConsumerEntities context = new ConsumerEntities()) { var iScheduledCount = (from dlr in context.DistributionLayerRefresh_Log where (dlr.Status == "Scheduled" || dlr.Status == "Running") && dlr.Element.ToUpper() == "ACCOMMODATION" && dlr.Type.ToUpper() == "MASTER" select true).Count(); if (iScheduledCount > 0) { return(new DC_Message { StatusMessage = "Accommodation master sync has already been scheduled.", StatusCode = ReadOnlyMessage.StatusCode.Information }); } } } using (DHSVCProxyAsync DHP = new DHSVCProxyAsync()) { string strURI = string.Format(System.Configuration.ConfigurationManager.AppSettings["Load_AccommodationMaster"], LogId.ToString(), Accommodation_Id.ToString()); DHP.GetAsync(ProxyFor.SqlToMongo, strURI); } return(new DC_Message { StatusMessage = "Accommodation master sync has been scheduled successfully.", StatusCode = ReadOnlyMessage.StatusCode.Success }); } catch (Exception ex) { return(new DC_Message { StatusMessage = ex.Message, StatusCode = ReadOnlyMessage.StatusCode.Failed }); } }
public DC_Message SyncHotelMappingLite(Guid ProdMap_Id) { DC_Message _msg = new DC_Message(); if (ProdMap_Id != Guid.Empty) { DHSVCProxyAsync DHP = new DHSVCProxyAsync(); string strURI = string.Format(System.Configuration.ConfigurationManager.AppSettings["Load_ProductMappingLite"], (Guid.Empty).ToString(), Convert.ToString(ProdMap_Id)); DHP.GetAsync(ProxyFor.SqlToMongo, strURI); return(_msg); } else { DC_MongoDbSyncRQ param = new DC_MongoDbSyncRQ(); param.Element = "Hotel"; param.Type = "MappingLite"; _msg = SyncGeographyData(param); return(_msg); } }
public DC_Message SyncMLAPIData(DC_Distribution_MLDataRQ _obj) { DC_Message _msg = new DC_Message(); try { 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() == _obj.Element.Trim().ToUpper() && w.Type.ToUpper().Trim() == _obj.Type.Trim().ToUpper()).Count(); if (iScheduledCount > 0) { _msg.StatusMessage = GetMessageFromObjElemet(_obj.Element) + "sync has already been scheduled."; _msg.StatusCode = ReadOnlyMessage.StatusCode.Information; return(_msg); } else { Guid logid = Guid.NewGuid(); _obj.Logid = logid; _msg = InsertDistributionLogNewEntryForMLDataAPI(_obj); _msg.StatusMessage = GetMessageFromObjElemet(_obj.Element) + _msg.StatusMessage; string strURI = string.Empty; string baseAddress = Convert.ToString(OperationContext.Current.Host.BaseAddresses[0]); //Get URI for Element and Entity Type if (_obj.Element.Trim().ToUpper() == "MLDATAMASTERACCO" && _obj.Type.Trim().ToUpper() == "MASTER") { strURI = string.Format(baseAddress + System.Configuration.ConfigurationManager.AppSettings["MLSVCURL_DataApi_MasterAccommodationRecord"] + logid.ToString()); } else if (_obj.Element.Trim().ToUpper() == "MLDATAMASTERACCORMFACILITY" && _obj.Type.Trim().ToUpper() == "MASTER") { strURI = string.Format(baseAddress + System.Configuration.ConfigurationManager.AppSettings["MLSVCURL_DataApi_MasterAccommodationRoomFacilities"] + logid.ToString()); } else if (_obj.Element.Trim().ToUpper() == "MLDATAMASTERACCORMINFO" && _obj.Type.Trim().ToUpper() == "MASTER") { strURI = string.Format(baseAddress + System.Configuration.ConfigurationManager.AppSettings["MLSVCURL_DataApi_MasterAccommodationRoomInfo"] + logid.ToString()); } else if (_obj.Element.Trim().ToUpper() == "MLDATAROOMTYPEMATCHING" && _obj.Type.Trim().ToUpper() == "MAPPING") { strURI = string.Format(baseAddress + System.Configuration.ConfigurationManager.AppSettings["MLSVCURL_DataApi_RoomTypeMatching"] + logid.ToString()); } else if (_obj.Element.Trim().ToUpper() == "MLDATASUPPLIERACCO" && _obj.Type.Trim().ToUpper() == "MAPPING") { strURI = string.Format(baseAddress + System.Configuration.ConfigurationManager.AppSettings["MLSVCURL_DataApi_SupplierAccommodationData"] + logid.ToString()); } else if (_obj.Element.Trim().ToUpper() == "MLDATASUPPLIERACCORM" && _obj.Type.Trim().ToUpper() == "MAPPING") { strURI = string.Format(baseAddress + System.Configuration.ConfigurationManager.AppSettings["MLSVCURL_DataApi_SupplierAccommodationRoomData"] + logid.ToString()); } else if (_obj.Element.Trim().ToUpper() == "MLDATASUPPLIERACCORMEXTATTR" && _obj.Type.Trim().ToUpper() == "MAPPING") { strURI = string.Format(baseAddress + System.Configuration.ConfigurationManager.AppSettings["MLSVCURL_DataApi_SupplierAccommodationRoomExtendedAttributes"] + logid.ToString()); } using (DHSVCProxyAsync DHP = new DHSVCProxyAsync()) { DHP.GetAsync(ProxyFor.MachingLearningDataTransfer, strURI); } } } } catch (Exception) { throw; } return(_msg); }