public DC_Message SyncMLAPIData(DC_Distribution_MLDataRQ _obj) { using (DataLayer.DL_GetRefreshDistributionLog obj = new DataLayer.DL_GetRefreshDistributionLog()) { return(obj.SyncMLAPIData(_obj)); } }
//public void PushMasterAccoData() //{ // object result = null; // ServiceConnection.MDMSvcProxy.GetData(string.Format(ConfigurationManager.AppSettings["PushMasterAccoData"]), typeof(String), out result); //} //public void PushMasterAccoRoomFacilityData() //{ // object result = null; // ServiceConnection.MDMSvcProxy.GetData(string.Format(ConfigurationManager.AppSettings["PushMasterAccoRoomFacilityData"]), typeof(String), out result); //} //public void PushMasterAccoRoomInfoData() //{ // object result = null; // ServiceConnection.MDMSvcProxy.GetData(string.Format(ConfigurationManager.AppSettings["PushMasterAccoRoomInfoData"]), typeof(String), out result); //} //public void PushRoomTypeMatchingData() //{ // object result = null; // ServiceConnection.MDMSvcProxy.GetData(string.Format(ConfigurationManager.AppSettings["PushRoomTypeMatchingData"]), typeof(String), out result); //} //public void PushSupplierAccoData() //{ // object result = null; // ServiceConnection.MDMSvcProxy.GetData(string.Format(ConfigurationManager.AppSettings["PushSupplierAccoData"]), typeof(String), out result); //} //public void PushSupplierAccoRoomData() //{ // object result = null; // ServiceConnection.MDMSvcProxy.GetData(string.Format(ConfigurationManager.AppSettings["PushSupplierAccoRoomData"]), typeof(String), out result); //} //public void PushSupplierAccoRoomExtedAttrData() //{ // object result = null; // ServiceConnection.MDMSvcProxy.GetData(string.Format(ConfigurationManager.AppSettings["PushSupplierAccoRoomExtedAttrData"]), typeof(String), out result); //} public DC_Message PushSyncMLAPIData(DC_Distribution_MLDataRQ _obj) { object result = null; ServiceConnection.MDMSvcProxy.PostData(ConfigurationManager.AppSettings["PushSyncMLAPIData"], _obj, typeof(DC_Distribution_MLDataRQ), typeof(DC_Message), out result); return(result as DC_Message); }
private DC_Message InsertDistributionLogNewEntryForMLDataAPI(DC_Distribution_MLDataRQ obj) { DC_Message msg = new DC_Message(); try { using (ConsumerEntities context = new ConsumerEntities()) { IncomingWebRequestContext woc = WebOperationContext.Current.IncomingRequest; string CallingAgent = woc.Headers["CallingAgent"]; string CallingUser = woc.Headers["CallingUser"]; DataLayer.DistributionLayerRefresh_Log objNew = new DistributionLayerRefresh_Log(); objNew.Id = (obj.Logid ?? Guid.NewGuid()); objNew.Element = obj.Element.Trim(); objNew.Type = obj.Type.Trim(); objNew.Create_Date = DateTime.Now; objNew.Create_User = CallingUser; objNew.Status = obj.Status; context.DistributionLayerRefresh_Log.Add(objNew); context.SaveChanges(); msg.StatusCode = ReadOnlyMessage.StatusCode.Success; msg.StatusMessage = "Sync has been scheduled successfully."; } } catch (Exception) { throw; } return(msg); }
public DC_Message SyncMLAPIData(DC_Distribution_MLDataRQ _obj) { using (BusinessLayer.BL_RefreshDistributionData obj = new BusinessLayer.BL_RefreshDistributionData()) { return(obj.SyncMLAPIData(_obj)); } }
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); }