Пример #1
0
        /// <summary>
        /// Create a new OrganismType object.
        /// </summary>
        /// <param name="organismTypeID">Initial value of the OrganismTypeID property.</param>
        /// <param name="organismTypeName">Initial value of the OrganismTypeName property.</param>
        /// <param name="createdDate">Initial value of the CreatedDate property.</param>
        /// <param name="editedDate">Initial value of the EditedDate property.</param>
        public static OrganismType CreateOrganismType(global::System.Int32 organismTypeID, global::System.String organismTypeName, global::System.DateTime createdDate, global::System.DateTime editedDate)
        {
            OrganismType organismType = new OrganismType();

            organismType.OrganismTypeID   = organismTypeID;
            organismType.OrganismTypeName = organismTypeName;
            organismType.CreatedDate      = createdDate;
            organismType.EditedDate       = editedDate;
            return(organismType);
        }
Пример #2
0
    protected void ButtonDeleteSelected_Click(object sender, System.EventArgs e)
    {
        try
        {
            // Create a List to hold the OrganismTypeID values to delete
            List <Int32> OrganismTypeIDsToDelete = new List <Int32>();

            // Iterate through the OrganismTypes.Rows property
            foreach (GridViewRow row in gridViewOrganismTypes.Rows)
            {
                // Access the CheckBox
                CheckBox cb = (CheckBox)(row.FindControl("chkOrganismTypeSelector"));
                if (cb != null && cb.Checked)
                {
                    // Save the OrganismTypeID value for deletion
                    // First, get the OrganismTypeID for the selected row
                    Int32           OrganismTypeID  = (Int32)gridViewOrganismTypes.DataKeys[row.RowIndex].Value;
                    OrganismTypeBLL OrganismTypeBLL = new OrganismTypeBLL();
                    Eisk.BusinessEntities.OrganismType OrganismType = OrganismTypeBLL.GetOrganismTypeByOrganismTypeID(OrganismTypeID);

                    // Add it to the List...
                    OrganismTypeIDsToDelete.Add(OrganismTypeID);

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

            //perform the actual delete
            new OrganismTypeBLL().DeleteOrganismTypes(OrganismTypeIDsToDelete);
        }
        catch (Exception ex)
        {
            ltlMessage.Text = ExceptionManager.DoLogAndGetFriendlyMessageForException(ex);
        }

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