小编Ano*_*shi的帖子

使用linq选择distinct

我有班级班级

public class LinqTest
{
public int id { get; set; }
public string value { get; set; }
}


List<LinqTest> myList = new List<LinqTest>();
myList.Add(new LinqTest() { id = 1, value = "a" });
myList.Add(new LinqTest() { id = 1, value = "b" });
myList.Add(new LinqTest() { id = 2, value = "c" });
Run Code Online (Sandbox Code Playgroud)

我只需从该列表中选择不同的id.即,我的结果列表应该只包含

[{id=1,value="a"},{ id = 2, value = "c" }]
Run Code Online (Sandbox Code Playgroud)

我怎么能用linq做到这一点?

编辑

输入,

id      value
1        a
1        b
2        c
3        d
3        e
Run Code Online (Sandbox Code Playgroud)

出来应该是, …

c# linq class list

233
推荐指数
4
解决办法
62万
查看次数

循环遍历c#中的json数组

我有一个json字符串,

{"objectType" : "Subscriber", "objectList":[{"firstName":"name1","email":"email@example.com","address":"exampleAddress"},{"firstName":"name2","email":"email2@example.com","address":"exampleAddress2"}]}
Run Code Online (Sandbox Code Playgroud)

我需要在我的C#代码中解析它.我试过了,

JavaScriptSerializer json_serializer = new JavaScriptSerializer();
object routes_list = json_serializer.DeserializeObject(myjson here);
Run Code Online (Sandbox Code Playgroud)

但我无法循环"objectList"数组.怎么做?

c# parsing json

16
推荐指数
1
解决办法
6万
查看次数

jquery ui对话框确认

我正在尝试使用jquery对话框复制javascript的"确认"框.这是我的代码,

function customConfirm(customMessage) {
        $("#popUp").html(customMessage);
        $("#popUp").dialog({
            resizable: false,
            height: 240,
            modal: true,
            buttons: {
                "OK": function () {
                    $(this).dialog("close");
                    alert(true);
                    return true;
                },
                Cancel: function () {
                    $(this).dialog("close");
                    alert(false);
                    return false;
                }
            }
        });
    }
Run Code Online (Sandbox Code Playgroud)

但是当我试图提醒这个方法时,它会显示"未定义".它不是在等待弹出窗口显示.如何使这个customConfirm功能等待用户输入(确定/取消)?我需要的是,customConfirm()方法将根据用户输入返回true或false.

javascript jquery jquery-ui-dialog

5
推荐指数
2
解决办法
1万
查看次数

反应原生的 Firebase 电子商务分析

我正在尝试将一些电子商务数据记录到 Firebase 分析中,我正在使用这些事件来记录,

view_item_list、add_to_cart、begin_checkout、add_payment_info、购买等。

我可以在仪表板上找到这些日志,但是我找不到任何包含这些数据的电子商务报告。我错过了什么吗?我是否应该在 Firebase 控制台上配置任何内容才能查看电子商务报告?

这些是我记录的示例对象。

 let item_jeggings: any = {
  item_id: 'SKU_123',
  item_name: 'jeggings',
  item_category: 'pants',
  item_variant: 'black',
  item_brand: 'Google',
  price: 9.99
};
    let item_boots: any = {
  item_id: 'SKU_456',
  item_name: 'boots',
  item_category: 'shoes',
  item_variant: 'brown',
  item_brand: 'Google',
  price: 24.99
};
const params1 = {
  item_list_id: 'L001',
  item_list_name: 'Related products',
  items: [item_jeggings, item_boots]
};
analytics().logEvent('view_item_list', params1);
Run Code Online (Sandbox Code Playgroud)

事件可以很好地登录到控制台。但是我在哪里可以找到电子商务分析?

编辑

Firebase 中目前似乎没有查看电子商务报告的选项。由于我们可以将 firebase 项目与 google analytics & google analytcs 联系起来,我们可以使用 google analytics 查看通过 Firebase 记录的电子商务报告吗?

如果没有,在本机应用程序中记录/查看电子商务报告的最佳方式是什么?

在此处输入图片说明

analytics google-analytics firebase react-native firebase-analytics

5
推荐指数
1
解决办法
680
查看次数

在包含条件的sql中内连接

我有2张这样的桌子,

表格1

Id     Locations
--     ---------
1      India, Australia
2      US , UK 
Run Code Online (Sandbox Code Playgroud)

表2

Table2Id    Location
--------    --------
101         Italy
102         UK
103         Hungary
104         India
Run Code Online (Sandbox Code Playgroud)

我需要在条件内连接这两个表,如果Locations在table2中包含Locationtable1 中的 字段.结果就像

Id   Table2Id    Location     Locations
--   --------    --------     ---------
1     104        India        India, Australia
2     102        UK           US , UK 
Run Code Online (Sandbox Code Playgroud)

我试过类似的东西

Select t1.id,
       t2.Table2Id,
       t1.Locations,
       t2.Location
From Table1 t1 
Inner join Table2 t2 On CONTAINS(t1.Locations, t2.Location)
Run Code Online (Sandbox Code Playgroud)

但第二个参数contains应该是一个字符串.它不允许在那里给出列名.

我不能在查询中使用temptablevariable.因为此查询需要ExactTarget在不支持temptable和支持的电子邮件广告系列工具上运行 …

sql contains inner-join exacttarget

3
推荐指数
1
解决办法
9671
查看次数

如何获取包装元素内具有类名的当前元素的索引

这是 HTML,

<div id="wraper">
    <div>
        <div class="test">1</div>
    </div>
    <div>
        <div class="test">2</div>
    </div>
    <div>
        <div class="test">3</div>
    </div>
    <div>
        <div class="test">4</div>
    </div>
    <div>
        <div class="test">5</div>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

$("#wraper").find(".test").eq(2);这样就会选择test里面的第3类wraper

我需要eq()在单击.testdiv 时获取该索引(我已将其作为参数传递给 )。

当我单击带有类名的 div 时test,我需要获取该 div 内该 div 的索引wraper

$(".test").click(function() {
    alert($(this).index());
});
Run Code Online (Sandbox Code Playgroud)

此代码将始终返回 0,因为该testdiv 有一个父 div。所以如果我使用$(this).parent().index(),它将返回正确的索引。

还有其他替代方法可以做到这一点吗?因为在我的真实场景中可能会有多个级别的父母。

小提琴

html jquery

2
推荐指数
1
解决办法
1380
查看次数

通过选择单选按钮使文本更大胆

我是jquery的新手,我应该做一个简单的任务.如果我点击单选按钮意味着文本和那个单选按钮必须加粗.请帮助我这个.我的HTML标记在这里

<form role="form">
    <p><b>What concerns you most as you manage your business?</b>(Select all that apply.)</p>
    <div class="radio active">
        <label>
            <input type="radio" name="optradio">IT infrastructure alignment with business goals and growth<img /></label>
    </div>
    <div class="radio">
        <label>
            <input type="radio" name="optradio">Controlling capital and expense<img /></label>
    </div>
    <div class="radio">
        <label>
            <input type="radio" name="optradio">Managing financial risk<img /></label>
    </div>
    <div class="radio">
        <label>
            <input type="radio" name="optradio">Data security and privacy<img /></label>
    </div>
    <div class="radio">
        <label>
            <input type="radio" name="optradio">Flexibility of services to meet customer needs<img /></label>
    </div>
    <div class="radio">
        <label> …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery

2
推荐指数
2
解决办法
381
查看次数

无需 SDK 即可响应本机支付网关

我正在使用 react native 做一个电子商务应用程序。我们需要集成一个支付网关,它似乎没有用于反应本机(ADCB)的 SDK。我应该如何处理这个问题?

我可以继续使用自定义选项卡吗?如果是这样,付款完成后如何关闭自定义选项卡?


url = 'https://www.example.com/newsagepay/newtest.php?&customerSage='+isuerID+'&checkSage=1';

CustomTabs.openURL(url,{ toolbarColor: '#607D8B',enableUrlBarHiding: true, showPageTitle: true, enableDefaultShare: true, 
animations: ANIMATIONS_SLIDE}).then((launched: boolean) => {                                                        
    console.log(`Launched custom tabs: ${launched}`);
}).catch(err => {
    console.error(err)
});  
Run Code Online (Sandbox Code Playgroud)

payment payment-gateway react-native

1
推荐指数
1
解决办法
630
查看次数

评分不是函数jquery插件错误

我有一个jsp页面。在那我正在尝试jquery星级。我正在使用此插件http://www.fyneworks.com/jquery/star-rating/。但是JS错误像TypeError一样来了:$(...)。rating不是函数这是我的JSP代码。

<div class="book-right" id="ajaxTest">
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/jquery.rating.js"></script>
    <script type="text/javascript" src="js/jquery-latest.js"></script>
    <script type="text/javascript" src="js/jquery.tablesorter.js"></script>
    <script type="text/javascript" src="js/jquery.tablesorter.min.js"></script>
    <--table + some intermediate loop code --->
        <c:forEach var="leg" items="${option.legs}" varStatus="loopCounter3">
            <div>
                <input type="radio" name="rating-${loopCounter2.index}" value="1" class="rating-star" />
                <input type="radio" name="rating-${loopCounter2.index}" value="2" class="rating-star" />
                <input type="radio" name="rating-${loopCounter2.index}" value="3" class="rating-star" />
                <input type="radio" name="rating-${loopCounter2.index}" value="4" class="rating-star" />
                <input type="radio" name="rating-${loopCounter2.index}" value="5" class="rating-star" />
            </div>
            <input type="hidden" id="avgRating" name="avgRating" value="${leg.courierProduct.rating}"></input>

            <script>
                var avgRating = $('#avgRating').val();
                $('.rating-star').rating('select', avgRating);
            </script>
        </c:forEach>
</div>
Run Code Online (Sandbox Code Playgroud)

我删除了一些JSP代码以使其变得简单。

javascript jquery jsp jquery-plugins

0
推荐指数
1
解决办法
3140
查看次数