Exemplo n.º 1
0
    private List <MultiLanguageInput> ConstructMultiLanguageInputList(long mlIdentifierValue)
    {
        List <MultiLanguageInput> tempMLIList = new List <MultiLanguageInput>();
        MultiLanguageInput        mli         = null;
        SQLParametersList         paramsList  = new SQLParametersList();
        string query = "SELECT L.LanguageID, L.Name, L.MSNetCode, L.JavaLocaleCode, L.PhraseTerm, L.RightToLeftText, T." + MLColumnName + " AS Translation " +
                       " FROM Languages AS L LEFT JOIN " + MLTableName + " AS T ON T.LanguageID=L.LanguageID AND T." + MLITranslationColumn + "=@MLIdentifierValue " +
                       " WHERE L.LanguageID in (SELECT TLV.LanguageID FROM TransLanguagesCF_UE AS TLV) " +
                       " ORDER BY CASE WHEN L.LanguageID=1 THEN 1 ELSE 2 END, L.LanguageID;";

        paramsList.Add("@MLIdentifierValue", System.Data.SqlDbType.BigInt).Value = mlIdentifierValue;
        DataTable dt = dbAccess.ExecuteQuery(DataBases.LogixRT, System.Data.CommandType.Text, query, paramsList);

        foreach (DataRow row in dt.Rows)
        {
            mli            = new MultiLanguageInput();
            mli.LanguageID = Convert.ToInt32(row["LanguageID"]);
            if (mli.LanguageID == CustomerFacingLangID)
            {
                mli.Translation = MLDefaultLanguageStandardValue;
            }
            else
            {
                mli.Translation = row["Translation"].ToString();
            }
            mli.Name            = (this.Page as AuthenticatedUI).PhraseLib.Lookup(row["PhraseTerm"].ToString(), defaultLanguageId);
            mli.MSNetCode       = row["MSNetCode"].ToString();
            mli.JavaLocaleCode  = row["JavaLocaleCode"].ToString();
            mli.PhraseTerm      = row["PhraseTerm"].ToString();
            mli.RightToLeftText = row["RightToLeftText"].ToString();
            mli.IdentifierValue = mlIdentifierValue;
            tempMLIList.Add(mli);
        }
        return(tempMLIList);
    }
Exemplo n.º 2
0
    private int GetLanguageId(string javaLocalcode)
    {
        int langaugeId = 0;

        m_logger.WriteInfo("getting language id for given java local code");
        string            query     = "select LanguageID  from languages where JavaLocaleCode=@JavaLocaleCode and InstalledForUI=1";
        SQLParametersList paramlist = new SQLParametersList();

        paramlist.Add("@JavaLocaleCode", SqlDbType.NVarChar, 10).Value = javaLocalcode;
        DataTable dt = m_dbaccess.ExecuteQuery(DataBases.LogixRT, CommandType.Text, query, paramlist);

        if (dt.Rows.Count > 0)
        {
            langaugeId = Convert.ToInt32(dt.Rows[0]["LanguageID"]);
        }
        return(langaugeId);
    }
    public string GetNotificationList(bool enableRestrictedAccessToUEOB = false, string conditionalQuery = "", bool IsStoreUser = false, string ValidLocIDs = "", string ValidSU = "", int LanguageId = 1, int PageNum = 1, int MaxRecords = 8)
    {
        string            queryStr     = "";
        string            joinStr      = "";
        string            whereStr     = "";
        SQLParametersList sqlParams    = new SQLParametersList();
        DataTable         ds           = new DataTable();
        string            returnString = "";

        //Coverity CID - 93931, 93926, 93923
        if (IsStoreUser)
        {
            //sqlParams = new SQLParametersList();
            sqlParams.Add("@ValidLocIDs", SqlDbType.VarChar).Value = ValidLocIDs;

            //sqlParams = new SQLParametersList();
            sqlParams.Add("@ValidSU", SqlDbType.VarChar).Value = ValidSU;

            joinStr  = "Inner Join OfferLocUpdate olu with (NoLock) on Table1.OfferID=olu.OfferID ";
            whereStr = " where (LocationID in (@ValidLocIDs) or (CreatedByAdminID in (@ValidSU) and Isnull(LocationID,0)=0)) ";
        }

        queryStr = "SELECT * FROM (select ROW_NUMBER() OVER ( ORDER BY Date, Event ) AS NUMBER, Table1.OfferID, Date, Event, CreatedByAdminID from ( " +
                   "select OfferID, ProdStartDate as Date, 'starts' as Event, CreatedByAdminID " +
                   "from Offers as O with (NoLock) " +
                   "where Deleted = 0 and isnull(isTemplate,0) = 0 and ProdStartDate = CONVERT(datetime, CONVERT(varchar, GETDATE(), 103), 103) " +
                   "union " +
                   "select OfferID, ProdEndDate as Date, 'ends' as Event, CreatedByAdminID " +
                   "from Offers as O with (NoLock) " +
                   "where Deleted = 0 and isnull(isTemplate, 0) = 0 and ProdEndDate = CONVERT(datetime, CONVERT(varchar, GETDATE(), 103), 103) " +
                   "union " +
                   "select IncentiveID as OfferID, StartDate as Date, 'starts' as Event, CreatedByAdminID " +
                   "from CPE_Incentives as I with (NoLock) " +
                   "where Deleted=0 and isnull(isTemplate,0)=0 and StartDate=CONVERT(datetime, CONVERT(varchar, GETDATE(), 103), 103) ";
        if (enableRestrictedAccessToUEOB && !String.IsNullOrEmpty(conditionalQuery))
        {
            //sqlParams = new SQLParametersList();
            sqlParams.Add("@conditionalQuery", SqlDbType.VarChar).Value = conditionalQuery;
            queryStr += "@conditionalQuery ";
        }

        queryStr += "union " +
                    "select IncentiveID as OfferID, EndDate as Date, 'ends' as Event, CreatedByAdminID " +
                    "from CPE_Incentives as I with (NoLock) " +
                    "where Deleted=0 and isnull(isTemplate,0)=0 and EndDate=CONVERT(datetime, CONVERT(varchar, GETDATE(), 103), 103) ";
        if (enableRestrictedAccessToUEOB && !String.IsNullOrEmpty(conditionalQuery))
        {
            //sqlParams = new SQLParametersList();
            sqlParams.Add("@conditionalQuery2", SqlDbType.VarChar).Value = conditionalQuery;
            queryStr += "@conditionalQuery2 ";
        }

        //sqlParams = new SQLParametersList();
        sqlParams.Add("@joinStr", SqlDbType.VarChar).Value = joinStr;

        //sqlParams = new SQLParametersList();
        sqlParams.Add("@whereStr", SqlDbType.VarChar).Value = whereStr;

        //sqlParams = new SQLParametersList();
        sqlParams.Add("@PageNum", SqlDbType.Int).Value = PageNum;

        //sqlParams = new SQLParametersList();
        sqlParams.Add("@MaxRecords", SqlDbType.Int).Value = MaxRecords;

        queryStr += ") as Table1 @joinStr @whereStr) AS A WHERE NUMBER BETWEEN ((@PageNum - 1) * @MaxRecords + 1) AND (@PageNum * @MaxRecords) ORDER BY Date, Event Desc";
        if (joinStr == "")
        {
            queryStr = queryStr.Replace("@joinStr", "");
        }
        if (whereStr == "")
        {
            queryStr = queryStr.Replace("@whereStr", "");
        }

        ds = m_dbAccess.ExecuteQuery(DataBases.LogixRT, CommandType.Text, queryStr, sqlParams);
        foreach (DataRow row in ds.Rows)
        {
            if (row["Event"].ToString().Equals("starts", StringComparison.InvariantCultureIgnoreCase))
            {
                returnString += ConstructOutputString(row["OfferID"].ConvertToInt32(), IsShaded, true, LanguageId);
            }
            else
            {
                returnString += ConstructOutputString(row["OfferID"].ConvertToInt32(), IsShaded, false, LanguageId);
            }
            IsShaded = !IsShaded;
        }
        return(returnString);
    }