Exemple #1
0
        protected void DelButton1_Click(object sender, EventArgs e)
        {
            SqlDataSource4.Delete();


            SqlDataSource5.Delete();
        }
Exemple #2
0
    protected void AssertionsGrid_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int intRowIndex = e.RowIndex;

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

        string strWS_ID = ""; // = "6";

        strWS_ID = AssertionsGrid.DataKeys[row.RowIndex]["target_WSID"].ToString();

        string strMethodID   = AssertionsGrid.DataKeys[row.RowIndex]["method_id"].ToString();
        string strRuleID     = AssertionsGrid.DataKeys[row.RowIndex]["rule_id"].ToString();
        string strRuleItemID = AssertionsGrid.DataKeys[row.RowIndex]["rule_item_id"].ToString();
        string strResourceID = AssertionsGrid.DataKeys[row.RowIndex]["resource_id"].ToString();

        try
        {
            AssertionsGrid.DataBind();
            SqlDataSource4.DeleteCommand     = "spDelete_AssertionWS_FromGrid";
            SqlDataSource4.DeleteCommandType = SqlDataSourceCommandType.StoredProcedure;
            SqlDataSource4.DeleteParameters["ws_id"].DefaultValue        = strWS_ID;
            SqlDataSource4.DeleteParameters["method_id"].DefaultValue    = strMethodID;
            SqlDataSource4.DeleteParameters["rule_id"].DefaultValue      = strRuleID;
            SqlDataSource4.DeleteParameters["rule_item_id"].DefaultValue = strRuleItemID;
            SqlDataSource4.DeleteParameters["resource_id"].DefaultValue  = strResourceID;

            // ***************  extra items to avoid bug (Microsoft counts added Key values as part of procedure params)
            SqlDataSource4.DeleteParameters["target_WSID"].DefaultValue    = "";
            SqlDataSource4.DeleteParameters["topic_id"].DefaultValue       = "";
            SqlDataSource4.DeleteParameters["level_id"].DefaultValue       = "";
            SqlDataSource4.DeleteParameters["domain_id"].DefaultValue      = "";
            SqlDataSource4.DeleteParameters["scope_id"].DefaultValue       = "";
            SqlDataSource4.DeleteParameters["weight"].DefaultValue         = "";
            SqlDataSource4.DeleteParameters["mandatory_flag"].DefaultValue = "";
            SqlDataSource4.DeleteParameters["target_ws_id"].DefaultValue   = "";
            //********************************************

            SqlDataSource4.Delete();
        }
        catch (Exception exc)
        {
            var dataFile = Server.MapPath("~/App_Data/ErrorLog.txt");
            File.AppendAllText(@dataFile, "Privacy Policies, AssertionsGrid_RowDeleting: " + exc.Message.ToString());
        }
        finally
        {
        }
    }
Exemple #3
0
    protected void AssertionsGrid_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int intRowIndex = e.RowIndex;

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

        string strWS_ID      = "6";
        string strMethodID   = AssertionsGrid.DataKeys[row.RowIndex]["method_id"].ToString();
        string strRuleID     = AssertionsGrid.DataKeys[row.RowIndex]["rule_id"].ToString();
        string strRuleItemID = AssertionsGrid.DataKeys[row.RowIndex]["rule_item_id"].ToString();
        string strResourceID = AssertionsGrid.DataKeys[row.RowIndex]["resource_id"].ToString();

        try
        {
            AssertionsGrid.DataBind();
            SqlDataSource4.DeleteCommand     = "spDelete_AssertionClient_FromGrid";
            SqlDataSource4.DeleteCommandType = SqlDataSourceCommandType.StoredProcedure;
            SqlDataSource4.DeleteParameters["ws_id"].DefaultValue        = strWS_ID;
            SqlDataSource4.DeleteParameters["method_id"].DefaultValue    = strMethodID;
            SqlDataSource4.DeleteParameters["rule_id"].DefaultValue      = strRuleID;
            SqlDataSource4.DeleteParameters["rule_item_id"].DefaultValue = strRuleItemID;
            SqlDataSource4.DeleteParameters["resource_id"].DefaultValue  = strResourceID;

            // ***************  extra items to avoid bug (Microsoft counts added Key values as part of procedure params)
            SqlDataSource4.DeleteParameters["target_WSID"].DefaultValue = "";
            SqlDataSource4.DeleteParameters["topic_id"].DefaultValue    = "";
            SqlDataSource4.DeleteParameters["level_id"].DefaultValue    = "";
            SqlDataSource4.DeleteParameters["domain_id"].DefaultValue   = "";
            SqlDataSource4.DeleteParameters["scope_id"].DefaultValue    = "";

            SqlDataSource4.DeleteParameters["weight"].DefaultValue         = "";
            SqlDataSource4.DeleteParameters["mandatory_flag"].DefaultValue = "";
            SqlDataSource4.DeleteParameters["target_ws_id"].DefaultValue   = "";
            //********************************************

            SqlDataSource4.Delete();
        }
        catch (Exception exc)
        {
        }
        finally
        {
        }
    }
        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.";
            }
        }
        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";
        }