Пример #1
0
        protected void saveButton_Click( object sender, EventArgs e )
        {
            PageSummaryView ps = (PageSummaryView)Session["Page" + pageIdTextBox.Text];
            CustomGenericList<PageName> pageNames = (CustomGenericList<PageName>)Session["PageNames" + pageIdTextBox.Text];

            if ( validate( pageNames ) )
            {
                BHLProvider bp = new BHLProvider();
                try
                {
                    foreach ( PageName pageName in pageNames )
                    {
                        if ( pageName.IsNew && pageName.Active )
                        {
                            PageName existingPageName =
                                bp.PageNameSelectByPageIDAndNameFound( ps.PageID, pageName.NameFound );

                            if ( existingPageName == null )
                            {
                                pageName.PageID = ps.PageID;
                                pageName.Source = "User Reported";
                                pageName.Active = true;
                                // Get confirmed value and namebankid from uBio
                                FindItItem uBioResult = ubioLookup( pageName.NameFound );
                                if ( uBioResult != null )
                                {
                                    pageName.NameConfirmed = TypeHelper.NullIfEmpty( uBioResult.Name );
                                    pageName.NameBankID = TypeHelper.NullIfZero( uBioResult.NamebankID );
                                }
                            }
                        }
                        else
                        {
                            if ( pageName.Active )
                            {
                                FindItItem uBioResult = ubioLookup( pageName.NameFound );
                                if ( uBioResult != null && uBioResult.NamebankID >= 0 )
                                {
                                    pageName.NameConfirmed = TypeHelper.NullIfEmpty( uBioResult.Name );
                                    pageName.NameBankID = TypeHelper.NullIfZero( uBioResult.NamebankID );
                                }
                            }
                        }
                    }

                    bp.PageNameSaveList( pageNames );
                }
                catch ( Exception ex )
                {
                    Session[ "Exception" ] = ex;
                    Response.Redirect( "/Error.aspx" );
                }
            }
            else
            {
                return;
            }

            Response.Redirect( "/Admin/Dashboard.aspx" );
        }