コード例 #1
0
ファイル: UserInfoDao.cs プロジェクト: radtek/friends-c-
        int IUserInfo.GetSearchCount(KeywordView keywordView)
        {
            int    result  = 0;
            string message = string.Empty;

            string sql = string.Empty;

            sql += "select count(" + Config.Attribute.GetSqlTableNameByClassName <SimpleUserView>() + ".USER_ID) ";
            sql += " from " + Config.Attribute.GetSqlTableNameByClassName <SimpleUserView>() + " left join (select ID,ADDRESSER_ID from " + Config.Attribute.GetSqlTableNameByClassName <AddressBookInfo>();
            sql += " where (" + Config.Attribute.GetSqlColumnNameByPropertyName <AddressBookInfo, string>(o => o.MyUserID) + " = '" + keywordView.userID + "')) as TEMP_ADDRESS_BOOK_INFO  ";
            sql += " on " + Config.Attribute.GetSqlColumnNameByPropertyNameWithTable <SimpleUserView, string>(o => o.UserID) + "=TEMP_ADDRESS_BOOK_INFO." + Config.Attribute.GetSqlColumnNameByPropertyName <AddressBookInfo, string>(o => o.AddresserID);
            sql += " where  (" + Config.Attribute.GetSqlColumnNameByPropertyName <SimpleUserView, string>(o => o.UserName) + "  like  '%" + keywordView.Keyword + "%') ";
            sql += " and SIMPLE_USER_VIEW.USER_ID in (select ID from MIIC_SOCIAL_COMMON.dbo.MIIC_SOCIAL_USER where CAN_SEARCH = '" + ((int)MiicYesNoSetting.Yes).ToString() + "') ";

            try
            {
                result = dbService.GetSqlCount(sql, out message);
            }
            catch (Exception ex)
            {
                Config.IlogicLogService.Write(new LogicLog()
                {
                    AppName       = Config.AppName,
                    ClassName     = ClassName,
                    NamespaceName = NamespaceName,
                    MethodName    = MethodBase.GetCurrentMethod().Name,
                    Message       = ex.Message,
                    Oper          = Config.Oper
                });
            }
            return(result);
        }
 /// <summary>Snippet for GetKeywordView</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetKeywordViewResourceNames()
 {
     // Create client
     KeywordViewServiceClient keywordViewServiceClient = KeywordViewServiceClient.Create();
     // Initialize request argument(s)
     KeywordViewName resourceName = KeywordViewName.FromCustomerAdGroupCriterion("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[CRITERION_ID]");
     // Make the request
     KeywordView response = keywordViewServiceClient.GetKeywordView(resourceName);
 }
コード例 #3
0
 /// <summary>Snippet for GetKeywordView</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetKeywordViewResourceNames()
 {
     // Create client
     KeywordViewServiceClient keywordViewServiceClient = KeywordViewServiceClient.Create();
     // Initialize request argument(s)
     KeywordViewName resourceName = KeywordViewName.FromCustomerKeywordView("[CUSTOMER]", "[KEYWORD_VIEW]");
     // Make the request
     KeywordView response = keywordViewServiceClient.GetKeywordView(resourceName);
 }
コード例 #4
0
 /// <summary>Snippet for GetKeywordView</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetKeywordView()
 {
     // Create client
     KeywordViewServiceClient keywordViewServiceClient = KeywordViewServiceClient.Create();
     // Initialize request argument(s)
     string resourceName = "customers/[CUSTOMER]/keywordViews/[KEYWORD_VIEW]";
     // Make the request
     KeywordView response = keywordViewServiceClient.GetKeywordView(resourceName);
 }
コード例 #5
0
 /// <summary>Snippet for GetKeywordView</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetKeywordView()
 {
     // Create client
     KeywordViewServiceClient keywordViewServiceClient = KeywordViewServiceClient.Create();
     // Initialize request argument(s)
     string resourceName = "customers/[CUSTOMER_ID]/keywordViews/[AD_GROUP_ID]~[CRITERION_ID]";
     // Make the request
     KeywordView response = keywordViewServiceClient.GetKeywordView(resourceName);
 }
        /// <summary>Snippet for GetKeywordViewAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task GetKeywordViewAsync()
        {
            // Create client
            KeywordViewServiceClient keywordViewServiceClient = await KeywordViewServiceClient.CreateAsync();

            // Initialize request argument(s)
            string resourceName = "customers/[CUSTOMER]/keywordViews/[KEYWORD_VIEW]";
            // Make the request
            KeywordView response = await keywordViewServiceClient.GetKeywordViewAsync(resourceName);
        }
コード例 #7
0
        /// <summary>Snippet for GetKeywordViewAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task GetKeywordViewResourceNamesAsync()
        {
            // Create client
            KeywordViewServiceClient keywordViewServiceClient = await KeywordViewServiceClient.CreateAsync();

            // Initialize request argument(s)
            KeywordViewName resourceName = KeywordViewName.FromCustomerKeywordView("[CUSTOMER]", "[KEYWORD_VIEW]");
            // Make the request
            KeywordView response = await keywordViewServiceClient.GetKeywordViewAsync(resourceName);
        }
        /// <summary>Snippet for GetKeywordViewAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task GetKeywordViewRequestObjectAsync()
        {
            // Create client
            KeywordViewServiceClient keywordViewServiceClient = await KeywordViewServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetKeywordViewRequest request = new GetKeywordViewRequest
            {
                ResourceNameAsKeywordViewName = KeywordViewName.FromCustomerAdGroupCriterion("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[CRITERION_ID]"),
            };
            // Make the request
            KeywordView response = await keywordViewServiceClient.GetKeywordViewAsync(request);
        }
コード例 #9
0
        /// <summary>Snippet for GetKeywordViewAsync</summary>
        public async Task GetKeywordViewAsync()
        {
            // Snippet: GetKeywordViewAsync(string, CallSettings)
            // Additional: GetKeywordViewAsync(string, CancellationToken)
            // Create client
            KeywordViewServiceClient keywordViewServiceClient = await KeywordViewServiceClient.CreateAsync();

            // Initialize request argument(s)
            string resourceName = "customers/[CUSTOMER_ID]/keywordViews/[AD_GROUP_ID]~[CRITERION_ID]";
            // Make the request
            KeywordView response = await keywordViewServiceClient.GetKeywordViewAsync(resourceName);

            // End snippet
        }
コード例 #10
0
 /// <summary>Snippet for GetKeywordView</summary>
 public void GetKeywordViewRequestObject()
 {
     // Snippet: GetKeywordView(GetKeywordViewRequest, CallSettings)
     // Create client
     KeywordViewServiceClient keywordViewServiceClient = KeywordViewServiceClient.Create();
     // Initialize request argument(s)
     GetKeywordViewRequest request = new GetKeywordViewRequest
     {
         ResourceNameAsKeywordViewName = KeywordViewName.FromCustomerAdGroupCriterion("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[CRITERION_ID]"),
     };
     // Make the request
     KeywordView response = keywordViewServiceClient.GetKeywordView(request);
     // End snippet
 }
コード例 #11
0
        /// <summary>Snippet for GetKeywordViewAsync</summary>
        public async Task GetKeywordViewResourceNamesAsync()
        {
            // Snippet: GetKeywordViewAsync(KeywordViewName, CallSettings)
            // Additional: GetKeywordViewAsync(KeywordViewName, CancellationToken)
            // Create client
            KeywordViewServiceClient keywordViewServiceClient = await KeywordViewServiceClient.CreateAsync();

            // Initialize request argument(s)
            KeywordViewName resourceName = KeywordViewName.FromCustomerAdGroupCriterion("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[CRITERION_ID]");
            // Make the request
            KeywordView response = await keywordViewServiceClient.GetKeywordViewAsync(resourceName);

            // End snippet
        }
コード例 #12
0
        /// <summary>Snippet for GetKeywordViewAsync</summary>
        public async Task GetKeywordViewResourceNamesAsync()
        {
            // Snippet: GetKeywordViewAsync(KeywordViewName, CallSettings)
            // Additional: GetKeywordViewAsync(KeywordViewName, CancellationToken)
            // Create client
            KeywordViewServiceClient keywordViewServiceClient = await KeywordViewServiceClient.CreateAsync();

            // Initialize request argument(s)
            KeywordViewName resourceName = KeywordViewName.FromCustomerKeywordView("[CUSTOMER]", "[KEYWORD_VIEW]");
            // Make the request
            KeywordView response = await keywordViewServiceClient.GetKeywordViewAsync(resourceName);

            // End snippet
        }
コード例 #13
0
 /// <summary>Snippet for GetKeywordView</summary>
 public void GetKeywordViewRequestObject()
 {
     // Snippet: GetKeywordView(GetKeywordViewRequest, CallSettings)
     // Create client
     KeywordViewServiceClient keywordViewServiceClient = KeywordViewServiceClient.Create();
     // Initialize request argument(s)
     GetKeywordViewRequest request = new GetKeywordViewRequest
     {
         ResourceNameAsKeywordViewName = KeywordViewName.FromCustomerKeywordView("[CUSTOMER]", "[KEYWORD_VIEW]"),
     };
     // Make the request
     KeywordView response = keywordViewServiceClient.GetKeywordView(request);
     // End snippet
 }
コード例 #14
0
ファイル: UserInfoDao.cs プロジェクト: radtek/friends-c-
        DataTable IUserInfo.Search(KeywordView keywordView, MiicPage page)
        {
            Contract.Requires <ArgumentNullException>(keywordView != null, "参数keywordView:不能为空");
            DataTable result     = new DataTable();
            string    message    = string.Empty;
            string    sql        = string.Empty;
            string    contentSql = "select " + Config.Attribute.GetSqlTableNameByClassName <SimpleUserView>() + ".* ,TEMP_ADDRESS_BOOK_INFO.ID as ADDRESS_BOOK_ID";

            contentSql += " from " + Config.Attribute.GetSqlTableNameByClassName <SimpleUserView>() + " left join (select ID,ADDRESSER_ID from " + Config.Attribute.GetSqlTableNameByClassName <AddressBookInfo>();
            contentSql += " where (" + Config.Attribute.GetSqlColumnNameByPropertyName <AddressBookInfo, string>(o => o.MyUserID) + " = '" + keywordView.userID + "')) as TEMP_ADDRESS_BOOK_INFO  ";
            contentSql += " on " + Config.Attribute.GetSqlColumnNameByPropertyNameWithTable <SimpleUserView, string>(o => o.UserID) + "=TEMP_ADDRESS_BOOK_INFO." + Config.Attribute.GetSqlColumnNameByPropertyName <AddressBookInfo, string>(o => o.AddresserID);
            contentSql += " where (" + Config.Attribute.GetSqlColumnNameByPropertyName <SimpleUserView, string>(o => o.UserName) + "  like  '%" + keywordView.Keyword + "%') ";
            contentSql += " and SIMPLE_USER_VIEW.USER_ID in (select ID from MIIC_SOCIAL_COMMON.dbo.MIIC_SOCIAL_USER where CAN_SEARCH = '" + ((int)MiicYesNoSetting.Yes).ToString() + "') ";
            try
            {
                if (page != null)
                {
                    sql  = "with INFO_PAGE as ( select row_number()  over ( ORDER BY Temp.USER_NAME ASC) as row,Temp.* from ( ";
                    sql += contentSql;
                    sql += ") as Temp)";
                    sql += "select * from INFO_PAGE where row between " + page.pageStart + " and " + page.pageEnd;
                }
                else
                {
                    sql = contentSql;
                }
                result = dbService.querySql(sql, out message);
            }
            catch (Exception ex)
            {
                Config.IlogicLogService.Write(new LogicLog()
                {
                    AppName       = Config.AppName,
                    ClassName     = ClassName,
                    NamespaceName = NamespaceName,
                    MethodName    = MethodBase.GetCurrentMethod().Name,
                    Message       = ex.Message,
                    Oper          = Config.Oper
                });
            }
            return(result);
        }
コード例 #15
0
        public async Task GetKeywordViewAsync2()
        {
            Mock <KeywordViewService.KeywordViewServiceClient> mockGrpcClient = new Mock <KeywordViewService.KeywordViewServiceClient>(MockBehavior.Strict);
            GetKeywordViewRequest request = new GetKeywordViewRequest
            {
                ResourceName = new KeywordViewName("[CUSTOMER]", "[KEYWORD_VIEW]").ToString(),
            };
            KeywordView expectedResponse = new KeywordView
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetKeywordViewAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <KeywordView>(Task.FromResult(expectedResponse), null, null, null, null));
            KeywordViewServiceClient client = new KeywordViewServiceClientImpl(mockGrpcClient.Object, null);
            KeywordView response            = await client.GetKeywordViewAsync(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #16
0
        public void GetKeywordView2()
        {
            Mock <KeywordViewService.KeywordViewServiceClient> mockGrpcClient = new Mock <KeywordViewService.KeywordViewServiceClient>(MockBehavior.Strict);
            GetKeywordViewRequest request = new GetKeywordViewRequest
            {
                ResourceName = new KeywordViewName("[CUSTOMER]", "[KEYWORD_VIEW]").ToString(),
            };
            KeywordView expectedResponse = new KeywordView
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetKeywordView(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            KeywordViewServiceClient client = new KeywordViewServiceClientImpl(mockGrpcClient.Object, null);
            KeywordView response            = client.GetKeywordView(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #17
0
        void UpdateProjectStats()
        {
            totalKeywords             = 0;
            totalGlobalKeywords       = 0;
            totalUsedKeywords         = 0;
            totalVariants             = 0;
            totalBuildVariants        = 0;
            totalGlobalShaderFeatures = 0;

            if (shaders == null)
            {
                return;
            }

            if (keywordsDict == null)
            {
                keywordsDict = new Dictionary <string, SCKeyword>();
            }
            else
            {
                keywordsDict.Clear();
            }
            if (uniqueKeywords == null)
            {
                uniqueKeywords = new Dictionary <string, List <SCShader> >();
            }
            else
            {
                uniqueKeywords.Clear();
            }
            if (uniqueEnabledKeywords == null)
            {
                uniqueEnabledKeywords = new Dictionary <string, List <SCShader> >();
            }
            else
            {
                uniqueEnabledKeywords.Clear();
            }

            int shadersCount = shaders.Count;

            for (int k = 0; k < shadersCount; k++)
            {
                SCShader shader        = shaders[k];
                int      keywordsCount = shader.keywords.Count;
                for (int w = 0; w < keywordsCount; w++)
                {
                    SCKeyword       keyword = shader.keywords[w];
                    List <SCShader> shadersWithThisKeyword;
                    if (!uniqueKeywords.TryGetValue(keyword.name, out shadersWithThisKeyword))
                    {
                        shadersWithThisKeyword       = new List <SCShader>();
                        uniqueKeywords[keyword.name] = shadersWithThisKeyword;
                        totalKeywords++;
                        if (keyword.isGlobal)
                        {
                            totalGlobalKeywords++;
                        }
                        if (keyword.isGlobal && !keyword.isMultiCompile && keyword.enabled)
                        {
                            totalGlobalShaderFeatures++;
                        }
                        keywordsDict[keyword.name] = keyword;
                    }
                    shadersWithThisKeyword.Add(shader);
                    if (keyword.enabled)
                    {
                        List <SCShader> shadersWithThisKeywordEnabled;
                        if (!uniqueEnabledKeywords.TryGetValue(keyword.name, out shadersWithThisKeywordEnabled))
                        {
                            shadersWithThisKeywordEnabled       = new List <SCShader>();
                            uniqueEnabledKeywords[keyword.name] = shadersWithThisKeywordEnabled;
                            totalUsedKeywords++;
                        }
                        shadersWithThisKeywordEnabled.Add(shader);
                    }
                }
                totalVariants      += shader.totalVariantCount;
                totalBuildVariants += shader.actualBuildVariantCount;
            }

            if (keywordView == null)
            {
                keywordView = new List <KeywordView>();
            }
            else
            {
                keywordView.Clear();
            }
            foreach (KeyValuePair <string, List <SCShader> > kvp in uniqueEnabledKeywords)
            {
                SCKeyword kw;
                if (!keywordsDict.TryGetValue(kvp.Key, out kw))
                {
                    continue;
                }
                KeywordView kv = new KeywordView {
                    keyword = kw, shaders = kvp.Value
                };
                keywordView.Add(kv);
            }
            keywordView.Sort(delegate(KeywordView x, KeywordView y) {
                return(y.shaders.Count.CompareTo(x.shaders.Count));
            });

            // Compute which keywords in build are not present in project
            plusBuildKeywords = 0;
            if (buildKeywordView != null)
            {
                int count = buildKeywordView.Count;
                for (int k = 0; k < count; k++)
                {
                    BuildKeywordView bkv = buildKeywordView[k];
                    if (!uniqueKeywords.ContainsKey(bkv.keyword))
                    {
                        plusBuildKeywords++;
                    }
                }
            }
        }