Beispiel #1
0
        public OrderListForCust(string username, MenuCustomer f1)
        {
            InitializeComponent();

            this.lbluser.Text = username;
            //this.lbltype.Text = type;
            this.F1 = f1;

            OracleConnection con = new OracleConnection(constr);

            con.Open();
            string           q1  = "select * from customer where cust_uname ='" + username + "'";
            OracleCommand    oc  = new OracleCommand(q1, con);
            OracleDataReader odr = oc.ExecuteReader();

            if (odr.Read())
            {
                lblfullname.Text = (odr["cust_fname"].ToString());
                lblid.Text       = (odr["cust_id"].ToString());
                lblphone.Text    = (odr["cust_phone"].ToString());
                lbladdress.Text  = (odr["cust_address"].ToString());
            }
            con.Close();
            loadGridview();
        }
        private void log()
        {
            string userName = txtUser.Text.ToString();
            string password = txtpassword.Text.ToString();
            string cmbType  = cmbUsertype.Text.ToString();

            OracleConnection con = new OracleConnection(constr);

            con.Open();


            /* string query = "Select count(*) From login where username ='******' and password ='******'and usertype  ='" + cmbType + "'";
             * string query2 = "Select usertype From login where username='******' and password ='******'";
             *
             * OracleDataAdapter oda = new OracleDataAdapter(query,con);
             * DataTable dt = new DataTable();
             * oda.Fill(dt);
             *
             *
             *    if (dt.Rows[0][0].ToString() == "1")
             *    {
             *        OracleDataAdapter oda1 = new OracleDataAdapter(query2, con);
             *        DataTable dt1 = new DataTable();
             *        oda1.Fill(dt1);
             *        if (dt1.Rows[0][0].ToString() == "Delivery Boy")
             *        {
             *            this.Hide();
             *            MenuDeliveryBoy m = new MenuDeliveryBoy(this.txtUser.Text, this.cmbUsertype.Text, this);
             *            m.Show();
             *        }
             *    }
             */

            string            q11   = "select count(*) from manager where mgr_uname ='" + userName + "' and password ='******'";
            OracleDataAdapter oda22 = new OracleDataAdapter(q11, con);
            DataTable         dt22  = new DataTable();

            oda22.Fill(dt22);
            //OracleCommand cmd = new OracleCommand("select mgr_uname from manager",con);
            // OracleDataReader dr = cmd.ExecuteReader();
            //  AutoCompleteStringCollection mycollection = new AutoCompleteStringCollection();
            // while (dr.Read())
            // {
            //     mycollection.Add(dr.GetString(0));
            // }
            if (dt22.Rows[0][0].ToString() == "1")
            {
                this.Hide();
                MenuManager m = new MenuManager(this.txtUser.Text, this.cmbUsertype.Text, this);
                m.Show();
            }
            //  else if (dt22.Rows[0][0].ToString() == "0")
            //    {
            //        MessageBox.Show("Not Correct");
            //    }


            string            q1   = "select count(*) from shopkeeper where shpkper_uname ='" + userName + "' and password ='******'";
            OracleDataAdapter oda2 = new OracleDataAdapter(q1, con);
            DataTable         dt2  = new DataTable();

            oda2.Fill(dt2);

            if (dt2.Rows[0][0].ToString() == "1")
            {
                this.Hide();
                MenuShopkeepers m = new MenuShopkeepers(this.txtUser.Text, this);
                m.Show();
            }



            string            q2   = "select count(*) from Customer where cust_uname ='" + userName + "' and password ='******'";
            OracleDataAdapter oda3 = new OracleDataAdapter(q2, con);
            DataTable         dt3  = new DataTable();

            oda3.Fill(dt3);

            if (dt3.Rows[0][0].ToString() == "1")
            {
                this.Hide();
                MenuCustomer m = new MenuCustomer(this.txtUser.Text, this.cmbUsertype.Text, this);
                m.Show();
            }

            string            q5   = "select count(*) from DELIVERYBOY where DELBOY_UNAME ='" + userName + "' and password ='******'";
            OracleDataAdapter oda5 = new OracleDataAdapter(q5, con);
            DataTable         dt5  = new DataTable();

            oda5.Fill(dt5);

            if (dt5.Rows[0][0].ToString() == "1")
            {
                this.Hide();
                MenuDeliveryBoy m = new MenuDeliveryBoy(this.txtUser.Text, this.cmbUsertype.Text, this);
                m.Show();
            }


            con.Close();
        }