Beispiel #1
0
        protected void UpdateClick(object sender, EventArgs e)
        {
            try
            {
                GridViewRow      row  = (sender as LinkButton).NamingContainer as GridViewRow;
                OracleConnection conn = new OracleConnection("Data Source =XE; User ID = system; Password= Wright2015");
                OracleCommand    cmd;
                lblmsgforupdateadmin.Visible = false;

                conn.Open();
                DataTable checkdt = new DataTable();
                TextBox   tc      = (TextBox)row.Cells[0].FindControl("TextBox1");
                TextBox   tc1     = (TextBox)row.FindControl("TextBox2");
                TextBox   tc2     = (TextBox)row.FindControl("TextBox3");

                Gridviewadminfroupdate.EditIndex = -1;
                OracleDataAdapter oadp = new OracleDataAdapter("SELECT count(*) FROM PARKING_DETAILS,PARKS  where PARKING_DETAILS.PARKID= '" + dt.Rows[row.RowIndex]["PARKID"].ToString() + "' AND PARKING_DETAILS.PARKID = PARKS.PARKID AND PARKS.PARKDATE>= TRUNC(CURRENT_DATE)", conn);
                oadp.Fill(checkdt);
                if (Convert.ToInt32(checkdt.Rows[0]["count(*)"].ToString()) > 0)
                {
                    lblmsgforupdateadmin.Text         = " Details for this ParkID for current day cannot be upated as some user have registered for this Parking space ";
                    lblmsgforupdateadmin.Visible      = true;
                    Gridviewadminfroupdate.DataSource = dt;
                    Gridviewadminfroupdate.DataBind();
                }
                else
                {
                    dt.Rows[row.RowIndex]["PArkarea"]    = tc.Text;
                    dt.Rows[row.RowIndex]["PARKZIPCODE"] = tc1.Text;
                    dt.Rows[row.RowIndex]["PARKLOTNO"]   = tc2.Text;

                    String commandtext = "UPDATE PARKING_DETAILS SET PARKAREA = '" + tc.Text + "',PARKZIPCODE='" + tc1.Text + "',PARKLOTNO='" + tc2.Text + "' WHERE PARKID = '" + dt.Rows[row.RowIndex]["PARKID"].ToString() + "'";
                    cmd = new OracleCommand(commandtext, conn);
                    cmd.ExecuteNonQuery();
                    Gridviewadminfroupdate.DataSource = dt;
                    Gridviewadminfroupdate.DataBind();
                    cmd.Dispose();
                }
                conn.Close();
            }
            catch (Exception ex)
            {
            }
        }
Beispiel #2
0
 protected void btnupdateadmin_Click(object sender, EventArgs e)
 {
     try
     {
         Pnlforadminupdate.Visible           = true;
         Pnlforadmin.Visible                 = false;
         Pnladmintosearchuserdetails.Visible = false;
         pnlfordeleteadmin.Visible           = false;
         dt.Clear();
         OracleConnection conn = new OracleConnection("Data Source =XE; User ID = system; Password= Wright2015");
         conn.Open();
         OracleDataAdapter Odataadapter = new OracleDataAdapter("SELECT * FROM PARKING_DETAILS", conn);
         Pnlforadmin.Visible = false;
         Odataadapter.Fill(dt);
         Gridviewadminfroupdate.DataSource = dt;
         Gridviewadminfroupdate.DataBind();
         conn.Close();
     }
     catch (Exception ex)
     {
         Response.Write("Error in btnupdateadmin_click" + ex.Message);
     }
 }
Beispiel #3
0
 protected void On_Rowediting(object sender, GridViewEditEventArgs e)
 {
     Gridviewadminfroupdate.EditIndex  = e.NewEditIndex;
     Gridviewadminfroupdate.DataSource = dt;
     Gridviewadminfroupdate.DataBind();
 }
Beispiel #4
0
 protected void CancelClick(object sender, EventArgs e)
 {
     Gridviewadminfroupdate.EditIndex  = -1;
     Gridviewadminfroupdate.DataSource = dt;
     Gridviewadminfroupdate.DataBind();
 }