精华内容
下载资源
问答
  • list取值

    2018-07-31 23:03:00
    切片适用于---list和string 转载于:https://www.cnblogs.com/pengwa1226/p/9398829.html

    切片适用于---list和string

     

     

     

     

     

    转载于:https://www.cnblogs.com/pengwa1226/p/9398829.html

    展开全文
  • python字典和list取值

    2021-04-25 14:44:45
    python字典和list取值 如果是字典类型取值: dict[‘name’]即可 如果是list类型里面还有字典取值: item遍历list再取值

    python字典和list取值

    如果是字典类型取值:
    在这里插入图片描述
    dict[‘name’]即可

    如果是list类型里面还有字典取值:
    在这里插入图片描述
    item遍历list再取值

    展开全文
  • CheckBoxList取值与初始化 很经典的代码 public static string SetChecked(CheckBoxList checkList,string selval,string separator) { selval = separator + selval + separator; //例如:"0,1,1,2

    CheckBoxList取值与初始化 很经典的代码

     public static string SetChecked(CheckBoxList checkList,string selval,string separator)
             {
                 selval = separator + selval + separator;        //例如:"0,1,1,2,1"->",0,1,1,2,1,"
                 for(int i=0; i<checkList.Items.Count; i++)
                 {
                     checkList.Items[i].Selected = false;
                     string val = separator + checkList.Items[i].Value + separator;
                     if(selval.IndexOf(val)!=-1)
                     {
                         checkList.Items[i].Selected = true;
                         selval = selval.Replace(val,separator);        //然后从原来的值串中删除已经选中了的
                        if(selval == separator)        //selval的最后一项也被选中的话,此时经过Replace后,只会剩下一个分隔符
                        {        
                             selval += separator;        //添加一个分隔符
                        }
                     }
                 }
                 selval = selval.Substring(1,selval.Length-2);        //除去前后加的分割符号
                return selval;
             }
    
            /// <summary>
             /// 得到CheckBoxList中选中了的值
            /// </summary>
             /// <param name="checkList">CheckBoxList</param>
             /// <param name="separator">分割符号</param>
             /// <returns></returns>
             public static string GetChecked(CheckBoxList checkList, string separator)
             {
                 string selval = "";
                 for(int i=0;i<checkList.Items.Count;i++)
                 {
                     if(checkList.Items[i].Selected)
                     {
                         selval += checkList.Items[i].Value + separator;
                     }
                 }
                 return selval;
             }
             protected void Button1_Click(object sender, EventArgs e)
             {
                 string str;
                 str = GetChecked(this.CheckBoxList1, ",");
                 this.TextBox1.Text = str;
                 SetChecked(this.CheckBoxList2, str, ",");
             }

    转至http://www.cnblogs.com/shawker/archive/2009/03/17/1414795.html

    展开全文
  • list取值多选填入文本框 <td> @Html.Kendo().MultiSelectFor(m => m.Repair_ByName).DefaultOptions().DataSource(ds => ds.Read("GeRecordEmp", "Repair")) @Html.ValidationMessageFor(m => m....

    list取值多选填入文本框

      <td>
                            @Html.Kendo().MultiSelectFor(m => m.Repair_ByName).DefaultOptions().DataSource(ds => ds.Read("GeRecordEmp", "Repair"))
                            @Html.ValidationMessageFor(m => m.Repair_ByName)
                        </td>
    
        //取维修人员信息
            public ActionResult GeRecordEmp()
            {
                using (var handler = new RepairHandler())
                {
                    return Json(handler.GetAllRecordEmp().Select(x => new SelectListItem()
                    {
                        Text = x.Name,
                        Value = x.Id.ToString(),
                    }), JsonRequestBehavior.AllowGet);
                }
            }
         public List<Account> GetAllRecordEmp()
            {
                var getList = (from x in db.ACCOUNT
                               where x.DELETEFLAG == 0
                               select new Account
                               {
                                   Id = x.ID,                           
                                   Name = x.NAME                               
                               }).ToList();
                return getList;
            }
    

    取值入文本框后怎么在文本框进行jquery取值
    MultiSelectFor

    Join使用

       public List<DataKeyValue> GetDepartmentAndUserList()
            {
    
                var list = (from d in db.DEPARTMENT.AsEnumerable()
                            join a in db.ACCOUNT on d.ID equals a.DEPARTMENTID
                            select new DataKeyValue
                            {
                                key = d.DEPARTMENTNAME,
                                value = a.ACCOUNT1
                            }).ToList();
                return list;
            }
    

    join使用

            //取维修领料对应的设备备品清单
            public List<EMS.Models.CallRepair> getRepairGIInfo(int page, int pageSize, string sCallNO)
            {
                var getList = (from ERB in db.EMS_R_BEGIN.Where(x => x.BEGIN_REPAIR_NO == sCallNO)
                               join ER_CD in db.EMS_R_CALL_DEFECT on ERB.CALL_REPAIR_NO equals ER_CD.CALL_REPAIR_NO into a
                               from ERCD in a.DefaultIfEmpty()
                               join M_H in db.MACHINE on ERCD.MACHINE_ID equals M_H.ID into b
                               from MH in b.DefaultIfEmpty()
                               join ES_BH in db.EMS_SYS_BOM_HEAD.Where(s => s.PLANT_ID == UserSession.Plant.Id) on MH.PARTNO equals ES_BH.BOM_PART into c
                               //join ES_BH in db.EMS_SYS_BOM_HEAD on new { MH.PARTNO,ERB.PLANTID} equals new { ES_BH.BOM_PART,ES_BH.PLANT_ID} into c
                               from ESBH in c.DefaultIfEmpty()
                               join ES_BT in db.EMS_SYS_BOM_ITEM.Where(t => t.QTY > 0) on ESBH.ID equals ES_BT.BOM_ID into d
                               from ESBT in d.DefaultIfEmpty()
                               join S_P in db.SYS_PART on ESBT.PART_NO equals S_P.PART_NO into e
                               from SP in e.DefaultIfEmpty()
                               join G_ST in db.G_SUP_STORE.Where(t => t.PART_ID != null) on SP.ID equals G_ST.PART_ID into f
                               from GST in f.DefaultIfEmpty()  
                               join G_SUO in db.G_SUP_USE_ORDER.Where(t => t.DOC_NO != null) on ERB.BEGIN_REPAIR_NO equals G_SUO.DOC_NO into g
                               from GSUO in g.DefaultIfEmpty()
                               join G_SUP in db.G_SUP_USE_PART  on new { GSUO.USENO,SP.PART_NO }  equals  new { USENO= G_SUP.USE_NO,G_SUP.PART_NO} into h
                               from GSUP in h.DefaultIfEmpty()
                               select new CallRepair
                               {
    
                                   Begin_Repair_No = ERB.BEGIN_REPAIR_NO,
                                   MachineNo = MH.CUSTODYNO,
                                   BomPartNo = ESBH.BOM_PART,
                                   PartNo = ESBT.PART_NO,
                                   PartDesc = SP.PART_DESC,
                                   StoreCode = GST.STORE_CODE,
                                   StoreQty = GST.QUANTITY,
                                   Unit = SP.UNIT,
                                   ReqQty = ESBT.QTY,
                                   GiQty = GSUP.QTY
    
                               }).OrderBy(x => x.Begin_Repair_No).ToList();
                return getList;
            }
    1、sql语句:
    select * from Users u join Teachers t on u.UserID==t.TeacherID and u.Name=t.Name
    2、linq写法:
    1)、方法一:
    将多个字段的比较,new 一个对象进行比较;
    注意:对象的属性名要保持一致;
    
    var userInfos = from u in db.Users join t in db.Teachers on new { u.UserID , u.Name } equals new { UserID = t.TeacherID,t.Name } select new { ID=u.UserID, t.Name };
    2)、方法二:
    
    var userInfos = from u in db.Users from t in db.Teachers where u.UserID == t.TeacherID && u.Name == t.Name select new { ID=u.UserID, t.Name };
    
    
    
    

    josn值返回

    columns.Bound(c => c.Begin_Repair_No).ClientTemplate("<a href='" + Url.Action("RepairGIEdit") + "/#=Id#'>#=Begin_Repair_No#</a>").Filterable(true).Width(130);
            columns.Bound(c => c.WorkCenter).Width(80);
            columns.Bound(c => c.Begin_ByName).Filterable(false).Sortable(false).Width(100);
            columns.Bound(c => c.Begin_Time).Filterable(false).Sortable(false).Width(130);
            columns.Bound("").ClientTemplate("<a href='" + Url.Action("RTOrderGIList", Html.ControllerName()) + "?strOrderNumber=#=Begin_Repair_No#'>领料单信息</a>").Width(60).Filterable(false);
            })
            .DefaultOptions()
            .Filterable(f => f.Enabled(true))
            .DataSource(dataSource => dataSource
            .Ajax()
            .Batch(true)
            .Read(read => read.Action("RepairGIList", Html.ControllerName()))
            .ServerOperation(true)
            .Model(m =>
            {
                m.Id(c => c.Begin_Repair_No);
            }).PageSize(50))
    
    
    必须要加[DataSourceRequest] DataSourceRequest request然后使用 
    return Json(list.ToDataSourceResult(request));
    
      public ActionResult RepairGIList([DataSourceRequest] DataSourceRequest request)
            {
                using (var handler = new RepairHandler())
                {
                    var list = handler.GetRepairGIList();
                    return Json(list.ToDataSourceResult(request));
                }
            }
    

    多表查询list

       var TCALL = (from r in db.EMS_R_CALL
                             from a in db.ACCOUNT
                             where r.STATUS == 0 && a.DEPARTMENTID == DeptId && a.DELETEFLAG == 0 &&
                                   r.CALL_BY == a.ID
                             select new CallRepair
                             {
                                 Call_Repair_No = r.CALL_REPAIR_NO,
                                 Line_Name = r.LINE.CODE,
                                 Call_ByN = a.NAME,
                                 Call_Time = r.CALL_TIME,
                             });
    
    或者
         var getList = (from T_BEGIN in db.EMS_R_BEGIN.Where(y => y.STATUS == 1 && CALLNO.Contains(y.CALL_REPAIR_NO))
                               join a in db.ACCOUNT on T_BEGIN.BEGIN_BY equals a.ID into aa
                               from T_A in aa.DefaultIfEmpty()
                                   //join b in TCALL on T_BEGIN.CALL_REPAIR_NO equals b.Call_Repair_No into bb
                                   //from T_CALL in bb.DefaultIfEmpty()
                               select new CallRepair
                               {
                                   Id = T_BEGIN.ID,
                                   Call_Repair_No = T_BEGIN.CALL_REPAIR_NO,
                                   Begin_Repair_No = T_BEGIN.BEGIN_REPAIR_NO,
                                   //Line_Name = TCALL.Where(x=>x.Call_Repair_No==T_BEGIN.CALL_REPAIR_NO).Select(t=>t.Line_Name).FirstOrDefault(),
                                   //Call_ByN = TCALL.Where(x => x.Call_Repair_No == T_BEGIN.CALL_REPAIR_NO).Select(t => t.Call_ByN).FirstOrDefault(),
                                   //Call_Time = TCALL.Where(x => x.Call_Repair_No == T_BEGIN.CALL_REPAIR_NO).Select(t => t.Call_Time).FirstOrDefault(),
                                   Begin_Time = T_BEGIN.BEGIN_TIME,
                                   Begin_ByName = T_A.NAME,
                                   Status = T_BEGIN.STATUS,
                                   //StatusName = T_BEGIN.STATUS == 1 ? "起修" : (T_BEGIN.STATUS == 2 ? "工时回报" : "结案"),
                                   WorkCenter = T_BEGIN.WORK_CENTER,
                               }).ToList();
    
     public List<EMS.Models.CallRepair> GetRepairGIInfo( string strOrderNumber)
            {
                var getList = (from ERB in db.EMS_R_BEGIN.Where(x => x.BEGIN_REPAIR_NO == strOrderNumber)
                               join ER_CD in db.EMS_R_CALL_DEFECT on new { ERB.CALL_REPAIR_NO ,ERB.BEGIN_REPAIR_NO} equals new { ER_CD.CALL_REPAIR_NO ,ER_CD.BEGIN_REPAIR_NO} into a
                               from ERCD in a.DefaultIfEmpty()
                               join M_H in db.MACHINE on ERCD.MACHINE_ID equals M_H.ID into b
                               from MH in b.DefaultIfEmpty()
                               join ES_BH in db.EMS_SYS_BOM_HEAD.Where(s => s.PLANT_ID == UserSession.Plant.Id) on MH.PARTNO equals ES_BH.BOM_PART into c
                               //join ES_BH in db.EMS_SYS_BOM_HEAD on new { MH.PARTNO,ERB.PLANTID} equals new { ES_BH.BOM_PART,ES_BH.PLANT_ID} into c
                               from ESBH in c.DefaultIfEmpty()
                               join ES_BT in db.EMS_SYS_BOM_ITEM.Where(t => t.QTY > 0) on ESBH.ID equals ES_BT.BOM_ID into d
                               from ESBT in d.DefaultIfEmpty()
                               join S_P in db.SYS_PART on ESBT.PART_NO equals S_P.PART_NO into e
                               from SP in e.DefaultIfEmpty()
                                   //2021/01/03 update by Kero Hu   添加视图 G_SUP_STORE_VIEW(同一料号多个库位取最大库存的库位及库存数)
                                   //join G_ST in db.G_SUP_STORE.Where(t => t.PART_ID != null) on SP.ID equals G_ST.PART_ID into f
                                  //from GST in f.DefaultIfEmpty()
                               join G_ST in db.G_SUP_STORE_VIEW.Where(t => t.PART_ID != null) on SP.ID equals G_ST.PART_ID into f
                               from GST in f.DefaultIfEmpty()
    
                               join ER_C in db.EMS_R_CALL on ERB.CALL_REPAIR_NO equals ER_C.CALL_REPAIR_NO into g
                               from ERC in g.DefaultIfEmpty()
    
    
                               select new CallRepair
                               {
                                   //Id= ESBT.ID,
                                   Begin_Repair_No = ERB.BEGIN_REPAIR_NO,
                                   MachineNo = MH.CUSTODYNO,
                                   BomPartNo = ESBH.BOM_PART,
                                   PartNo = ESBT.PART_NO,
                                   PartDesc = SP.PART_DESC,
                                   StoreCode = GST.STORE_CODE,
                                   StoreQty = GST.QUANTITY,
                                   Unit = SP.UNIT,
                                   ReqQty = ESBT.QTY,
                                   Line_Name= db.LINE.Where(t => t.ID == ERC.LINE_ID).Select(t => t.CODE).FirstOrDefault()
                              
                               }).OrderBy(x => x.Begin_Repair_No).ToList();
                int i = 1;
                foreach(var t in getList)
                {
                    t.Id = i;
                    i += 1;
                    t.GiQty = CountGIQty(t.Begin_Repair_No, t.PartNo);
                }
                return getList;
            }
    

    winform框体中接口传值

    方法1

               string intputjson = "{\"EventID\": \"CheckData\",\"StationID\": \"\",\"MachineID\": \"M001\", \"IPV4\": \"\", \"OPID\": \"70019321\",\"SNType\": \"SN\",\"CheckType\": \"X - Ray\",\"Mode\": \"Send\",\"SN\": \"T201900101\"," +
                    "\"FilePath\": \"\",\"DC_Info\": [{ \"Item\": \"DefectPoints\", \"UP\": \"\",\"Down\": \"\",\"Value\": \"80\", \"Unit\": \"个\", \"Class\": \"\", \"CheckResult\": \"FAIL\"}," +
                    "{ \"Item\": \"Ratio\", \"UP\": \"\",\"Down\": \"\",\"Value\": \"8\", \"Unit\": \"%\", \"Class\": \"\", \"CheckResult\": \"FAIL\"}]}";
    
                    eap2mes.EAP2MES eap = new eap2mes.EAP2MES();
                    string strresult = eap.EAPtoMES_XML("MachineID", "CheckData", intputjson);
                    var ResultJson = JObject.Parse(strresult);
                    // 如果数据协议中Result=NG,需提示异常信息
                    if (ResultJson["Result"].ToString() == "NG")
                    {
                        MessageBox.Show(ResultJson["MSG"].ToString());
                        // 如果数据协议中有Need_Work 字段,返回=STOP,需停机
                        /*
                        if (ResultJson["Need_Work"].ToString() == "STOP")
                        {
                            // 控制设备停止作业,不允许产品继续生产;
                        }
                        */
                    }
                    else { MessageBox.Show(ResultJson["Result"].ToString()); }
    

    方法2

    JObject retJson = new JObject();
                retJson.Add("EventID", "CheckData");
                retJson.Add("MachineID", "M001");
                retJson.Add("DC_Info", "M001");
                MessageBox.Show(retJson.ToString());
    
    展开全文
  • list取值_List/Map

    2020-11-27 20:33:41
    List接口实现类:ArrayList LinkedList VectorArrayList 基于数组 Object[] 实现的可扩展的集合。查询速度快。需要一块连续的内存存储创建:默认初始大小为10(可手动设置),add:每次增加数组元素,需要判断长度...
  • 对于对象的属性存在性检测一直是我们判断条件几乎每天遇到的,但是你是否又在具有‘坏味道’ 代码很绝望,现在我们提供几种处理‘坏味道’ 对象链式取值方式1 reduce函数式编程2 Proxy妙用3 Ramda 函数式类库4 Maybe...
  • java遍历list取值

    万次阅读 2018-11-07 16:27:22
    1、 public void testSelectQuestionTypeByExample1() {  List&lt;QuestionTypeEntity&gt; list = new ArrayList();  list = questionTypeManagerFacade.selectQuestionTypeByExample();  for ...
  • list取值传值

    2017-04-17 09:54:31
    从一张表里取出几个字段存在list,在页面中显示相应的字段值[img=https://img-bbs.csdn.net/upload/201704/17/1492393903_300438.png][/img] 这样打印出来的list是com.work.model.Region@1570945 ...
  • java list取值

    2017-03-19 09:48:46
    如图所示,数据库查询结果有多条记录,把这些记录存入java list中,根据商户号找到list索引,再找到同一条记录的其他信息,但是发现并不是我要的信息,也就是list中并不是按数据库查询的顺序,我该用什么方式存储,...
  • 三种遍历list取值方式

    万次阅读 热门讨论 2017-07-10 20:03:14
    小编最近在项目中总结了三种遍历list取值方式,总结一下。 第一种 public void testSelectQuestionTypeByExample1() { List list = new ArrayList(); list = questionTypeManagerFacade....
  • JS遍历list取值判断某元素是否存在 1.由于显示需要传2个参数,因此定义函数: 后端传过来的数据List集合:anthTypeKeyList value 是需要判断该元素在集合中是否存在 方法1: function findAnthTypeKey...
  • 本文概要对于对象的属性存在性检测一直是我们判断条件几乎每天遇到的,但是你是否又在具有‘坏味道’ 代码很绝望,现在我们提供几种处理‘坏味道’ 对象链式取值方式reduce函数式编程Proxy妙用Ramda 函数式类库Maybe...
  • List取值相关问题

    2016-09-30 14:41:11
    List取出有两种取法,使用迭代器和将List转换成数组来取值 //使用迭代器 Iterator it = list.iterator(); while(it.hasNext()){ Student stu = it.next(); String name = stu.getName();//得到了里面的...
  • datagrid通过List取值

    2015-06-08 23:07:05
    在datagrid的column中的field取另一张表的list集合里面的值,我应该怎么写呢
  • CheckBoxList取值及勾选

    2008-01-14 13:11:36
    CheckBoxList取值stringstrrighgs="";for(inti=0;i<this.cblrighgs.Items.Count;i++){if(this.cblrighgs.Items[i].Selected==true)...
  • list取值

    2009-04-30 10:31:47
    主要是实现功能:在jsp页面输入SQL语句,下面显示结果。...代码是领导给的,让我直接从list调出hashmap,然后从hashmap取值,我对于集合类不了解,这方面知识欠缺,怎么写jsp代码,从list调出hashmap呢?
  • CheckBoxList 取值 / 赋值

    2019-10-08 03:48:34
    #region CheckBoxList /// <summary> /// 初始化控件 /// </summary> /// <param name="checkList"></param> private void InitChecked(CheckBoxList che...
  • json解析list取值,json多层取值

    千次阅读 2017-04-25 13:34:56
    先获取json文件,如下解析即可获取所需字段值,可new对象set值保存或返回。 package UserTest;import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; ...public class JsonTest {publi
  • 判断list取值完毕

    2012-12-28 10:37:49
    定义了两个list,listRkd得到数据库的值,拼接成字符串后放到了list.add里,进入循环的时候出现异常了,假如for循环现在要循环10次,我的list里的值现在只有8个值,那么我用showData.apend(list.get(i))循环取list的...
  • 相对于vector的连续线性空间,list是非线性非连续空间,虽然会复杂一些,但是每次插入或者删除一个元素,只是配置或释放一个元素空间,而且对任何位置的元素插入或移除,list都是常数操作时间。【节点结构】list本身...
  • checkboxlist取值

    2011-10-31 12:06:28
    C# code有个地方要用到ajax,页面上的值得用js到才行,页面上有个服务器控件checkboxlist,想要获取选中的value值,  var chkObject = document.getElementById('');  var chkInput =chkObject.getElementsByTagName...
  • 像字符串(str)、列表(list)、元组(tupple)和这类序列类型都支持切片操作对对象切片,s是一个字符串,可以通过类似数组索引的方式获取字符串中的字符,同时也可以用s[a:b:c]的形式对s在a和b之间,以c为间隔取值,c的...
  • CheckBoxList取值

    2010-04-29 21:16:00
    for(int i=0;i{ if(this.CheckBoxList1.Items[i].Selected) { Label1.Text+=this.CheckBoxList1.Items[i].Text+""; }}
  • 上一篇中看了List的使用方式、quicklist中的各个结构体,这一篇来看看quicklist里面的几个核心函数,quicklistCreate函数、quicklistCreateNode函数、quicklistPush函数、quicklistPop函数。接下来我们通过源码看...
  • 抓取所有主B类的路由条目,主B类ip地址范围为首字节前2bit恒为10,当剩余6bit为0时,取值为128,当剩余6bit全为1时,取值为191,所以抓取的路由条目为:ip prefix-list EE seq 10 permit 128.0.0.0/2 ge 16 le 16 ...
  • 接下来我们要剖析的基本类型是List,相信大家对List都不会陌生吧,下面我们将深入源码剖析Redis中List的实现。存储类型存储有序的字符串(从左到右),元素可以重复。可以充当队列和栈的角色。操作命令元素增减lpush...
  • CheckBoxList 取值

    2008-12-25 14:18:00
    通用版本(不依赖任何类库)function GetCheckBoxListValue(objID)...{ var v = new Array(); var CheckBoxList = document.getElementById(objID); if(CheckBoxList.tagName == "TABLE") ...{ f
  • 我们知道在一般的数组中,元素在数组中的索引位置是随机的,元素的取值和元素的位置之间不存在确定的关系,因此,在数组中查找特定的值时,需要把查找值和一系列的元素进行比较,此时的查询效率依赖于查找过程中比较...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 3,707
精华内容 1,482
关键字:

list取值