示例#1
0
        private static void LoadPharma()
        {
            XElement element = XElement.Load(@"C:\Users\user\Downloads\XMLanalysis-master\XMLanalysis-master\PharmaceuticalFactoryData.xml");
            List <PharmaceuticalFactory> list = new List <PharmaceuticalFactory>();

            element.Descendants("row").ToList().ForEach(row =>
            {
                PharmaceuticalFactory PF = new PharmaceuticalFactory();
                PF.type           = row.Element("Col1").Value;
                PF.name           = row.Element("Col2").Value;
                PF.address        = row.Element("Col3").Value;
                PF.formulation    = row.Element("Col4").Value;
                PF.approved_items = row.Element("Col5").Value;
                PF.GMP            = row.Element("Col6").Value;
                PF.GDP            = row.Element("Col7").Value;
                PF.note           = row.Element("Col8").Value;
                list.Add(PF);
            });
            IEnumerable <XElement> nodes = element.Descendants("row");

            list = nodes
                   .Select(node => {
                PharmaceuticalFactory PF = new PharmaceuticalFactory();
                PF.type           = getValue(node, "Col1");
                PF.name           = getValue(node, "Col2");
                PF.address        = getValue(node, "Col3");
                PF.formulation    = getValue(node, "Col4");
                PF.approved_items = getValue(node, "Col5");
                PF.GMP            = getValue(node, "Col6");
                PF.GDP            = getValue(node, "Col7");
                PF.note           = getValue(node, "Col8");
                return(PF);
            }).ToList();



            PharmaTable mPhar = new PharmaTable();

            list.ForEach(item =>
            {
                mPhar.InsertData(item);
            });
        }
示例#2
0
        static void Main(string[] args)
        {
            //-------------------------------------------------------------ShengYaoo
            MGenericsDB <FarmTran> mFarm = new FarmTranTable();

            /*
             * var nodeList = mFarm.Xml_Load();
             * nodeList.ForEach(item =>
             * {
             *  mFarm.InsertData(item);
             * });*/
            mFarm.ShowData(mFarm.QueryData("作物名稱", "椰子"));
            var farm = new FarmTran();

            farm.transactionDate = "107.4.13";
            mFarm.UpdateData(1, farm);
            mFarm.ShowData(mFarm.QueryData("交易日期", "107.4.13"));
            Console.ReadKey();
            Console.Clear();
            mFarm.DeleteData("交易日期", "107.4.13");
            mFarm.ShowData(mFarm.QueryData("交易日期", "107.4.13"));
            Console.ReadKey();
            //-------------------------------------------------------------YuSyuan1208
            MGenericsDB <Pharmacy_03> mPharmacy_03 = new PharmacyTable_03();

            /*var nodeList = mPharmacy_03.Xml_Load();
             * nodeList.ForEach(item =>
             * {
             *  PharmacyTable_03 SqlData;
             *  SqlData = new PharmacyTable_03();
             *  SqlData.InsertData(item);
             * });*/
            mPharmacy_03.ShowData(mPharmacy_03.QueryData("機構名稱", "和平藥局"));
            var nPharmacy_03 = new Pharmacy_03();

            nPharmacy_03.機構名稱 = "機構名稱";
            nPharmacy_03.機構狀態 = "機構狀態";
            nPharmacy_03.地址   = "地址";
            nPharmacy_03.電話   = "電話";
            mPharmacy_03.UpdateData(1, nPharmacy_03);
            mPharmacy_03.DeleteData("機構名稱", "機構名稱");
            Console.ReadKey();

            //-------------------------------------------------------------JustSoGreat
            MGenericsDB <PharmaceuticalFactory> mPF = new PharmaTable();
            var nodeList = mPF.Xml_Load();
            //nodeList.ForEach(item =>
            //{
            //    mPF.InsertData(item);
            //});
            //mPF.ShowData(mPF.QueryData("類別", "西藥製劑廠"));
            var pf = new PharmaceuticalFactory();

            pf.type = "test藥廠";
            pf.name = "高應藥廠";
            mPF.UpdateData(227, pf);
            Console.WriteLine("UPDATE ID:227,類別:test藥廠,名稱:高應藥廠");
            mPF.DeleteData("ID", "1");
            Console.WriteLine("Delete ID:1");
            Console.ReadKey();
            //-------------------------------------------------------------husano896
            MGenericsDB <桃園公共自行車即時服務資料> mPark = new ParkingDB();
            var nodeList2 = mPark.Xml_Load();
            var testitem  = new 桃園公共自行車即時服務資料();

            testitem.parkName = @"測試停車場";
            mPark.InsertData(testitem);
            Console.ReadKey();
        }