コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        BusinessEntity.PushStaticConnectionString();

        try
        {
            BusinessEntity.StaticConnectionString = ConfigurationSettings.AppSettings["dbConnection"];

            DL_WEB.DAL.Master.Database oDatabase = new DL_WEB.DAL.Master.Database();
            oDatabase.LoadByPrimaryKey(DatabaseID);

            BusinessEntity.StaticConnectionString = oDatabase.DBConnectionString;

            AddressBook oAddressBook = new AddressBook();
            oAddressBook.LoadAddressBookByPrimaryKey(AddressBookID);

            if (0 == oAddressBook.GUID.ToString().CompareTo(GUID))
            {
                oAddressBook.IsApproved = true;

                NotificationType oNotificationType = new NotificationType();
                oNotificationType.Where.IsClientUpdate.Value = true;
                oNotificationType.Query.Load();

                do
                {
                    ProjectNotification oProjectNotification = new ProjectNotification();
                    oProjectNotification.AddNew();
                    oProjectNotification.AddressBookEntryID = oAddressBook.EntryID;
                    oProjectNotification.ProjectID          = oAddressBook.ProjectID;
                    oProjectNotification.NotificationTypeID = oNotificationType.NotificationTypeID;

                    oProjectNotification.Save();
                } while (oNotificationType.MoveNext());

                oAddressBook.Save();
            }
            else
            {
                MultiView1.ActiveViewIndex = 1;
            }
            MultiView1.ActiveViewIndex = 0;
        }
        catch (Exception)
        {
            MultiView1.ActiveViewIndex = 1;
        }
        finally
        {
            BusinessEntity.PopStaticConnectionString();
        }
    }