コード例 #1
0
        public List <grps> getJiZuList(DataTable dt, string cx, string ch)
        {
            DataView view = dt.DefaultView;

            view.RowFilter = string.Format("strTrainTypeName={0} and strTrainNumber={1}", "'" + cx.ToString() + "'", "'" + ch.ToString() + "'");
            List <grps> jzl = new List <grps>();
            int         i   = 1;

            foreach (DataRow dr in view.ToTable().Rows)
            {
                tm1 bTm1 = new NamePlate.tm1();
                bTm1.tmName           = dr["strTrainmanName1"].ToString();
                bTm1.tmNumber         = ChangeStrTn(dr["strTrainmanNumber1"].ToString());
                bTm1.post             = (dr["nPost1"].ToString() == "" || dr["nPost1"].ToString() == "0") && bTm1.tmName != "" ? "1" : dr["nPost1"].ToString();
                bTm1.tmGuideGroupName = getTG(dr["strTrainmanNumber1"].ToString());


                tm2 bTm2 = new tm2();
                bTm2.tmName           = dr["strTrainmanName2"].ToString();
                bTm2.tmNumber         = ChangeStrTn(dr["strTrainmanNumber2"].ToString());
                bTm2.post             = (dr["nPost2"].ToString() == "" || dr["nPost2"].ToString() == "0") && bTm2.tmName != "" ? "2" : dr["nPost2"].ToString();
                bTm2.tmGuideGroupName = getTG(dr["strTrainmanNumber2"].ToString());


                tm3 bTm3 = new tm3();
                bTm3.tmName           = dr["strTrainmanName3"].ToString();
                bTm3.tmNumber         = ChangeStrTn(dr["strTrainmanNumber3"].ToString());
                bTm3.post             = (dr["nPost3"].ToString() == "" || dr["nPost3"].ToString() == "0") && bTm3.tmName != "" ? "3" : dr["nPost3"].ToString();
                bTm3.tmGuideGroupName = getTG(dr["strTrainmanNumber3"].ToString());


                tm4 bTm4 = new tm4();
                bTm4.tmNumber = ChangeStrTn(dr["strTrainmanNumber4"].ToString());
                bTm4.post     = dr["nPost4"].ToString();
                bTm4.tmName   = dr["strTrainmanName4"].ToString();

                grps grps = new grps();

                grps.groupState = dr["GroupState"].ToString();
                grps.orderNo    = i.ToString();
                i++;
                tms tm = new tms();
                tm.tm1   = bTm1;
                tm.tm2   = bTm2;
                tm.tm3   = bTm3;
                tm.tm4   = bTm4;
                grps.tms = tm;
                jzl.Add(grps);
            }
            return(jzl);
        }
コード例 #2
0
        public List <LunCheng> TXDtToList(string strWorkShopGUID, string strTmJiaoLuGUIDs)
        {
            DataTable       dt           = this.GetTXList(strWorkShopGUID, strTmJiaoLuGUIDs);
            int             order        = 1;
            List <LunCheng> lLunCheng    = new List <LunCheng>();
            List <grps>     Lgrps        = new List <grps>();
            string          strAllZhiWei = "";

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string strTrainmanJiaoluGUID = dt.Rows[i]["strTrainmanJiaoluGUID"].ToString();
                string strTrainmanJiaoluName = dt.Rows[i]["strTrainmanJiaoluName"].ToString() == "" ? "未归属人员交路" : dt.Rows[i]["strTrainmanJiaoluName"].ToString();

                string nOrder     = order.ToString();
                string GroupState = dt.Rows[i]["GroupState"].ToString();

                string strTrainmanNumber1 = ChangeStrTn(dt.Rows[i]["strTrainmanNumber1"].ToString());
                string strTrainmanGUID1   = dt.Rows[i]["strTrainmanGUID1"].ToString();
                string strTrainmanName1   = dt.Rows[i]["strTrainmanName1"].ToString();
                string nPost1             = (dt.Rows[i]["nPost1"].ToString() == "" || dt.Rows[i]["nPost1"].ToString() == "0") && strTrainmanName1 != "" ? "1" : dt.Rows[i]["nPost1"].ToString();
                string strGn1             = getTG(dt.Rows[i]["strTrainmanNumber1"].ToString());

                string strTrainmanNumber2 = ChangeStrTn(dt.Rows[i]["strTrainmanNumber2"].ToString());
                string strTrainmanGUID2   = dt.Rows[i]["strTrainmanGUID2"].ToString();
                string strTrainmanName2   = dt.Rows[i]["strTrainmanName2"].ToString();
                string nPost2             = (dt.Rows[i]["nPost2"].ToString() == "" || dt.Rows[i]["nPost2"].ToString() == "0") && strTrainmanName2 != "" ? "2" : dt.Rows[i]["nPost2"].ToString();
                string strGn2             = getTG(dt.Rows[i]["strTrainmanNumber2"].ToString());


                string strTrainmanNumber3 = ChangeStrTn(dt.Rows[i]["strTrainmanNumber3"].ToString());
                string strTrainmanGUID3   = dt.Rows[i]["strTrainmanGUID3"].ToString();
                string strTrainmanName3   = dt.Rows[i]["strTrainmanName3"].ToString();
                string nPost3             = (dt.Rows[i]["nPost3"].ToString() == "" || dt.Rows[i]["nPost3"].ToString() == "0") && strTrainmanName3 != "" ? "3" : dt.Rows[i]["nPost3"].ToString();
                string strGn3             = getTG(dt.Rows[i]["strTrainmanNumber3"].ToString());


                string strTrainmanNumber4 = ChangeStrTn(dt.Rows[i]["strTrainmanNumber4"].ToString());
                string strTrainmanGUID4   = dt.Rows[i]["strTrainmanGUID4"].ToString();
                string strTrainmanName4   = dt.Rows[i]["strTrainmanName4"].ToString();
                string nPost4             = dt.Rows[i]["nPost4"].ToString();



                LunCheng lc = new LunCheng();
                Jl       Jl = new Jl();
                Jl.JlGUID = strTrainmanJiaoluGUID;
                Jl.JlName = strTrainmanJiaoluName;

                grps grps = new grps();
                grps.orderNo    = nOrder;
                grps.groupState = GroupState;

                tms tms = new tms();


                tm1 tm1 = new tm1();
                tm1.tmGUID           = strTrainmanGUID1;
                tm1.tmName           = strTrainmanName1;
                tm1.tmNumber         = strTrainmanNumber1;
                tm1.post             = nPost1;
                tm1.tmGuideGroupName = strGn1;
                tms.tm1 = tm1;

                tm2 tm2 = new tm2();
                tm2.tmGUID           = strTrainmanGUID2;
                tm2.tmName           = strTrainmanName2;
                tm2.tmNumber         = strTrainmanNumber2;
                tm2.post             = nPost2;
                tm2.tmGuideGroupName = strGn2;
                tms.tm2 = tm2;


                tm3 tm3 = new tm3();
                tm3.tmGUID           = strTrainmanGUID3;
                tm3.tmName           = strTrainmanName3;
                tm3.tmNumber         = strTrainmanNumber3;
                tm3.post             = nPost3;
                tm3.tmGuideGroupName = strGn3;
                tms.tm3 = tm3;

                tm4 tm4 = new tm4();
                tm4.tmGUID   = strTrainmanGUID4;
                tm4.tmName   = strTrainmanName4;
                tm4.tmNumber = strTrainmanNumber4;
                tm4.post     = nPost4;
                tms.tm4      = tm4;
                grps.tms     = tms;
                if (!strAllZhiWei.Contains("'" + strTrainmanJiaoluGUID + "'"))
                {
                    Lgrps = new List <grps>();
                    Lgrps.Add(grps);
                }
                else
                {
                    Lgrps.Add(grps);
                }
                lc.grps       = Lgrps;
                lc.Jl         = Jl;
                strAllZhiWei += "'" + strTrainmanJiaoluGUID + "',";
                if (i + 1 < dt.Rows.Count)
                {
                    if (!strAllZhiWei.Contains("'" + dt.Rows[i + 1]["strTrainmanJiaoluGUID"].ToString() + "'"))
                    {
                        lLunCheng.Add(lc);
                        order = 0;
                    }
                }
                else
                {
                    lLunCheng.Add(lc);
                }
                order++;
            }
            return(lLunCheng);
        }