Exemple #1
0
        protected void Button3_Click(object sender, EventArgs e)
        {
            oraConnection.Open();
            string command = Technopark.SelectCommand;

            Technopark.SelectCommand = "SELECT * FROM TECHNOPARK.LEARNER order by FIO";
            Technopark.DataBind();
            GridView1.DataBind();
            oraConnection.Close();
        }
Exemple #2
0
 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (this.IsPostBack)
     {
         string command = Technopark.SelectCommand;
         Technopark.SelectCommand = "SELECT * FROM TECHNOPARK.LEARNER WHERE (FIO LIKE '%" + TextBox1.Text + "%') and ID_LEARNER!=0";
         Technopark.DataBind();
         GridView1.DataBind();
     }
 }
Exemple #3
0
 protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     if (Class_FIO.Employees_position == "1")
     {
         if (this.IsPostBack)
         {
             string command = Technopark.SelectCommand;
             Technopark.SelectCommand = "SELECT * FROM TECHNOPARK.LEARNER WHERE (FIO LIKE '%" + TextBox1.Text + "%') and ID_LEARNER!=0";
             Technopark.DataBind();
             GridView1.DataBind();
         }
         try
         {
             using (OracleConnection oraclelcon = new OracleConnection("Data Source =127.0.0.1:1521/xe; User ID =Technopark;  password = DIP1937;"))
             {
                 GridViewRow   row       = GridView1.Rows[e.RowIndex];
                 string        query     = "UPDATE TECHNOPARK.LEARNER SET FIO=:FIO, CLASS=:CLASS, BIRTHDAY=:BIRTHDAY, SCHOOL=:SCHOOL, PHONE=:PHONE, SHIFT=:SHIFT, E_MAIL=:E_MAIL, INTERESTS=:INTERESTS, COMMENTS=:COMMENTS WHERE ID_LEARNER=:ID_LEARNER";
                 OracleCommand oraclecmd = new OracleCommand(query, oraConnection);
                 oraclelcon.Open();
                 oraclecmd.Connection.Open();
                 oraclecmd.Parameters.Add("FIO", e.NewValues["FIO"]);
                 oraclecmd.Parameters.Add("CLASS", e.NewValues["CLASS"]);
                 oraclecmd.Parameters.Add("BIRTHDAY", Convert.ToDateTime(e.NewValues["BIRTHDAY"]));
                 oraclecmd.Parameters.Add("SCHOOL", e.NewValues["SCHOOL"]);
                 oraclecmd.Parameters.Add("PHONE", e.NewValues["PHONE"]);
                 oraclecmd.Parameters.Add("SHIFT", e.NewValues["SHIFT"]);
                 oraclecmd.Parameters.Add("E_MAIL", e.NewValues["E_MAIL"]);
                 oraclecmd.Parameters.Add("INTERESTS", e.NewValues["INTERESTS"]);
                 oraclecmd.Parameters.Add("COMMENTS", e.NewValues["COMMENTS"]);
                 oraclecmd.Parameters.Add("ID_LEARNER", GridView1.DataKeys[e.RowIndex].Value);
                 oraclecmd.ExecuteNonQuery();
                 GridView1.EditIndex = -1;
             }
         }
         catch
         {
             Label1.Visible = true;
             Label1.Text    = "Проверьте введенные данные!";
         }
     }
     else
     {
         Response.Write("<script>alert('Только методист может редактировать данные!')</script>");
         //Response.Write(@"<script language='javascript'>alert('This is my Message')</script>");
         //Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "SCRIPT", string.Format("alert('Hello World')"), true);
     }
 }
Exemple #4
0
 protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
 {
     if (Class_FIO.Employees_position == "1")
     {
         if (this.IsPostBack)
         {
             string command = Technopark.SelectCommand;
             Technopark.SelectCommand = "SELECT * FROM TECHNOPARK.LEARNER WHERE (FIO LIKE '%" + TextBox1.Text + "%') and ID_LEARNER!=0";
             Technopark.DataBind();
             GridView1.DataBind();
         }
         GridView1.EditIndex = e.NewEditIndex;
         GridView1.DataBind();
     }
     else
     {
         Response.Write("<script>alter('Ошибка');</script>");
     }
 }
Exemple #5
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            oraConnection.Open();
            if (TextBox1.Text != "")
            {
                string command = Technopark.SelectCommand;
                Technopark.SelectCommand = "SELECT * FROM TECHNOPARK.LEARNER WHERE (FIO LIKE '%" + TextBox1.Text + "%') and ID_LEARNER!=0";
                Technopark.DataBind();
                GridView1.DataBind();
            }

            else
            {
                string command = Technopark.SelectCommand;
                Technopark.SelectCommand = "SELECT * FROM TECHNOPARK.LEARNER";
                Technopark.DataBind();
                GridView1.DataBind();
            }
            oraConnection.Close();
        }