Esempio n. 1
0
    /// <summary>
    /// Handles Lab Kit delete button click.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnkDelete_Click(object sender, EventArgs e)
    {
        // this is a hidden field in the table with a Lab Kit ID
        string Guid = ((sender as Control).Parent.Parent.Controls[1] as DataControlFieldCell).Text;

        // since we're deleting the Lab Kit, we get rid of the session variable. we're no longer editing anything
        if (!string.IsNullOrEmpty((string)Session["EditLabKitID"]) && Guid == Session["EditLabKitID"].ToString())
        {
            Session["EditLabKitID"] = string.Empty;
        }

        // delete the lab kit and log this
        try
        {
            bi.DeleteLabKit(Guid);
            Log.Info(Context.User.Identity.Name, Request.FilePath, Session, "Delete Lab Kit", Guid);
        }
        catch (Exception ex)
        {
            Log.Error(Context.User.Identity.Name, Request.FilePath, Session, "Delete Lab Kit Failed", string.Empty, ex);
        }

        // refresh the lab kits
        DataTable dt = null;

        dt = bi.GetLabKits();
        this.gvLabKits.DataSource = dt;
        this.gvLabKits.DataBind();

        // show the right panels
        this.pnlSearch.Visible = false;
        this.pnlGrid.Visible   = false;
        this.pnlDropIn.Visible = false;
    }