protected void Button2_Click(object sender, EventArgs e) { //////////////////////update Button////////////////////////// OracleConnect oc = new OracleConnect("localhost", "orcl", "hr", "hr"); string update_cdId_check = string.Format("select * from cd_collection where cd_id = {0}", TextBox2.Text); DataTable cd_update_table = oc.searchDB(update_cdId_check); if (String.IsNullOrWhiteSpace(TextBox2.Text) || String.IsNullOrWhiteSpace(TextBox3.Text) || DropDownList1.SelectedItem.Text.Equals("Select From")) { Label2.Text = "Please enter all informations"; } else if (cd_update_table.Rows.Count == 0) { Label2.Text = "No Cd with this Id, Please enter correct Id"; } else { string drop_down = DropDownList1.SelectedItem.Text; if (drop_down.Equals("price") || drop_down.Equals("category_id") || drop_down.Equals("genre_id")) { string update_cat_id_check = string.Format("select * from cd_category where category_id = {0}", TextBox3.Text); string update_gen_id_check = string.Format("select * from cd_genre where genre_id = {0}", TextBox3.Text); DataTable cd_update_check_cat_table = oc.searchDB(update_cat_id_check); DataTable cd_update_check_gen_table = oc.searchDB(update_gen_id_check); if (drop_down.Equals("category_id") && cd_update_check_cat_table.Rows.Count == 0) { Label2.Text = "No such categroy id available, Please enter correct Id"; } else if (drop_down.Equals("genre_id") && cd_update_check_gen_table.Rows.Count == 0) { Label2.Text = "No such genre id available, Please enter correct Id"; } else { string updateQuery1 = string.Format("update cd_collection set {0} = {1} where cd_id= {2}", drop_down, TextBox3.Text, TextBox2.Text); oc.updateDB(updateQuery1); TextBox2.Text = ""; TextBox3.Text = ""; Label2.Text = ""; oc.close(); } } else { string updateQuery2 = string.Format("update cd_collection set {0} = '{1}' where cd_id= {2}", drop_down, TextBox3.Text, TextBox2.Text); oc.updateDB(updateQuery2); TextBox2.Text = ""; TextBox3.Text = ""; Label2.Text = ""; oc.close(); } } }
protected void Button2_Click(object sender, EventArgs e) { ///////////////////update button////////////////////////// OracleConnect oc = new OracleConnect("localhost", "orcl", "hr", "hr"); string update_genreId_check = string.Format("select * from cd_genre where genre_id = {0}", TextBox2.Text); DataTable genre_update_table = oc.searchDB(update_genreId_check); if (String.IsNullOrWhiteSpace(TextBox2.Text) || String.IsNullOrWhiteSpace(TextBox3.Text) || DropDownList1.SelectedItem.Text.Equals("Select From")) { Label2.Text = "Please enter all informations"; } else if (genre_update_table.Rows.Count == 0) { Label2.Text = "No genre with this Id, Please enter correct Id"; } else { string drop_down = DropDownList1.SelectedItem.Text; string updateQuery2 = string.Format("update cd_genre set {0} = '{1}' where genre_id= {2}", drop_down, TextBox3.Text, TextBox2.Text); oc.updateDB(updateQuery2); TextBox2.Text = ""; TextBox3.Text = ""; Label2.Text = ""; oc.close(); } }
protected void Button1_Click(object sender, EventArgs e) { ///////////////delete button//////////////////// OracleConnect oc = new OracleConnect("localhost", "orcl", "hr", "hr"); string delete_genreId_check = string.Format("select * from cd_genre where genre_id = {0}", TextBox1.Text); DataTable genre_delete_table = oc.searchDB(delete_genreId_check); if (String.IsNullOrWhiteSpace(TextBox1.Text)) { Label1.Text = "Please enter all informations"; } else if (genre_delete_table.Rows.Count == 0) { Label1.Text = "No Genre with this Id, Please enter correct Id"; } else { string deleteQuery = string.Format("delete from cd_genre where genre_id={0}", TextBox1.Text); oc.updateDB(deleteQuery); TextBox1.Text = ""; //TextBox2.Text = ""; Label1.Text = ""; oc.close(); } }
protected void Button1_Click(object sender, EventArgs e) { OracleConnect oc = new OracleConnect("localhost", "orcl", "hr", "hr"); string adminusernamecheck = string.Format("select * from np_admin where admin_username = upper('{0}')", TextBox1.Text); DataTable admin_table = oc.searchDB(adminusernamecheck); if (String.IsNullOrWhiteSpace(TextBox1.Text) || String.IsNullOrWhiteSpace(TextBox2.Text)) { Label1.Text = "Please enter all informations"; } else if (admin_table.Rows.Count != 0) { Label1.Text = "User with this name already exists, give another user name"; } else { string insertQuery = string.Format("insert into np_admin(admin_id, admin_username,admin_password) values(np_admin_sequence.nextval, '{0}', '{1}')", TextBox1.Text.ToUpper(), TextBox2.Text); oc.updateDB(insertQuery); TextBox1.Text = ""; TextBox2.Text = ""; Label1.Text = ""; oc.close(); } }
protected void Page_Load(object sender, EventArgs e) { OracleConnect oc = new OracleConnect("localhost", "orcl", "hr", "hr"); string showQuery = "select * from cd_pay_order"; this.LoadGrid2(showQuery); oc.close(); }
protected void Button36_Click(object sender, EventArgs e) { OracleConnect oc = new OracleConnect("localhost", "orcl", "hr", "hr"); string deleteQuery = string.Format("delete from cd_history"); oc.updateDB(deleteQuery); //TextBox1.Text = ""; //TextBox2.Text = ""; //Label1.Text = ""; oc.close(); }
private void LoadGrid(string q_parameter) { OracleConnect oc = new OracleConnect("localhost", "orcl", "hr", "hr"); string query = q_parameter;//"select * from products order by id"; DataTable table = oc.searchDB(query); this.GridView1.DataSource = table; this.GridView1.DataBind(); GridView1.Visible = true; oc.close(); }
protected void Button1_Click(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(TextBox1.Text)) { Label1.Text = "Please enter all informations"; } else { OracleConnect oc = new OracleConnect("localhost", "orcl", "hr", "hr"); string insertQuery = string.Format("insert into cd_category(category_id, category_name) values(cd_category_sequence.nextval, '{0}')", TextBox1.Text); oc.updateDB(insertQuery); TextBox1.Text = ""; Label1.Text = ""; oc.close(); } }
private void LoadGrid(string q_parameter) { OracleConnect oc = new OracleConnect("localhost", "orcl", "hr", "hr"); string query = q_parameter;//"select * from products order by id"; DataTable table = oc.searchDB(query); /* if (!table.IsInitialized) * { * Label1.Visible = true; * Label1.Text = "nodata"; * * }*/ this.GridView1.DataSource = table; this.GridView1.DataBind(); GridView1.Visible = true; oc.close(); }
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { string cd_id = GridView1.SelectedRow.Cells[0].Text; string cd_name = GridView1.SelectedRow.Cells[1].Text; string price = GridView1.SelectedRow.Cells[2].Text; string user_name = TextBox1.Text; string status = "pending"; OracleConnect oc = new OracleConnect("localhost", "orcl", "hr", "hr"); string insertQuery = string.Format("insert into cd_pay_order(order_id, p_o_cd_id,p_o_cd_name,p_o_cd_price,p_o_user_name,status) values(cd_pay_order_sequence.nextval,{0},'{1}',{2},'{3}','{4}')", cd_id, cd_name, price, user_name, status); oc.updateDB(insertQuery); TextBox1.Text = ""; Label1.Text = ""; Label3.Text = "Thank You, Your order has been received for validation"; oc.close(); GridView1.Visible = false; }
protected void Button2_Click(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(TextBox1.Text) || String.IsNullOrWhiteSpace(TextBox2.Text) || String.IsNullOrWhiteSpace(TextBox3.Text) || String.IsNullOrWhiteSpace(TextBox4.Text)) { Label1.Text = "Please enter all informations"; } else { OracleConnect oc = new OracleConnect("localhost", "orcl", "hr", "hr"); string insertQuery = string.Format("insert into cd_sales_log(sales_id, purchase_date,cd_id2,user_name,user_id) values(cd_sales_log_sequence.nextval, '{0}',{1},'{2}',{3})", TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text); oc.updateDB(insertQuery); //for pay order table status update //OracleConnect oc = new OracleConnect("localhost", "orcl", "hr", "hr"); string p_o_cd_id = TextBox2.Text; string updated_status = "approved"; string status = "status"; string updateQuery = string.Format("update cd_pay_order set {0} = '{1}' where p_o_cd_id= {2}", status, updated_status, p_o_cd_id); oc.updateDB(updateQuery); //oc.close(); GridView1.Visible = false; //GridView2.Visible = false; //GridView2.DataBind(); //GridView2.Visible = true; TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; TextBox4.Text = ""; Label1.Text = ""; oc.close(); } }
protected void Button1_Click(object sender, EventArgs e) { OracleConnect oc = new OracleConnect("localhost", "orcl", "hr", "hr"); string searchQuery = string.Format("select user_id from np_user where user_name='{0}'", TextBox3.Text); //for check purpose //this.LoadGrid(searchQuery); DataTable user_id_table = oc.searchDB(searchQuery); if (user_id_table.Rows.Count == 0) { Label1.Text = "enter user name correctly"; TextBox3.Text = ""; } else { this.LoadGrid(searchQuery); } //TextBox1.Text = ""; //Label1.Text = ""; oc.close(); }