protected void btn_add_Click(object sender, EventArgs e) { try { tbl_voluntar_BAL objbal = new tbl_voluntar_BAL(); tbl_voluntar_DAL objdal = new tbl_voluntar_DAL(); cryptography objcrypt = new cryptography(); string str = objcrypt.Encrypt(txt_password.Text); objdal.int_voluntar_team_id = Convert.ToInt16(ddl_voluntar_team.SelectedItem.Value); objdal.str_voluntar_name = txt_voluntar_name.Text; objdal.str_address = txt_address.Text; objdal.int_contact = Convert.ToInt64(txt_contact.Text); objdal.str_email = txt_email.Text; objdal.str_password = str; int val = objbal.insert_data(objdal); if (val > 0) { binddata(""); lblmsg.Text = "Data successfully inserted"; lblmsg.ForeColor = System.Drawing.Color.Green; } changepanel(1, 0); } catch (Exception ex) { } }
protected void btn_login_Click(object sender, EventArgs e) { try { tbl_voluntar_BAL objbal = new tbl_voluntar_BAL(); cryptography objcrypt = new cryptography(); string query = "where str_email='" + txt_voluntar_name.Text + "'"; DataSet ds = objbal.getdata(query); if (ds.Tables[0].Rows.Count > 0) { string str = objcrypt.Decrypt(ds.Tables[0].Rows[0]["str_password"].ToString()); if (str.Equals(txt_password.Text)) { Session["vname"] = txt_voluntar_name.Text; Session["vtype"] = "v"; Response.Redirect("inquiry_reply_page.aspx"); } } } catch (Exception ex) { } }
private void bindddlvoluntar() { tbl_voluntar_BAL objbal = new tbl_voluntar_BAL(); DataSet ds = objbal.getdata(""); ddl_voluntar.DataValueField = "int_voluntar_id"; ddl_voluntar.DataTextField = "str_voluntar_name"; ddl_voluntar.DataSource = ds; ddl_voluntar.DataBind(); ddl_voluntar.Items.Insert(0, new ListItem("---select---", "0")); }
public void binddata(string query) { try { tbl_voluntar_BAL objbal = new tbl_voluntar_BAL(); DataSet ds = objbal.getdata(query); gvlist.DataSource = ds; gvlist.DataBind(); } catch (Exception ex) { } }
protected void btn_select_delete_Click(object sender, EventArgs e) { try { tbl_voluntar_BAL objbal = new tbl_voluntar_BAL(); tbl_voluntar_DAL objdal = new tbl_voluntar_DAL(); foreach (GridViewRow row in gvlist.Rows) { var check = row.FindControl("chkselect") as CheckBox; if (check.Checked) { var id = row.FindControl("Hiddenid") as HiddenField; objdal.int_voluntar_id = Convert.ToInt16(id.Value); objbal.delete_data(objdal); binddata(""); } } } catch (Exception ex) { } }
protected void btn_update_Click(object sender, EventArgs e) { try { tbl_voluntar_BAL objbal = new tbl_voluntar_BAL(); tbl_voluntar_DAL objdal = new tbl_voluntar_DAL(); objdal.int_voluntar_id = Convert.ToInt16(ViewState["id"]); objdal.int_voluntar_team_id = Convert.ToInt16(ddl_voluntar_team.SelectedItem.Value); objdal.str_voluntar_name = txt_voluntar_name.Text; objdal.str_address = txt_address.Text; objdal.int_contact = Convert.ToInt64(txt_contact.Text); objdal.str_email = txt_email.Text; objdal.str_password = txt_password.Text; lblmsg.Visible = true; int val = objbal.update_data(objdal); binddata(""); changepanel(1, 0); if (val > 0) { lblmsg.Text = "Data Update"; lblmsg.ForeColor = System.Drawing.Color.Green; } else { lblmsg.Text = "Error in Process,try again"; lblmsg.ForeColor = System.Drawing.Color.Red; } } catch (Exception ex) { } }