示例#1
0
        protected void Page_Load( object sender, EventArgs e )
        {
            if ( !IsPostBack )
            {
                bioTextBox.ToolbarSet = "BHL";

                BHLProvider bp = new BHLProvider();
                CustomGenericList<Creator> creators = bp.CreatorSelectAll();

                Creator emptyCreator = new Creator();
                emptyCreator.CreatorID = -1;
                emptyCreator.CreatorName = "";
                creators.Insert( 0, emptyCreator );

                ddlAuthors.DataSource = creators;
                ddlAuthors.DataTextField = "CreatorName";
                ddlAuthors.DataValueField = "CreatorId";
                ddlAuthors.DataBind();

                string idString = Request.QueryString["id"];
                int id = 0;
                if (idString != null && int.TryParse(idString, out id))
                {
                    ddlAuthors.SelectedValue = idString;
                    populateForm();
                }
            }
            errorControl.Visible = false;
        }
示例#2
0
        public static void Save( SqlConnection sqlConnection, SqlTransaction sqlTransaction, Creator creator )
        {
            SqlConnection connection = sqlConnection;
              SqlTransaction transaction = sqlTransaction;

              if ( connection == null )
              {
            connection =
              CustomSqlHelper.CreateConnection( CustomSqlHelper.GetConnectionStringFromConnectionStrings( "BHL" ) );
              }

              bool isTransactionCoordinator = CustomSqlHelper.IsTransactionCoordinator( transaction );

              try
              {
            transaction = CustomSqlHelper.BeginTransaction( connection, transaction, isTransactionCoordinator );

            new CreatorDAL().CreatorManageAuto( connection, transaction, creator );

            CustomSqlHelper.CommitTransaction( transaction, isTransactionCoordinator );
              }
              catch ( Exception ex )
              {
            CustomSqlHelper.RollbackTransaction( transaction, isTransactionCoordinator );

            throw new Exception( "Exception in Save", ex );
              }
              finally
              {
            CustomSqlHelper.CloseConnection( connection, isTransactionCoordinator );
              }
        }
示例#3
0
        protected void saveAsNewButton_Click( object sender, EventArgs e )
        {
            if ( validate() )
            {
                Creator creator = new Creator( 0, creatorNameTextBox.Text.Trim(),
                    firstNameFirstTextBox.Text.Trim(), simpleNameTextBox.Text.Trim(), dobTextBox.Text.Trim(), dodTextBox.Text.Trim(),
                    bioTextBox.Value, creatorNoteTextBox.Text.Trim(),
                    marcDataFieldTagTextBox.Text.Trim(), marcCreatorATextBox.Text.Trim(), marcCreatorBTextBox.Text.Trim(),
                    marcCreatorCTextBox.Text.Trim(), marcCreatorDTextBox.Text.Trim(), marcCreatorFullTextBox.Text.Trim() );

                creator.IsNew = true;

                BHLProvider bp = new BHLProvider();
                bp.SaveCreator( creator );
            }
            else
            {
                return;
            }

            Response.Redirect( "/Admin/Dashboard.aspx" );
        }
示例#4
0
 /// <summary>
 /// Update values in Creator. Returns an object of type Creator.
 /// </summary>
 /// <param name="sqlConnection">Sql connection or null.</param>
 /// <param name="sqlTransaction">Sql transaction or null.</param>
 /// <param name="value">Object of type Creator.</param>
 /// <returns>Object of type Creator.</returns>
 public Creator CreatorUpdateAuto(
     SqlConnection sqlConnection,
     SqlTransaction sqlTransaction,
     Creator value)
 {
     return CreatorUpdateAuto(sqlConnection, sqlTransaction,
         value.CreatorID,
         value.CreatorName,
         value.FirstNameFirst,
         value.SimpleName,
         value.DOB,
         value.DOD,
         value.Biography,
         value.CreatorNote,
         value.MARCDataFieldTag,
         value.MARCCreator_a,
         value.MARCCreator_b,
         value.MARCCreator_c,
         value.MARCCreator_d,
         value.MARCCreator_Full);
 }
示例#5
0
        /// <summary>
        /// Manage Creator object.
        /// If the object is of type CustomObjectBase, 
        /// then either insert values into, delete values from, or update values in Creator.
        /// </summary>
        /// <param name="sqlConnection">Sql connection or null.</param>
        /// <param name="sqlTransaction">Sql transaction or null.</param>
        /// <param name="value">Object of type Creator.</param>
        /// <returns>Object of type CustomDataAccessStatus<Creator>.</returns>
        public CustomDataAccessStatus<Creator> CreatorManageAuto(
            SqlConnection sqlConnection,
            SqlTransaction sqlTransaction,
            Creator value)
        {
            if (value.IsNew && !value.IsDeleted)
            {

                Creator returnValue = CreatorInsertAuto(sqlConnection, sqlTransaction,
                    value.CreatorName,
                        value.FirstNameFirst,
                        value.SimpleName,
                        value.DOB,
                        value.DOD,
                        value.Biography,
                        value.CreatorNote,
                        value.MARCDataFieldTag,
                        value.MARCCreator_a,
                        value.MARCCreator_b,
                        value.MARCCreator_c,
                        value.MARCCreator_d,
                        value.MARCCreator_Full);

                return new CustomDataAccessStatus<Creator>(
                    CustomDataAccessContext.Insert,
                    true, returnValue);
            }
            else if (!value.IsNew && value.IsDeleted)
            {
                if (CreatorDeleteAuto(sqlConnection, sqlTransaction,
                    value.CreatorID))
                {
                return new CustomDataAccessStatus<Creator>(
                    CustomDataAccessContext.Delete,
                    true, value);
                }
                else
                {
                return new CustomDataAccessStatus<Creator>(
                    CustomDataAccessContext.Delete,
                    false, value);
                }
            }
            else if (value.IsDirty && !value.IsDeleted)
            {

                Creator returnValue = CreatorUpdateAuto(sqlConnection, sqlTransaction,
                    value.CreatorID,
                        value.CreatorName,
                        value.FirstNameFirst,
                        value.SimpleName,
                        value.DOB,
                        value.DOD,
                        value.Biography,
                        value.CreatorNote,
                        value.MARCDataFieldTag,
                        value.MARCCreator_a,
                        value.MARCCreator_b,
                        value.MARCCreator_c,
                        value.MARCCreator_d,
                        value.MARCCreator_Full);

                return new CustomDataAccessStatus<Creator>(
                    CustomDataAccessContext.Update,
                    true, returnValue);
            }
            else
            {
                return new CustomDataAccessStatus<Creator>(
                    CustomDataAccessContext.NA,
                    false, value);
            }
        }
示例#6
0
        protected void saveButton_Click( object sender, EventArgs e )
        {
            if ( validate() )
            {
                if ( idTextBox.Text.Trim().Length == 0 )
                {
                    errorControl.AddErrorText( "Please select a creator before saving" );
                    errorControl.Visible = true;
                    return;
                }

                Creator creator = new Creator( int.Parse( idTextBox.Text ), creatorNameTextBox.Text.Trim(),
                    firstNameFirstTextBox.Text.Trim(), simpleNameTextBox.Text.Trim(), dobTextBox.Text.Trim(), dodTextBox.Text.Trim(),
                    bioTextBox.Value, creatorNoteTextBox.Text.Trim(),
                    marcDataFieldTagTextBox.Text.Trim(), marcCreatorATextBox.Text.Trim(), marcCreatorBTextBox.Text.Trim(),
                    marcCreatorCTextBox.Text.Trim(), marcCreatorDTextBox.Text.Trim(), marcCreatorFullTextBox.Text.Trim() );

                creator.IsNew = false;

                BHLProvider bp = new BHLProvider();
                bp.SaveCreator( creator );
            }
            else
            {
                return;
            }

            Response.Redirect( "/Admin/Dashboard.aspx" );
        }
示例#7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //authorListContentPanel.SetTableID("authorListContentPanel");
            authorContentPanel.SetTableID("authorDetailContentPanel");
            //Page.Master.Page.Header.Controls.Add(ControlGenerator.GetScriptControl("/Scripts/ResizeContentPanelUtils.js"));
            //ControlGenerator.AddScriptControl(Page.Master.Page.Header.Controls, "/Scripts/ResizeContentPanelUtils.js");
            ControlGenerator.AddScriptControl(Page.Master.Page.Header.Controls, "/Scripts/ResizeBrowseUtils.js");
            ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onload",
                                                              "ResizeContentPanel('authorDetailContentPanel', 258);ResizeBrowseDivs();");
            ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onresize",
                                                              "ResizeContentPanel('authorDetailContentPanel', 258);ResizeBrowseDivs();");
            //CustomGenericList<Data.Creator> creators = bhlProvider.CreatorSelectAll();
            //authorsDropDownList.DataSource = creators;
            //authorsDropDownList.DataTextField = "CreatorName";
            //authorsDropDownList.DataValueField = "CreatorId";
            //authorsDropDownList.DataBind();
            //authorsDropDownList.Attributes.Add("onchange",
            //                          "location.href='/creator/' + this.options[selectedIndex].value");


            if (Request["CreatorId"] != null)
            {
                int creatorId = 0;
                try
                {
                    creatorId = int.Parse(Request["CreatorId"]);
                }
                catch
                {
                    CreatorNotFound();
                }
                Data.Creator c = bhlProvider.CreatorSelectAuto(creatorId);
                if (c == null)
                {
                    CreatorNotFound();
                }

                //authorsDropDownList.SelectedValue = c.CreatorID.ToString();
                creatorNameLiteral.Text = c.MARCCreator_a;
                if (c.MARCCreator_b != null)
                {
                    creatorNameLiteral.Text += " " + c.MARCCreator_b;
                }
                if (c.DOB != null && c.DOB != "")
                {
                    lifespanLiteral.Text = c.DOB;
                }
                if (c.DOD != null && c.DOD != "")
                {
                    if (lifespanLiteral.Text != "")
                    {
                        lifespanLiteral.Text += " - " + c.DOD;
                    }
                    else
                    {
                        lifespanLiteral.Text += "Died " + c.DOD;
                    }
                }
                else if (lifespanLiteral.Text != "")
                {
                    lifespanLiteral.Text = "Born " + lifespanLiteral.Text;
                }
                if (lifespanLiteral.Text != "")
                {
                    lifespanLiteral.Text = "(" + lifespanLiteral.Text + ")";
                }

                // If we're referred here by the search page and the "secondary titles" flag was set,
                // then include secondary titles in the search.
                String includeSecondaryTitles = String.Empty;
                if (Request.UrlReferrer != null)
                {
                    if (Request.UrlReferrer.LocalPath.ToLower().Contains("search.aspx") &&
                        Request.UrlReferrer.Query.ToLower().Contains("sec=1"))
                    {
                        includeSecondaryTitles = "1";
                    }
                }
                titlesRepeater.DataSource = bhlProvider.TitleSelectByCreator(c.CreatorID, includeSecondaryTitles);
                titlesRepeater.DataBind();

                biographyLiteral.Text = c.Biography;
            }
        }
 public void SaveCreator( Creator creator )
 {
     CreatorDAL.Save( null, null, creator );
 }