Exemple #1
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string strWSID       = drpWebService.SelectedValue;
        string strMethodID   = drpMethods.SelectedItem.Value;
        string strRuleID     = txtRuleID.Text;
        string strRuleItemID = txtRuleItemID.Text;
        string strResourceID = drpResources.SelectedItem.Value;

        int  intWS_ID, intMethodID, intRule_ID, intRule_Item_ID, intResource_ID;
        bool success = false;

        success = int.TryParse(strWSID, out intWS_ID);
        success = int.TryParse(strMethodID, out intMethodID);
        success = int.TryParse(strRuleID, out intRule_ID);
        success = int.TryParse(strRuleItemID, out intRule_Item_ID);
        success = int.TryParse(strResourceID, out intResource_ID);

        System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection();

        conn.ConnectionString = ConfigurationManager.ConnectionStrings["WSProjectConnectionString"].ConnectionString;

        try
        {
            conn.Open();
            //***************************************
            // get the info for the web service

            SqlCommand cmd = new SqlCommand("spAdd_AssertionWS_FromGrid");
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@ws_id", SqlDbType.Int)).Value        = intWS_ID;
            cmd.Parameters.Add(new SqlParameter("@method_id", SqlDbType.Int)).Value    = intMethodID;
            cmd.Parameters.Add(new SqlParameter("@rule_id", SqlDbType.Int)).Value      = intRule_ID;
            cmd.Parameters.Add(new SqlParameter("@rule_item_id", SqlDbType.Int)).Value = intRule_Item_ID;
            cmd.Parameters.Add(new SqlParameter("@resource_id", SqlDbType.Int)).Value  = intResource_ID;
            SqlParameter param = new SqlParameter("@ReturnMessage", SqlDbType.NVarChar);
            param.Direction = ParameterDirection.Output;
            param.Size      = 500;
            cmd.Parameters.Add(param);
            cmd.Connection = conn;

            var    retInfo          = cmd.ExecuteNonQuery();
            string strReturnMessage = cmd.Parameters["@ReturnMessage"].Value.ToString();
            lblAssertionAdd.Text = strReturnMessage;
            AssertionsGrid.DataBind();
        }
        catch (Exception exc)
        {
            var dataFile = Server.MapPath("~/App_Data/ErrorLog.txt");
            File.AppendAllText(@dataFile, "Privacy Policies, btnSubmit_Click: " + exc.Message.ToString());
        }
        finally
        {
            conn.Close();
        }
    }
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
        {
        }
    }
Exemple #4
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string strMethodID      = drpMethods.SelectedItem.Value;
        string strRuleID        = txtRuleID.Text;
        string strRuleItemID    = txtRuleItemID.Text;
        string strResourceID    = drpResources.SelectedItem.Value;
        string strWeight        = txtWeight.Text;
        bool   blnMandatoryFlag = chkMandatory.Checked;
        string strTargetWSID    = drpWebService.SelectedItem.Value;

        int   intWS_ID, intMethodID, intRule_ID, intRule_Item_ID, intResource_ID, intTarget_WS_ID;
        float flWeight;
        bool  success = false;

        intWS_ID = 6; // client assertion being added
        success  = int.TryParse(strMethodID, out intMethodID);
        success  = int.TryParse(strRuleID, out intRule_ID);
        success  = int.TryParse(strRuleItemID, out intRule_Item_ID);
        success  = int.TryParse(strResourceID, out intResource_ID);
        success  = float.TryParse(strWeight, out flWeight);
        success  = int.TryParse(strTargetWSID, out intTarget_WS_ID);

        // need to put in form where drop imprecise last digits of float
        string strTotalWeight = flWeight.ToString("0.##");

        success = float.TryParse(strTotalWeight, out flWeight);


        if (flWeight == 0)
        {
            lblAssertionAdd.Text = "Assertions can not have a weight of zero.";
            return;
        }

        System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection();
        conn.ConnectionString = ConfigurationManager.ConnectionStrings["WSProjectConnectionString"].ConnectionString;

        try
        {
            conn.Open();
            //***************************************
            // get the info for the web service

            SqlCommand cmd = new SqlCommand("spAdd_AssertionClient_FromGrid");
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@ws_id", SqlDbType.Int)).Value          = intWS_ID;
            cmd.Parameters.Add(new SqlParameter("@method_id", SqlDbType.Int)).Value      = intMethodID;
            cmd.Parameters.Add(new SqlParameter("@rule_id", SqlDbType.Int)).Value        = intRule_ID;
            cmd.Parameters.Add(new SqlParameter("@rule_item_id", SqlDbType.Int)).Value   = intRule_Item_ID;
            cmd.Parameters.Add(new SqlParameter("@resource_id", SqlDbType.Int)).Value    = intResource_ID;
            cmd.Parameters.Add(new SqlParameter("@weight", SqlDbType.Float)).Value       = flWeight;
            cmd.Parameters.Add(new SqlParameter("@mandatory_flag", SqlDbType.Bit)).Value = blnMandatoryFlag;
            cmd.Parameters.Add(new SqlParameter("@target_ws_id", SqlDbType.Int)).Value   = intTarget_WS_ID;

            cmd.Connection = conn;
            SqlDataReader reader;
            reader = cmd.ExecuteReader();

            reader.Read();
            string strReturnMessage = reader.GetValue(0).ToString();

            lblAssertionAdd.Text = strReturnMessage;

            AssertionsGrid.DataBind();

            //****************************************
        }
        catch (Exception exc)
        {
            var dataFile = Server.MapPath("~/App_Data/ErrorLog.txt");
            File.AppendAllText(@dataFile, "Privacy Requirements, btnSubmit_Click: " + exc.Message.ToString());
        }
        finally
        {
            conn.Close();
        }
    }