Esempio n. 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            string accno, date;
            double bal, depo;

            accno = txtacc.Text;
            date  = txtdate.Text;
            bal   = double.Parse(txtbal.Text);
            depo  = double.Parse(txtdp.Text);

            string query  = "update Accounts set Balance=Balance+'" + depo + "' where AccountNo='" + accno + "'";
            string query1 = "INSERT into Transactions (AccountNo,Date,Balance,Deposit,Withdraw) values ('" + accno + "','" + date + "'," + bal + "," + depo + ",0)";

            try
            {
                DatabaseConnectionClass dcc = new DatabaseConnectionClass();

                dcc.ConnectWithDB();
                int n = dcc.ExecuteSQL(query);
                dcc.CloseConnection();
                dcc.ConnectWithDB();
                int n1 = dcc.ExecuteSQL(query1);
                dcc.CloseConnection();


                MessageBox.Show("Done");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string cid, accno, acctype, des;
            double bal;

            cid     = txtcid.Text;
            accno   = txtacc.Text;
            acctype = txtacctype.Text;
            des     = txtdes.Text;
            bal     = double.Parse(txtbal.Text);



            string query1 = "INSERT into Accounts(AccountNo,CustId,AccountType,Description,Balance)values('" + accno + "','" + cid + "','" + acctype + "','" + des + "','" + bal + "')";

            try
            {
                DatabaseConnectionClass dcc = new DatabaseConnectionClass();

                dcc.ConnectWithDB();
                int n = dcc.ExecuteSQL(query1);
                dcc.CloseConnection();
                MessageBox.Show("Done");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 3
0
        private void AddProductBtn_Click(object sender, EventArgs e)
        {
            ManageItems mi = new ManageItems();

            mi.ItemId   = this.ProductIdTB.Text;
            mi.ItemName = this.ProductNameTB.Text;
            //mi.ItemPrice = Convert.ToString(ProductPriceTB.Text);
            try
            {
                double price = Convert.ToDouble(this.ProductPriceTB.Text);
                mi.ItemPrice = price;
                if (mir.InsertProduct(mi))
                {
                    MessageBox.Show("Item Added with Id: " + mi.ItemId + " & Price: " + mi.ItemPrice);
                    // this.RefreshBtn_Click(sender, e);
                    //this.ViewAllBtn_Click(sender, e);
                }
                else
                {
                    MessageBox.Show("Can Not Add : " + mi.ItemId);
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show("Invalid Data" + exp.StackTrace);
            }
            finally
            {
                dcc.CloseConnection();
            }
        }
Esempio n. 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (txtNewpass.Text.Equals(txtConfirmpwd.Text))
            {
                string query = "update Login set Password='******' Where id='" + HomePage.identity + "'";
                try
                {
                    DatabaseConnectionClass dcc = new DatabaseConnectionClass();

                    dcc.ConnectWithDB();
                    int n = dcc.ExecuteSQL(query);
                    dcc.CloseConnection();

                    MessageBox.Show("Done");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
            else
            {
                MessageBox.Show("Confirm Password doesn't Matched");
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string fno;
            string tono;
            string date;
            double amount;

            fno    = ftxt.Text;
            tono   = totxt.Text;
            date   = txtdate.Text;
            amount = double.Parse(txtamount.Text);


            string query  = "update Accounts set Balance=Balance-'" + amount + "' where AccountNo='" + fno + "'";
            string query1 = "update Accounts set Balance=Balance+'" + amount + "' where AccountNo='" + tono + "'";
            string query2 = "INSERT into Transfers (F_Acc,To_Acc,Date,Amount) values ('" + fno + "','" + tono + "','" + date + "'," + amount + ")";

            try
            {
                DatabaseConnectionClass dcc = new DatabaseConnectionClass();

                dcc.ConnectWithDB();
                int n = dcc.ExecuteSQL(query);
                dcc.CloseConnection();
                dcc.ConnectWithDB();
                int n1 = dcc.ExecuteSQL(query1);
                dcc.CloseConnection();
                dcc.ConnectWithDB();
                int n2 = dcc.ExecuteSQL(query2);
                dcc.CloseConnection();



                MessageBox.Show("Done");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        private void button8_Click(object sender, EventArgs e)
        {
            string query = "SELECT * from Accounts";
            DatabaseConnectionClass dcc = new DatabaseConnectionClass();

            dcc.ConnectWithDB();
            SqlDataReader sdr = dcc.GetData(query);


            while (sdr.Read())
            {
                Account acc = new Account();
                acc.AccountNo   = sdr["AccountNo"].ToString();
                acc.CustId      = sdr["CustId"].ToString();
                acc.AccountType = sdr["AccountType"].ToString();
                acc.Description = sdr["Description"].ToString();
                acc.Balance     = Convert.ToInt32(sdr["Balance"]);
                accList.Add(acc);
            }
            dcc.CloseConnection();

            accTable.DataSource = accList;
        }
Esempio n. 7
0
        private void AutoComplete()
        {
            studentSearchTB.AutoCompleteMode   = AutoCompleteMode.Suggest;
            studentSearchTB.AutoCompleteSource = AutoCompleteSource.CustomSource;

            AutoCompleteStringCollection coll = new AutoCompleteStringCollection();
            DatabaseConnectionClass      dcc;

            dcc = new DatabaseConnectionClass();
            string query = "SELECT Id from Student";

            dcc.ConnectWithDB();
            SqlDataReader sdr = dcc.GetData(query);

            while (sdr.Read())
            {
                firstName = sdr["Id"].ToString();
                coll.Add(firstName);
            }

            dcc.CloseConnection();
            studentSearchTB.AutoCompleteCustomSource = coll;
        }
        private void button8_Click(object sender, EventArgs e)
        {
            string query = "SELECT * from Transfers ";
            DatabaseConnectionClass dcc = new DatabaseConnectionClass();

            dcc.ConnectWithDB();
            SqlDataReader sdr = dcc.GetData(query);


            while (sdr.Read())
            {
                Transfer tccc = new Transfer();
                tccc.Tf_ID  = Convert.ToInt32(sdr["Tf_Id"]);
                tccc.F_Acc  = sdr["F_Acc"].ToString();
                tccc.To_Acc = sdr["To_Acc"].ToString();
                tccc.Date   = sdr["Date"].ToString();
                tccc.Amount = Convert.ToDouble(sdr["Amount"]);
                tcccList.Add(tccc);
            }
            dcc.CloseConnection();

            tcccTable.DataSource = tcccList;
        }
Esempio n. 9
0
        private void button8_Click(object sender, EventArgs e)
        {
            string query = "SELECT * from Transactions";
            DatabaseConnectionClass dcc = new DatabaseConnectionClass();

            dcc.ConnectWithDB();
            SqlDataReader sdr = dcc.GetData(query);



            while (sdr.Read())
            {
                Transaction tcc = new Transaction();
                tcc.Tx_ID     = Convert.ToInt32(sdr["Tx_Id"]);
                tcc.AccountNo = sdr["AccountNo"].ToString();
                tcc.Date      = sdr["Date"].ToString();
                tcc.Balance   = Convert.ToDouble(sdr["Balance"]);
                tcc.Deposit   = Convert.ToDouble(sdr["Deposit"]);
                tccList.Add(tcc);
            }
            dcc.CloseConnection();

            tccTable.DataSource = tccList;
        }