protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        foreach (GridViewRow row in GridView1.Rows)
        {
            if (row.RowIndex == GridView1.SelectedIndex)
            {
                //row.RowIndex gives the current row nr
                SqlDataSource3.DeleteCommand = "DELETE FROM [TIMESLOTS] WHERE Timeslot =" +
                                               "\"" + GridView1.Rows[row.RowIndex].Cells[2].Text + "\" AND " +
                                               "Patient = " + "\"" + GridView1.Rows[row.RowIndex].Cells[3].Text + "\" AND " +
                                               "DoctorName=" + "\"" + GridView1.Rows[row.RowIndex].Cells[5].Text + "\" AND " +
                                               "AppointmentDate=" + "\"" + GridView1.Rows[row.RowIndex].Cells[6].Text + "\";";

                SqlDataSource3.DataBind();
                SqlDataSource3.Delete();

                GridView1.DataBind();
                if (GridView1.Rows.Count == 0)
                {
                    Label4.Text = "You currently do not have any appointments.";
                }
                else
                {
                    Label4.Text = "The appointment was successfully canceled!";
                }
            }
        }
    }
Exemplo n.º 2
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        try
        {
            SqlDataSource3.Delete();
            Response.Write("<script language=javascript>alert('留言刪除成功!')</script>");

            Response.Write("<script language=javascript>window.location.href='3.aspx'</script>");
        }
        catch
        {
            Label1.Text = "留言刪除失敗!";
        }
    }
Exemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         SqlDataSource1.Delete();
         SqlDataSource2.Delete();
         SqlDataSource3.Delete();
         Response.Write("<script>alert('School Deleted Successfully...')</script>");
         Server.Transfer("Registration.aspx");
     }
     catch (Exception er)
     {
         Response.Write(er);
     }
 }
        protected void delete_Click(object sender, EventArgs e)
        {
            if (MUsername.Text != "")
            {
                DataView obstaja = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);

                if (!((obstaja[0][0].ToString()).Equals(null)))
                {
                    SqlDataSource4.DeleteParameters["username"].DefaultValue = MUsername.Text;

                    SqlDataSource4.Delete();

                    SqlDataSource3.DeleteParameters["original_username"].DefaultValue = MUsername.Text;

                    SqlDataSource3.Delete();

                    Label1.Text = "Uporabnik uspešno zbrisan.";

                    /*ListBox1.Items.Clear();
                     * DataView totalMessages = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);
                     *
                     * for (int i = 0; i <= totalMessages.Count - 1; i++)
                     * {
                     *  ListBox1.Items.Add(totalMessages[i][0].ToString() + ": " + totalMessages[i][1]);
                     * }
                     */
                    refresh();
                }
                else
                {
                    Label1.Text = "Uporabnik ne obstaja.";
                }
            }
            else
            {
                Label1.Text = "Prosim dopolnite polje.";
            }
        }
Exemplo n.º 5
0
    protected void grdWSPrivPolicyItems_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int intRowIndex = e.RowIndex;

        grdWSPrivPolicyItems.SelectRow(intRowIndex);
        GridViewRow row = grdWSPrivPolicyItems.SelectedRow;

        string strWSID       = row.Cells[1].Text;
        string strRuleID     = row.Cells[3].Text;
        string strRuleItemID = row.Cells[4].Text;

        int  intRule_ID, intRule_Item_ID;
        bool success1 = int.TryParse(strRuleID, out intRule_ID);
        bool success2 = int.TryParse(strRuleItemID, out intRule_Item_ID);

        try
        {
            SqlDataSource3.DeleteCommand     = "spDelete_PrivacyRuleSetItem_ForWS_FromGrid";
            SqlDataSource3.DeleteCommandType = SqlDataSourceCommandType.StoredProcedure;
            SqlDataSource3.DeleteParameters["ws_id"].DefaultValue        = strWSID;
            SqlDataSource3.DeleteParameters["rule_id"].DefaultValue      = strRuleID;
            SqlDataSource3.DeleteParameters["rule_item_id"].DefaultValue = strRuleItemID;
            SqlDataSource3.Delete();

            lblStatusMessage_ClientPrivacyRules.Text = "* Item has been deleted (unless it is being used by an assertion).";
        }
        catch (Exception exc)
        {
            lblStatusMessage_ClientPrivacyRules.Text = "* Message: Error Deleting Rule Item From WS";

            var dataFile = Server.MapPath("~/App_Data/ErrorLog.txt");
            File.AppendAllText(@dataFile, "Privacy Policies, grdWSPrivPolicyItems_RowDeleting: " + exc.Message.ToString());
        }
        finally
        {
        }
    }
Exemplo n.º 6
0
        protected void DiseaseDataSource_Inserted(object sender, SqlDataSourceStatusEventArgs e)
        {
            String Data_Id = Request.QueryString["boosh"];

            string txt2 = txtValues.Text;

            string[] newlist         = txt2.Split(new Char[] { ';', '\\' }, StringSplitOptions.RemoveEmptyEntries);
            string[] IdSstring       = new String[newlist.Length];
            System.Data.DataTable dt = new System.Data.DataTable();
            string        bush       = string.Empty;
            SqlConnection connection = new SqlConnection("Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\\DiseaseDatabase.mdf;Integrated Security=True");

            connection.Open();

            Disease_SymptomsDataSource.DeleteCommandType = SqlDataSourceCommandType.Text;
            Disease_SymptomsDataSource.DeleteCommand     = "DELETE FROM Disease_Symptoms WHERE [Disease_Id] = " + Data_Id + "";

            Disease_SymptomsDataSource.Delete();

            DataTable  dt3     = new DataTable();
            SqlCommand sqlCmd3 = new SqlCommand("SELECT * from Symptoms ", connection);
            // sqlCmd3.Parameters.AddWithValue("@username", user);
            SqlDataAdapter sqlDa3 = new SqlDataAdapter(sqlCmd3);

            sqlDa3.Fill(dt3);

            int comcheck = 0;
            int Incre    = 0;
            int DSincr   = 0;

            while (comcheck < newlist.Length)
            {
                for (int hu = 0; hu < dt3.Rows.Count; hu++)
                {
                    if (newlist[comcheck] == dt3.Rows[hu]["Name"].ToString())
                    {
                        IdSstring[Incre] = dt3.Rows[hu]["Id"].ToString();
                        Incre++;
                        break;
                    }
                }
                comcheck++;
            }
            for (int q = 0; q < IdSstring.Length; q++)
            {
                string Sym_Check = "Symp" + q;
                Disease_SymptomsDataSource.InsertParameters.Add(Sym_Check, newlist[q]);
                Disease_SymptomsDataSource.InsertCommandType = SqlDataSourceCommandType.Text;
                Disease_SymptomsDataSource.InsertCommand     = "INSERT INTO Disease_Symptoms(Disease_Id, Symptom_Id) VALUES(" + Data_Id + ", " + IdSstring[q] + ")";

                Disease_SymptomsDataSource.Insert();
            }

            String s   = Request.QueryString["boosh"];
            string txt = TextBox5.Text;

            string[] lst = txt.Split(new Char[] { '\n', '\r', ' ' }, StringSplitOptions.RemoveEmptyEntries);

            string[] Add = new String[lst.Length];;

            //int a = lst.Length;

            DataTable dtAliases = new DataTable();

            DataTable  dtAl     = new DataTable();
            SqlCommand sqlCmdAl = new SqlCommand("SELECT * from Aliases WHERE Disease_Id = " + s + "", connection);

            sqlCmdAl.Parameters.AddWithValue("@username", s);
            SqlDataAdapter sqlDaAl = new SqlDataAdapter(sqlCmdAl);



            //SqlDataSource3.DeleteParameters.Add(check1, Delete[aop]);
            SqlDataSource3.DeleteCommandType = SqlDataSourceCommandType.Text;
            SqlDataSource3.DeleteCommand     = "DELETE FROM Aliases WHERE Aliases.Disease_Id = " + s + "";
            SqlDataSource3.Delete();

            for (int a = 0; a < lst.Length; a++)
            {
                string check = "AliasName" + a;
                SqlDataSource3.InsertParameters.Add(check, lst[a]);
                SqlDataSource3.InsertCommandType = SqlDataSourceCommandType.Text;
                SqlDataSource3.InsertCommand     = "INSERT INTO Aliases(Name, Disease_Id) VALUES(@" + check + ", " + Data_Id + ")";
                SqlDataSource3.Insert();
            }

            DataTable  dtVe     = new DataTable();
            SqlCommand sqlCmdVe = new SqlCommand("SELECT * from Disease_Vectors WHERE Disease_Id = " + s + "", connection);

            sqlCmdAl.Parameters.AddWithValue("@username", s);
            SqlDataAdapter sqlDaVe = new SqlDataAdapter(sqlCmdVe);


            sqlDaVe.Fill(dtVe);
            CheckBoxList chkbx = (CheckBoxList)FindControl("CheckBoxList1");



            //SqlDataSource4.DeleteParameters.Add(check1, Delete1[b]);
            SqlDataSource4.DeleteCommandType = SqlDataSourceCommandType.Text;
            SqlDataSource4.DeleteCommand     = "DELETE FROM Disease_Vectors WHERE [Disease_Id] = " + s + "";

            SqlDataSource4.Delete();

            for (int fo = 0; fo < 5; fo++)
            {
                string check12 = "Vector_Id" + fo;
                if (CheckBoxList1.Items[fo].Selected)
                {
                    SqlDataSource4.InsertParameters.Add(check12, CheckBoxList1.Items[fo].Value);
                    SqlDataSource4.InsertCommandType = SqlDataSourceCommandType.Text;
                    SqlDataSource4.InsertCommand     = "INSERT INTO Disease_Vectors(Disease_Id, Vector_Id) VALUES(" + Data_Id + ", @" + check12 + ")";

                    SqlDataSource4.Insert();
                }
            }



            //"INSERT INTO Disease_Vectors(Disease_Id, Vector_Id) VALUES(" + Data_Id + ", @" + check1 + ")"
            //String myStringVariable = "Disease Updated";
        }