예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            this.NewProjectNotificationLink.NavigateUrl += "?ProjectID=" + ProjectID;

            ProjectInfo1.ProjectID = this.ProjectID;

            if (null != Request["action"] && 0 == Request["action"].CompareTo("delete") && this.NotificationTypeID > 0)
            {
                DL_WEB.DAL.Client.ProjectNotification oProjectNotification = new DL_WEB.DAL.Client.ProjectNotification();
                oProjectNotification.Where.NotificationTypeID.Value    = this.NotificationTypeID;
                oProjectNotification.Where.NotificationTypeID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
                oProjectNotification.Query.Load();

                oProjectNotification.DeleteAll();
                oProjectNotification.Save();

                DL_WEB.DAL.Client.ActivityLog.Instance.RegisterActivity(ActivityTypes.ProjectNotificationDeleted, "ProjectNotifications deleted by NotificationTypeID", ActivityObject.ProjectNotification, this.NotificationTypeID, DL_WEB.DAL.Master.User.GetUserGUID(User.Identity.Name), Context.User.Identity.Name);
            }
        }
    }
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        int CurrentID = 0;

        if (ProjectNotificationItemList.SelectedValue.Length > 0)
        {
            CurrentID = Micajah.Common.Helper.Convert.o2i(ProjectNotificationItemList.SelectedValue);
        }

        if (CurrentID > 0)
        {
            DL_WEB.DAL.Client.ProjectNotification oProjectNotification = new DL_WEB.DAL.Client.ProjectNotification();
            oProjectNotification.AddNew();
            oProjectNotification.ProjectID          = this.ProjectID;
            oProjectNotification.NotificationTypeID = this.NotificationTypeID;
            switch (this.Type)
            {
            case "role":
                oProjectNotification.RoleID = CurrentID;
                break;

            case "user":
                oProjectNotification.UserID = CurrentID;
                break;

            case "addressbook":
                oProjectNotification.AddressBookEntryID = CurrentID;
                break;
            }
            oProjectNotification.Save();

            DL_WEB.DAL.Client.ActivityLog.Instance.RegisterActivity(ActivityTypes.ProjectNotificationCreated, "ProjectNotification created", ActivityObject.ProjectNotification, oProjectNotification.ProjectNotificationID, DL_WEB.DAL.Master.User.GetUserGUID(User.Identity.Name), Context.User.Identity.Name);
        }

        CancelButton_Click(sender, e);
    }