protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int rowIndex = Convert.ToInt32(e.CommandArgument);

            GridViewRow row = GridView1.Rows[rowIndex];

            TextBox1.Text = row.Cells[7].Text;

            GridView1.SelectedIndex = -1;


            if (e.CommandName == "SelectCH")
            {
                Scheduler_Data_Repet_UPDATE_OL.Update();
            }
            else
            if (e.CommandName == "SelectDEL")
            {
                Scheduler_Data_Repet.Delete();
            }
            else
            if (e.CommandName == "SelectEdit")
            {
                GridView1.EditIndex = rowIndex;
            }
            Scheduler_Data_Repet.DataBind();
            GridView1.DataBind();
        }
示例#2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            TextBox4.Text = Request.Form["selectedcolor"];

            if (DropDownList2.SelectedValue == "0" || DropDownList3.SelectedValue == "0" || DropDownList4.SelectedValue == "10" || DropDownList5.SelectedValue == "0")
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                        "alertMessage",
                                                        "alert(' Ελλειπή Στοιχεία ');", true);
            }
            else
            {
                Scheduler_Data.Insert();

                int iDay        = Convert.ToInt16(DropDownList2.SelectedValue);
                int iMonStart   = Convert.ToInt16(DropDownList3.SelectedValue);
                int iMonRep     = Convert.ToInt16(DropDownList4.SelectedValue);
                int iYear       = Convert.ToInt16(DropDownList5.SelectedValue);
                int ifornewyear = 0;
                if (iMonRep == 0)
                {
                    for (int j = 0; j < iYear; j++)
                    {
                        TextBox2.Text = iMonStart.ToString();
                        TextBox3.Text = j.ToString();
                        Scheduler_Data_Repet.Insert();
                    }
                }
                else
                {
                    for (int j = 0; j < iYear; j++)
                    {
                        TextBox3.Text = j.ToString();



                        for (int i = iMonStart; i <= 12; i = i + iMonRep)
                        {
                            TextBox2.Text = i.ToString();
                            Scheduler_Data_Repet.Insert();
                            ifornewyear = i;
                        }
                        iMonStart = (ifornewyear + iMonRep - 12);
                    }
                }

                TextBox1.Text = "";
                TextBox2.Text = "";
                TextBox3.Text = "";
                DropDownList1.SelectedValue = "0";
                DropDownList2.SelectedValue = "0";
                DropDownList3.SelectedValue = "0";
                DropDownList4.SelectedValue = "10";
                DropDownList5.SelectedValue = "0";
            }
        }