Esempio n. 1
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);
        }
Esempio n. 2
0
        public List <Named> NamedDtToList(string strWorkShopGUID, string strTmJiaoLuGUIDs, DataTable dtNoDispatching)
        {
            DataTable dt = this.GetNamedList(strWorkShopGUID, strTmJiaoLuGUIDs);

            List <Named> lNamed       = new List <Named>();
            List <grps>  Lgrps        = new List <grps>();
            string       strAllZhiWei = "";

            int order = 1;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string strTrainmanJiaoluGUID = dt.Rows[i]["strTrainmanJiaoluGUID"].ToString();
                string strTrainmanJiaoluName = dt.Rows[i]["strTrainmanJiaoluName"].ToString();
                string strCheci1             = dt.Rows[i]["strCheci1"].ToString();
                string strCheci2             = dt.Rows[i]["strCheci2"].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());
                int    nDispatching1      = checkIsDispatching(strTrainmanNumber1, dtNoDispatching);

                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());
                int    nDispatching2      = checkIsDispatching(strTrainmanNumber2, dtNoDispatching);


                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());
                int    nDispatching3      = checkIsDispatching(strTrainmanNumber3, dtNoDispatching);



                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();
                int    nDispatching4      = checkIsDispatching(strTrainmanNumber4, dtNoDispatching);



                Named   Named   = new Named();
                JlNamed JlNamed = new JlNamed();
                JlNamed.JlGUID = strTrainmanJiaoluGUID;
                JlNamed.JlName = strTrainmanJiaoluName;


                grps grps = new grps();

                tms tms = new tms();

                grps.strCheci1  = strCheci1;
                grps.strCheci2  = strCheci2;
                grps.groupState = GroupState;

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

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


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

                tm4 tm4 = new tm4();
                tm4.tmGUID       = strTrainmanGUID4;
                tm4.tmName       = strTrainmanName4;
                tm4.tmNumber     = strTrainmanNumber4;
                tm4.post         = nPost4;
                tm4.nDispatching = nDispatching4;
                tms.tm4          = tm4;
                grps.tms         = tms;
                grps.orderNo     = order.ToString();
                if (!strAllZhiWei.Contains("'" + strTrainmanJiaoluGUID + "'"))
                {
                    Lgrps = new List <grps>();
                    Lgrps.Add(grps);
                }
                else
                {
                    Lgrps.Add(grps);
                }
                Named.grps = Lgrps;
                Named.Jl   = JlNamed;

                strAllZhiWei += "'" + strTrainmanJiaoluGUID + "',";
                if (i + 1 < dt.Rows.Count)
                {
                    if (!strAllZhiWei.Contains("'" + dt.Rows[i + 1]["strTrainmanJiaoluGUID"].ToString() + "'"))
                    {
                        lNamed.Add(Named);
                        order = 0;
                    }
                }
                else
                {
                    lNamed.Add(Named);
                }
                order++;
            }
            return(lNamed);
        }