Пример #1
0
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        Activity theClass = new Activity();

        theClass.Name           = ActivityNameTextBox.Text;
        theClass.OrganizationID = AddDataControl.OrganizationId;
        theClass.AreaID         = AddDataControl.AreaId;
        theClass.ProjectID      = AddDataControl.ProjectId;

        if (ActivityId == 0)
        {
            //Insert
            try
            {
                ActivityBLL.InsertActivity(theClass);
            }
            catch (Exception ex)
            {
                SystemMessages.DisplaySystemErrorMessage(ex.Message);
                return;
            }
            SystemMessages.DisplaySystemMessage(Resources.Activity.MessageCreateOk);
        }
        else
        {
            // Update
            theClass.ActivityID = ActivityId;
            try
            {
                ActivityBLL.UpdateActivity(theClass);
            }
            catch (Exception ex)
            {
                SystemMessages.DisplaySystemErrorMessage(ex.Message);
                return;
            }
            SystemMessages.DisplaySystemMessage(Resources.Activity.MessageUpdateOk);
        }
        Response.Redirect(ParentPage);
    }