Beispiel #1
0
        private DEBusinessUnitURLDevice GetBusinessUnitFromDB(string[] url)
        {
            DEBusinessUnitURLDevice BusinessUnitURLDeviceEntity = new DEBusinessUnitURLDevice();
            string cacheString = null;

            //Loop backwards through the length of the array
            for (int i = url.Length - 1; i >= 0; i += -1)
            {
                cacheString = GetNextURLString(url, i);
                TalentDataObjects tDataObjects = new TalentDataObjects();
                tDataObjects.Settings = GetBasicSettingsObject(false);
                System.Data.DataTable dt = tDataObjects.AppVariableSettings.TblUrlBu.GetBUByURL(cacheString);
                if (dt.Rows.Count > 0)
                {
                    if (!Utilities.CheckForDBNull_Boolean_DefaultFalse(dt.Rows[0]["DISABLED"]))
                    {
                        BusinessUnitURLDeviceEntity.BusinessUnit      = dt.Rows[0]["BUSINESS_UNIT"].ToString();
                        BusinessUnitURLDeviceEntity.BusinessUnitGroup = Utilities.CheckForDBNull_String(dt.Rows[0]["BU_GROUP"]);
                        BusinessUnitURLDeviceEntity.DeviceType        = Utilities.CheckForDBNull_String(dt.Rows[0]["DEVICE_TYPE"]);
                        BusinessUnitURLDeviceEntity.URL      = Utilities.CheckForDBNull_String(dt.Rows[0]["URL"]);
                        BusinessUnitURLDeviceEntity.URLGroup = Utilities.CheckForDBNull_String(dt.Rows[0]["URL_GROUP"]);
                        //todo call ecom module defaults data object for the given bu to get queue url
                        Data.Cache.Add("BU" + cacheString, BusinessUnitURLDeviceEntity, CacheTimeInMins);
                        return(BusinessUnitURLDeviceEntity);
                    }
                }
            }
            return(BusinessUnitURLDeviceEntity);
        }
Beispiel #2
0
        private DEAgent GetAgentEntity(string cacheDependencyPath)
        {
            DEAgent agentEntity = new DEAgent();

            if (!String.IsNullOrEmpty(Data.Session.SessionId) && Data.Session.Get("Agent") != null && Data.Session.Get("Agent").ToString().Trim().Length > 0)
            {
                TalentDataObjects talDataObject = new TalentDataObjects();
                DESettings        settings      = new DESettings();
                settings.FrontEndConnectionString = FrontEndConnectionString;
                settings.CacheDependencyPath      = cacheDependencyPath;
                settings.DestinationDatabase      = GlobalConstants.SQL2005DESTINATIONDATABASE;
                talDataObject.Settings            = settings;

                DataTable dtTblAgent = talDataObject.AgentSettings.TblAgent.GetByAgentName(Data.Session.SessionId, Data.Session.Get("Agent").ToString());
                if (dtTblAgent != null && dtTblAgent.Rows.Count > 0)
                {
                    agentEntity.AgentUsername      = Data.Validation.CheckForDBNull_String(dtTblAgent.Rows[0]["AGENT_NAME"]);
                    agentEntity.AgentType          = Data.Session.Get("AgentType").ToString();
                    agentEntity.Department         = Data.Validation.CheckForDBNull_String(dtTblAgent.Rows[0]["DEPARTMENT"]).Trim();
                    agentEntity.PrinterNameDefault = Data.Validation.CheckForDBNull_String(dtTblAgent.Rows[0]["PRINTER_NAME_DEFAULT"]);
                    agentEntity.BulkSalesMode      = Data.Validation.CheckForDBNull_Boolean_DefaultFalse(dtTblAgent.Rows[0]["BULK_SALES_MODE"]);
                }
                else
                {
                    if (!Url.ToLower().Contains("agentlogin.aspx?logout=expired"))
                    {
                        Data.Session.Remove("Agent");
                        Data.Session.Add("IsAgentProfileEmpty", true);
                        HttpContext.Current.Response.Redirect("~/PagesPublic/Agent/AgentLogin.aspx?logout=expired");
                    }
                }
            }
            return(agentEntity);
        }
        /// <summary>
        /// Get the default values for a particular templare
        /// </summary>
        /// <param name="templateID"></param>
        /// <returns>A DefaultValues object</returns>
        private DefaultValues GetDefaultValues(int templateID)
        {
            TimeSpan          timeSpan       = DateTime.Now.TimeOfDay;
            DefaultValues     def            = new DefaultValues();
            TalentDataObjects talDataObjects = new TalentDataObjects();
            string            cacheKey       = "ActivityTemplateDefaults" + Talent.Common.Utilities.FixStringLength("MAINTENANCE", 50) + Talent.Common.Utilities.FixStringLength("*ALL", 50);

            talDataObjects.Settings = businessObjects.Environment.Settings.GetBasicSettingsObject();
            DataTable defaults = talDataObjects.ActivitiesSettings.TblActivityTemplatesDefaults.GetDefaultsByTemplateID(templateID);

            if (Talent.Common.TalentThreadSafe.ItemIsInCache(cacheKey))
            {
                def = (DefaultValues)businessObjects.Data.Cache.Get(cacheKey);
            }
            else
            {
                try
                {
                    if (defaults.Rows.Count > 0)
                    {
                        def = PopulateDefaults(def, defaults);
                    }
                }
                catch (Exception ex)
                {
                }
                //Add to cache now
                businessObjects.Data.Cache.Add(cacheKey, def, businessObjects.Environment.Settings.CacheTimeInMins);
            }
            businessObjects.Logging.LoadTestLog("ActivityTemplateDefaults.cs", "GetDefaultValuesByTemplateID", timeSpan);
            return(def);
        }
        private List <CustomerSearch.Clubs> GetClubDetails(CustomerSearchInputModel inputModel)
        {
            TalentDataObjects dataObjects = new TalentDataObjects();

            dataObjects.Settings = Environment.Settings.DESettings;
            List <CustomerSearch.Clubs> clubs = new List <CustomerSearch.Clubs>();

            DataTable partnerClub = dataObjects.ClubSettings.GetPartnerUserClubByAgentTypeLoginID(inputModel.AgentType, inputModel.AgentLoginID);

            if (partnerClub.Rows.Count > 0)
            {
                clubs = Data.PopulateObjectListFromTable <CustomerSearch.Clubs>(dataObjects.ClubSettings.GetTblClubDetailsByAgentType(inputModel.AgentType));
            }
            return(clubs);
        }
Beispiel #5
0
        public String GetPartner()
        {
            string            partner      = "*ALL";
            TalentDataObjects tDataObjects = new TalentDataObjects();

            tDataObjects.Settings = GetBasicSettingsObject();
            //string sesh = Data.Session.SessionId.ToString();
            long      basketHeaderID = tDataObjects.BasketSettings.TblBasketHeader.GetHeaderByBasketSessionID(Data.Session.SessionId.ToString(), BusinessUnit);
            DataTable dt             = tDataObjects.BasketSettings.TblBasketHeader.GetHeaderByBasketHeaderID(basketHeaderID.ToString());

            if (dt != null && dt.Rows.Count > 0)
            {
                if (Utilities.CheckForDBNull_String(dt.Rows[0]["PARTNER"]) != string.Empty)
                {
                    partner = dt.Rows[0]["PARTNER"].ToString();
                }
            }
            return(partner);
        }
Beispiel #6
0
        private string GetCurrentPageName()
        {
            string path = GetAbsolutePath();

            System.IO.FileInfo  oInfo       = new System.IO.FileInfo(path);
            string              sRet        = oInfo.Name;
            string              saveRet     = sRet;
            NameValueCollection queryString = HttpContext.Current.Request.QueryString;

            if (!sRet.EndsWith(".aspx"))
            {
                //This assumes the page name is being retreieved from a webmethod such as: "VisualSeatSelection.aspx/GetSeating"
                //We need the page name "VisualSeatSelection.aspx" and not the method name "GetSeating"
                sRet = oInfo.Directory.Name;
            }
            switch (sRet.ToUpper())
            {
            case "USERDEFINED.ASPX":
                sRet = sRet + "?";
                string[] pageCodeQueryKeys = DefaultValues.UserDefinedPageQueryKeys.Split(';');
                if (pageCodeQueryKeys != null && pageCodeQueryKeys.Length > 0)
                {
                    for (int arrIndex = 0; arrIndex <= pageCodeQueryKeys.Length - 1; arrIndex++)
                    {
                        foreach (string queryKey in queryString.AllKeys)
                        {
                            if (pageCodeQueryKeys[arrIndex].ToLower() == queryKey.ToLower())
                            {
                                sRet = sRet + queryKey + "=" + queryString[queryKey] + "&";
                                break;     // TODO: might not be correct. Was : Exit For
                            }
                        }
                    }
                }
                sRet = sRet.TrimEnd('&');
                break;

            case "PRODUCTHOME.ASPX":
                if (!(string.IsNullOrEmpty(queryString["ProductSubType"])))
                {
                    sRet = sRet + "?" + "ProductSubType=" + queryString["ProductSubType"].ToUpper();
                }
                break;

            case "PRODUCTSEASON.ASPX":
                if (!(string.IsNullOrEmpty(queryString["ProductSubType"])))
                {
                    sRet = sRet + "?" + "ProductSubType=" + queryString["ProductSubType"].ToUpper();
                }
                break;

            case "PRODUCTAWAY.ASPX":
                if (!(string.IsNullOrEmpty(queryString["ProductSubType"])))
                {
                    sRet = sRet + "?" + "ProductSubType=" + queryString["ProductSubType"].ToUpper();
                }
                break;

            case "PRODUCTEVENT.ASPX":
            case "PRODUCTTRAVEL.ASPX":
                if (!(string.IsNullOrEmpty(queryString["ProductSubType"])))
                {
                    sRet = sRet + "?" + "ProductSubType=" + queryString["ProductSubType"].ToUpper();
                }
                break;

            case "PRODUCTMEMBERSHIP.ASPX":
                if (!(string.IsNullOrEmpty(queryString["ProductSubType"])))
                {
                    sRet = sRet + "?" + "ProductSubType=" + queryString["ProductSubType"].ToUpper();
                }
                break;
            }

            //Validate that a page exists if we have added a query string for product groups
            if (saveRet != sRet && sRet.ToUpper() != "USERDEFINED.ASPX")
            {
                TalentDataObjects tDataObjects = new TalentDataObjects();
                tDataObjects.Settings = GetBasicSettingsObject();
                DataTable dt = tDataObjects.PageSettings.TblPage.GetByPageCode(sRet, BusinessUnit);
                if (dt == null || dt.Rows.Count == 0)
                {
                    sRet = saveRet;
                }
            }

            return(sRet);
        }