Esempio n. 1
0
        /// <summary>
        /// Create a new Project_Organisms object.
        /// </summary>
        /// <param name="projectOrganismID">Initial value of the ProjectOrganismID property.</param>
        /// <param name="projectID">Initial value of the ProjectID property.</param>
        /// <param name="organismID">Initial value of the OrganismID property.</param>
        /// <param name="createdDate">Initial value of the CreatedDate property.</param>
        /// <param name="editedDate">Initial value of the EditedDate property.</param>
        public static Project_Organisms CreateProject_Organisms(global::System.Int32 projectOrganismID, global::System.Int32 projectID, global::System.Int32 organismID, global::System.DateTime createdDate, global::System.DateTime editedDate)
        {
            Project_Organisms project_Organisms = new Project_Organisms();

            project_Organisms.ProjectOrganismID = projectOrganismID;
            project_Organisms.ProjectID         = projectID;
            project_Organisms.OrganismID        = organismID;
            project_Organisms.CreatedDate       = createdDate;
            project_Organisms.EditedDate        = editedDate;
            return(project_Organisms);
        }
Esempio n. 2
0
    protected void ButtonDeleteSelected_Click(object sender, System.EventArgs e)
    {
        try
        {
            // Create a List to hold the OrganismID values to delete
            List <Int32> OrganismIDsToDelete = new List <Int32>();

            // Iterate through the Organisms.Rows property
            foreach (GridViewRow row in gridViewOrganisms.Rows)
            {
                // Access the CheckBox
                CheckBox cb = (CheckBox)(row.FindControl("chkOrganismSelector"));
                if (cb != null && cb.Checked)
                {
                    // Save the OrganismID value for deletion
                    // First, get the OrganismID for the selected row
                    Int32 OrganismID = (Int32)gridViewOrganisms.DataKeys[row.RowIndex].Value;
                    Project_OrganismsBLL project_OrganismsBLL = new Project_OrganismsBLL();
                    Eisk.BusinessEntities.Project_Organisms project_Organisms = project_OrganismsBLL.GetProject_OrganismByProjectIDOrganismID(Convert.ToInt32((Page.RouteData.Values["project_id"] as string)), OrganismID);

                    // Add it to the List...
                    OrganismIDsToDelete.Add(project_Organisms.ProjectOrganismID);

                    // Add a confirmation message
                    ltlMessage.Text += String.Format(MessageFormatter.GetFormattedSuccessMessage("Delete successful. <b>{0}</b> - <b>{1}</b>(<b>{2}</b>) has been deleted"), project_Organisms.Organism.OrganismType.OrganismTypeName, project_Organisms.Organism.CommonName, project_Organisms.Organism.ScientificName);
                }
            }

            //perform the actual delete
            new Project_OrganismsBLL().DeleteProject_Organisms(OrganismIDsToDelete);
        }
        catch (Exception ex)
        {
            ltlMessage.Text = ExceptionManager.DoLogAndGetFriendlyMessageForException(ex);
        }

        //binding the grid
        gridViewOrganisms.PageIndex = 0;
        gridViewOrganisms.DataBind();
    }