Exemple #1
0
 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);
     }
 }
Exemple #2
0
        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
                });
            }
        }
Exemple #3
0
        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);
            }
        }
Exemple #4
0
        public DC_Message SyncActivityBySupplier(Guid log_id, Guid supplier_id, string CreatedBy)
        {
            try
            {
                Guid   LogId;
                string SupplierName = string.Empty;
                using (ConsumerEntities context = new ConsumerEntities())


                {
                    var iScheduledCount = (from dlr in context.DistributionLayerRefresh_Log
                                           where (dlr.Status == "Scheduled" || dlr.Status == "Running") && dlr.Element == "Activities" && dlr.Type == "Mapping"
                                           select true).Count();

                    if (iScheduledCount > 0)
                    {
                        return(new DC_Message {
                            StatusMessage = "Supplier Static Activity Data 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     = "Activities";
                        objNew.Type        = "Mapping";
                        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();

                        SupplierName = (from x in context.Supplier
                                        where x.Supplier_Id == supplier_id
                                        select x.Name).FirstOrDefault();
                    }
                    if (log_id == Guid.Empty)
                    {
                        using (DHSVCProxyAsync DHP = new DHSVCProxyAsync())
                        {
                            if (SupplierName != string.Empty)
                            {
                                string strURI = string.Format(System.Configuration.ConfigurationManager.AppSettings["Load_ActivityFlavourBySupplier"], LogId.ToString(), SupplierName);
                                DHP.GetAsync(ProxyFor.SqlToMongo, strURI);
                            }
                        }
                    }
                    else
                    {
                        //Code goes here for Indert Update or Delete of a specific country
                    }

                    return(new DC_Message {
                        StatusMessage = "Supplier Activity Data  sync has been scheduled successfully.", StatusCode = ReadOnlyMessage.StatusCode.Success
                    });
                }
            }
            catch (Exception ex)
            {
                return(new DC_Message {
                    StatusMessage = ex.Message, StatusCode = ReadOnlyMessage.StatusCode.Failed
                });
            }
        }
Exemple #5
0
        public DC_Message SyncCountryMaster(Guid Country_Id, string CreatedBy)
        {
            try
            {
                Guid LogId;

                using (ConsumerEntities context = new ConsumerEntities())

                {
                    var iScheduledCount = (from dlr in context.DistributionLayerRefresh_Log
                                           where dlr.Status == "Scheduled" && dlr.Element == "Country" && dlr.Type == "Master"
                                           select true).Count();

                    if (iScheduledCount > 0)
                    {
                        return(new DC_Message {
                            StatusMessage = "CountryMaster 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     = "Country";
                        objNew.Type        = "Master";
                        objNew.Create_Date = DateTime.Now;
                        objNew.Create_User = CreatedBy;// System.Web.HttpContext.Current.User.Identity.Name;
                        objNew.Status      = "Scheduled";
                        context.DistributionLayerRefresh_Log.Add(objNew);
                        context.SaveChanges();
                    }


                    if (Country_Id == Guid.Empty)
                    {
                        using (DHSVCProxyAsync DHP = new DHSVCProxyAsync())
                        {
                            string strURI = string.Format(System.Configuration.ConfigurationManager.AppSettings["Load_CountryMaster"], LogId.ToString());
                            DHP.GetAsync(ProxyFor.SqlToMongo, strURI);
                        }
                    }
                    else
                    {
                        //Code goes here for Indert Update or Delete of a specific country
                    }


                    return(new DC_Message {
                        StatusMessage = "CountryMaster sync has been scheduled successfully.", StatusCode = ReadOnlyMessage.StatusCode.Success
                    });
                }
            }
            catch (Exception ex)
            {
                return(new DC_Message {
                    StatusMessage = ex.Message, StatusCode = ReadOnlyMessage.StatusCode.Failed
                });
            }
        }
Exemple #6
0
        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);
        }