Exemplo n.º 1
0
 protected void DeleteAdmin_RowCommand(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         c   = new ConnectionDAO();
         con = c.GetConnection();
         con.Open();
         //SqlCommand cmd = new SqlCommand("delete from Login where Username='******';",con);
         SqlCommand cmd = new SqlCommand("delete from Login1 where AdminId=@id", con);
         cmd.Parameters.AddWithValue("@id", Convert.ToInt32(AdminAdd.DataKeys[e.RowIndex].Value.ToString()));
         cmd.ExecuteNonQuery();
         populateGridview();
         Label3.Text = "Select Record Deleted";
         con.Close();
     }
     catch (Exception ex)
     {
         Label4.Text = ex.Message;
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            c   = new ConnectionDAO();
            con = c.GetConnection();
            if (!IsPostBack)
            {
                SqlCommand cmd = new SqlCommand("Select MAX(DocId) from DocTable", con);
                con.Open();
                LabeleId.Text = ((int)cmd.ExecuteScalar() + 1).ToString();
                con.Close();
                Display();

                SqlCommand cmd1 = new SqlCommand("Select Speciality from DocAdd", con);
                con.Open();
                SqlDataReader sdr = cmd1.ExecuteReader();
                DataTable     dtb = new DataTable();
                dtb.Load(sdr);
                DDLDoctorType.DataSource     = dtb;
                DDLDoctorType.DataTextField  = "Speciality";
                DDLDoctorType.DataValueField = "Speciality";
                DDLDoctorType.DataBind();
                con.Close();
            }
        }
Exemplo n.º 3
0
        protected void AddAdmin_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            ConnectionDAO c;
            SqlConnection con;

            try
            {
                if (e.CommandName.Equals("Add"))
                {
                    c   = new ConnectionDAO();
                    con = c.GetConnection();
                    con.Open();
                    SqlCommand cmd = new SqlCommand("insert into Login1 values('" + (AdminAdd.FooterRow.FindControl("TextBox1foot") as TextBox).Text.Trim() + "','" + (AdminAdd.FooterRow.FindControl("TextBox2foot") as TextBox).Text.Trim() + "');", con);
                    cmd.ExecuteNonQuery();
                    populateGridview();
                    Label3.Text = "New Record Added";
                    con.Close();
                }
            }
            catch (Exception ex)
            {
                Label4.Text = ex.Message;
            }
        }
Exemplo n.º 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     c   = new ConnectionDAO();
     con = c.GetConnection();
 }
Exemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     c   = new ConnectionDAO();
     con = c.GetConnection();
     Session["PassRecov"] = "AdminPassword";
 }