示例#1
0
        static void TestOracleRaw()
        {
            //byte b = Convert.ToByte("01", 16);

            OracleDataBase db = new OracleDataBase("User Id=bpi;Password=yuantacps;Data Source=TS02G");
            DataTable      dt = db.QueryCommand("SELECT * FROM ptDeptRiskCtrl");

            if (dt != null && dt.Rows.Count > 0)
            {
                DataRow row     = dt.Rows[0];
                byte[]  rawData = (byte[])(row["PTDeptAuthID"]);
                string  strRaw  = AbstractDataBase.RawToString(rawData);
                byte[]  raw2    = AbstractDataBase.StringToRaw(strRaw);

                System.Diagnostics.Debug.Assert(rawData.Length == raw2.Length);
                for (int index = 0; index < raw2.Length; ++index)
                {
                    System.Diagnostics.Debug.Assert(rawData[index] == raw2[index]);
                }

                string tmps = db.FieldToSQL(new OracleRowID(strRaw));
            }

            db.Close();
        }
示例#2
0
        /// <summary>
        /// 測試連接Oracle資料庫
        /// </summary>
        public static void TestYuantaOracle()
        {
            OracleDataBase        db  = new OracleDataBase("User Id=bpi;Password=yuantacps;Data Source=TS03");
            PTTradingUnitOperator opr = new PTTradingUnitOperator(db);

            //int totalRecords = opr.Select(null);
            //foreach (PTTradingUnitRecord record in opr.RecordList)
            //{
            //    Console.WriteLine( record.PTCorpID + "," + record.PTCostCenter + "," + record.PTCustID + "," + record.PTDeptID +
            //        "," + record.PTTradeGoal + "," + record.PTUserID );
            //}

            foreach (PTTradingUnitRecord record in opr.SelectIterator(null))
            {
                Console.WriteLine(record.PTCorpID + "," + record.PTCostCenter + "," + record.PTCustID + "," + record.PTDeptID +
                                  "," + record.PTTradeGoal + "," + record.PTUserID);
            }

            string[] corpID = opr.SelectFields <string>("ptCorpID", false, 10, null, AbstractOperator <PTTradingUnitRecord> .ConvertFirstColumn <string>);
            foreach (string cid in corpID)
            {
                Console.WriteLine(cid);
            }

            int totalCount = opr.SelectCount(null);

            Console.WriteLine("TotalCount " + totalCount);

            db.Close();
        }
示例#3
0
        private void Client_Load(object sender, EventArgs e)
        {
            OracleDataBase db = new OracleDataBase();

            db.loadQueryToGDV(dgv_client, "select u.UserId, UserPassword, Admin, Email, FirstName, LastName, Adresse, Phone, BrithDay " +
                              "from Users u,User_Details ud where  ud.UserId (+)= u.UserId");
        }
示例#4
0
        public static void TestRO()
        {
            //OracleDataBase db = new OracleDataBase("User Id=system;Password=spmll1l3x96;Data Source=XE80");
            OracleDataBase db = new OracleDataBase("User Id=bpi;Password=yuantacps;Data Source=TS03");

            OracleDAOTestOperator opr    = new OracleDAOTestOperator(db);
            OracleDAOTestRecord   record = new OracleDAOTestRecord();

            record.ID         = 13;
            record.Name       = "Justin 13";
            record.ModifyDate = new DateTime(2011, 1, 1);

            int effectedRows = 0;

            opr.Insert(record, ref effectedRows);
        }
        private void btn_ok_Click(object sender, EventArgs e)
        {
            //test if the fields
            OracleDataBase db = new OracleDataBase();

            Tables.User_Details user_Details = new Tables.User_Details(txb_user_name.Text, txb_email.Text, txb_first_name.Text,
                                                                       txb_last_name.Text, txb_adresse.Text, txb_phone_number.Text, DateTime.Parse(dtp_brith_day.Text), false);
            Tables.Users user = new Tables.Users(txb_user_name.Text, txb_password.Text, cb_admin.Checked);

            db.addClientWithDetails(user, user_Details);
            clearTextBoxes();

            //test if the fields is not null
            //add client if note exist else update with comfirmation msg
            //get user detail by id for modify
        }
示例#6
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            List <Image> pics = new List <Image>();

            foreach (PictureBox pic in panel_car_pics.Controls)
            {
                pics.Add(pic.Image);
            }
            //test if the fields is not null
            OracleDataBase db = new OracleDataBase();

            Tables.Car         car         = new Tables.Car(txb_matricule.Text, txb_name.Text, txb_color.Text, type_car, Convert.ToDouble(txb_km.Text));
            Tables.CarPictures carPictures = new Tables.CarPictures(txb_matricule.Text, pics);
            db.addCar(car, carPictures);
            //add client if note exist else update with comfirmation msg
            //get user detail by id for modify
        }
示例#7
0
        public static void TestConcurrentOracle()
        {
            conDB = new OracleDataBase("User Id=bpi;Password=yuantacps;Data Source=TS03");

            List <Thread> listThread = new List <Thread>();

            for (int i = 0; i < 3; i++)
            {
                Thread t = new Thread(OracelAccessThread);
                t.IsBackground = true;
                t.Start();

                listThread.Add(t);
            }

            foreach (Thread t in listThread)
            {
                t.Join();
            }

            conDB.Close();
        }
示例#8
0
        private void Contrat_Load(object sender, EventArgs e)
        {
            OracleDataBase db = new OracleDataBase();

            db.loadQueryToGDV(dgv_contrat, "select * from Contrat");
        }
示例#9
0
        private void Car_Load(object sender, EventArgs e)
        {
            OracleDataBase db = new OracleDataBase();

            db.loadQueryToGDV(dgv_car, "select * from Car c, CarPictures cp where c.Matricule = cp.Matricule");
        }
示例#10
0
 public ProjUnitDao(OracleDataBase db)
 {
     this.odb = db;
 }