/// <summary>
    /// Handles the OnClick event of the cmdSave control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void cmdSave_OnClick(object sender, EventArgs e)
    {
        ICampaignStage stage = BindingSource.Current as ICampaignStage;

        stage.Save();
        IPanelRefreshService refresher = PageWorkItem.Services.Get <IPanelRefreshService>();

        refresher.RefreshAll();
    }
Exemple #2
0
    /// <summary>
    /// Gets the campaign stage.
    /// </summary>
    /// <param name="stageId">The stage id.</param>
    /// <returns></returns>
    private ICampaignStage GetCampaignStage(string stageId)
    {
        ICampaignStage stage = null;

        using (new SessionScopeWrapper())
        {
            stage = EntityFactory.GetById <ICampaignStage>(stageId);
        }
        return(stage);
    }
Exemple #3
0
    /// <summary>
    /// Handles the OnClick event of the cmdSave control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void cmdSave_OnClick(object sender, EventArgs e)
    {
        ICampaignStage stage = this.BindingSource.Current as ICampaignStage;

        stage.Save();
        IPanelRefreshService refresher = PageWorkItem.Services.Get <IPanelRefreshService>();

        refresher.RefreshAll();
        DialogService.CloseEventHappened(sender, e); //Close Dialog
    }
 /// <summary>
 /// Called when [form bound].
 /// </summary>
 protected override void OnFormBound()
 {
     base.OnFormBound();
     _parentEntity = GetParentEntity() as IPersistentEntity;
     _stage        = (ICampaignStage)BindingSource.Current;
     if (DialogService.DialogParameters.Count > 0)
     {
         object mode;
         if (DialogService.DialogParameters.TryGetValue("Mode", out mode))
         {
             _mode = mode.ToString();
         }
     }
     LoadView();
 }
 /// <summary>
 /// Loads the budget.
 /// </summary>
 /// <param name="stage">The stage.</param>
 private void LoadBudget(ICampaignStage stage)
 {
     try
     {
         ComponentView budget = Rules.CalculateBudget(stage);
         slxCurActualCost.Text    = budget.GetProperties()["ActualCosts"].GetValue(budget).ToString();
         slxCurEstimatedCost.Text = budget.GetProperties()["EstCosts"].GetValue(budget).ToString();
         txtActualHours.Text      = string.Format("{0:n}", budget.GetProperties()["ActualHours"].GetValue(budget));
         txtEstimatedHours.Text   = string.Format("{0:n}", budget.GetProperties()["EstHours"].GetValue(budget));
     }
     catch
     {
         //Error Calculatig Budget.
     }
 }
Exemple #6
0
 /// <summary>
 /// Called when [form bound].
 /// </summary>
 protected override void OnFormBound()
 {
     base.OnFormBound();
     ClientBindingMgr.RegisterDialogCancelButton(cmdCancel);
     this._parentEntity          = GetParentEntity() as Sage.Platform.Orm.Interfaces.IPersistentEntity;
     this._parentEntityReference = this._parentEntity as Sage.Platform.ComponentModel.IComponentReference;
     _stage = (ICampaignStage)this.BindingSource.Current;
     if (DialogService.DialogParameters.Count > 0)
     {
         object mode;
         if (DialogService.DialogParameters.TryGetValue("Mode", out mode))
         {
             _mode = mode.ToString();
         }
     }
     LoadView();
 }
 /// <summary>
 /// Loads the budget.
 /// </summary>
 /// <param name="stage">The stage.</param>
 private void LoadBudget(ICampaignStage stage)
 {
     try
     {
         ComponentView budget = Rules.CalculateBudget(stage);
         slxCurActualCost.Text = budget.GetProperties()["ActualCosts"].GetValue(budget).ToString();
         slxCurEstimatedCost.Text = budget.GetProperties()["EstCosts"].GetValue(budget).ToString();
         txtActualHours.Text = string.Format("{0:n}", budget.GetProperties()["ActualHours"].GetValue(budget));
         txtEstimatedHours.Text = string.Format("{0:n}",budget.GetProperties()["EstHours"].GetValue(budget));
     }
     catch
     {
        //Error Calculatig Budget.
     }
 }
 /// <summary>
 /// Called when [form bound].
 /// </summary>
 protected override void OnFormBound()
 {
     base.OnFormBound();
     _parentEntity = GetParentEntity() as IPersistentEntity;
     _stage = (ICampaignStage)BindingSource.Current;
     if (DialogService.DialogParameters.Count > 0)
     {
         object mode;
         if(DialogService.DialogParameters.TryGetValue("Mode", out mode))
         {
             _mode = mode.ToString();
         }
     }
     LoadView();
 }
 /// <summary>
 /// Called when [form bound].
 /// </summary>
 protected override void OnFormBound()
 {
     base.OnFormBound();
     ClientBindingMgr.RegisterDialogCancelButton(cmdCancel);
     this._parentEntity = GetParentEntity() as Sage.Platform.Orm.Interfaces.IPersistentEntity;
     this._parentEntityReference = this._parentEntity as Sage.Platform.ComponentModel.IComponentReference;
     _stage = (ICampaignStage)this.BindingSource.Current;
     if (DialogService.DialogParameters.Count > 0)
     {
         object mode;
         if(DialogService.DialogParameters.TryGetValue("Mode", out mode))
         {
             _mode = mode.ToString();
         }
     }
     LoadView();
 }
    /// <summary>
    /// Handles the RowCommand event of the grdStages control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.Web.UI.WebControls.GridViewCommandEventArgs"/> instance containing the event data.</param>
    protected void grdStages_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName.Equals("AddTask"))
        {
            int      rowIndex = Convert.ToInt32(e.CommandArgument);
            string   id       = grdStages.DataKeys[rowIndex].Value.ToString();
            string[] result   = id.Split(':');

            if (DialogService != null)
            {
                if (result[1] == "S")
                {
                    DialogService.SetSpecs(200, 200, 550, 700, "AddEditTask", GetLocalResourceObject("DialogCaption_AddTask").ToString(), true);
                    DialogService.EntityType = typeof(ICampaignTask);
                    DialogService.DialogParameters.Add("StageId", result[0]);
                    DialogService.DialogParameters.Add("Mode", "Add");
                    DialogService.ShowDialog();
                }
            }
        }

        if (e.CommandName.Equals("Edit"))
        {
            int      rowIndex = Convert.ToInt32(e.CommandArgument);
            string   id       = grdStages.DataKeys[rowIndex].Value.ToString();
            string[] result   = id.Split(':');

            if (DialogService != null)
            {
                if (result[1] == "S")
                {
                    DialogService.SetSpecs(200, 200, 550, 700, "AddEditStage", GetLocalResourceObject("DialogCaption_EditStage").ToString(), true);
                    DialogService.EntityType = typeof(ICampaignStage);
                    DialogService.EntityID   = result[0];
                    DialogService.DialogParameters.Add("Mode", "Edit");
                    DialogService.ShowDialog();
                }
                else if (result[1] == "T")
                {
                    DialogService.SetSpecs(200, 200, 550, 700, "AddEditTask", GetLocalResourceObject("DialogCaption_EditTask").ToString(), true);
                    DialogService.EntityType = typeof(ICampaignTask);
                    DialogService.EntityID   = result[0];
                    DialogService.DialogParameters.Add("Mode", "Edit");
                    DialogService.ShowDialog();
                }
            }
        }
        if (e.CommandName.Equals("Complete"))
        {
            int      rowIndex = Convert.ToInt32(e.CommandArgument);
            string   id       = grdStages.DataKeys[rowIndex].Value.ToString();
            string[] result   = id.Split(':');

            if (DialogService != null)
            {
                if (result[1] == "S")
                {
                    DialogService.SetSpecs(200, 200, 550, 700, "AddEditStage", GetLocalResourceObject("DialogCaption_CompleteStage").ToString(), true);
                    DialogService.EntityType = typeof(ICampaignStage);
                    DialogService.EntityID   = result[0];
                    DialogService.DialogParameters.Add("Mode", "Complete");
                    DialogService.ShowDialog();
                }
                else if (result[1] == "T")
                {
                    DialogService.SetSpecs(200, 200, 550, 700, "AddEditTask", GetLocalResourceObject("DialogCaption_CompleteTask").ToString(), true);
                    DialogService.EntityType = typeof(ICampaignTask);
                    DialogService.EntityID   = result[0];
                    DialogService.DialogParameters.Add("Mode", "Complete");
                    DialogService.ShowDialog();
                }
            }
        }

        if (e.CommandName.Equals("Delete"))
        {
            int      rowIndex = Convert.ToInt32(e.CommandArgument);
            string   Id       = grdStages.DataKeys[rowIndex].Value.ToString();
            string[] result   = Id.Split(':');
            if (result[1] == "S")  //Stage
            {
                ICampaignStage stage = EntityFactory.GetById <ICampaignStage>(result[0]);
                if (stage != null)
                {
                    stage.Campaign.CampaignStages.Remove(stage);
                    stage.Delete();
                }
            }
            else if (result[1] == "T") //Task
            {
                ICampaignTask task = EntityFactory.GetById <ICampaignTask>(result[0]);
                if (task != null)
                {
                    task.CampaignStage.CampaignTasks.Remove(task);
                    task.Campaign.CampaignTasks.Remove(task);
                    task.Delete();
                }
            }
        }
        if (PageWorkItem != null)
        {
            IPanelRefreshService refresher = PageWorkItem.Services.Get <IPanelRefreshService>();
            if (refresher != null)
            {
                refresher.RefreshAll();
            }
        }
    }
Exemple #11
0
    /// <summary>
    /// Handles the RowCommand event of the grdStages control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.Web.UI.WebControls.GridViewCommandEventArgs"/> instance containing the event data.</param>
    protected void grdStages_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int rowIndex = 0;

        if (int.TryParse(e.CommandArgument.ToString(), out rowIndex))
        {
            string   id     = grdStages.DataKeys[rowIndex].Value.ToString();
            string[] result = id.Split(':');
            switch (e.CommandName)
            {
            case "AddTask":
                if (result[1] == "S")
                {
                    LoadTaskView(GetLocalResourceObject("DialogCaption_AddTask").ToString(), "Add", result[0], String.Empty);
                }
                break;

            case "Edit":
                if (result[1] == "S")     //Stage
                {
                    LoadStageView(GetLocalResourceObject("DialogCaption_EditStage").ToString(), "Edit", result[0]);
                }
                else if (result[1] == "T")     //Task
                {
                    LoadTaskView(GetLocalResourceObject("DialogCaption_EditTask").ToString(), "Edit", String.Empty, result[0]);
                }
                break;

            case "Complete":
                if (result[1] == "S")     //Stage
                {
                    LoadStageView(GetLocalResourceObject("DialogCaption_CompleteStage").ToString(), "Complete", result[0]);
                }
                else if (result[1] == "T")     //Task
                {
                    LoadTaskView(GetLocalResourceObject("DialogCaption_CompleteTask").ToString(), "Complete", String.Empty, result[0]);
                }
                break;

            case "Delete":
                if (result[1] == "S")      //Stage
                {
                    ICampaignStage stage = EntityFactory.GetById <ICampaignStage>(result[0]);
                    if (stage != null)
                    {
                        stage.Campaign.CampaignStages.Remove(stage);
                        stage.Delete();
                    }
                }
                else if (result[1] == "T")     //Task
                {
                    ICampaignTask task = EntityFactory.GetById <ICampaignTask>(result[0]);
                    if (task != null)
                    {
                        task.CampaignStage.CampaignTasks.Remove(task);
                        task.Campaign.CampaignTasks.Remove(task);
                        task.Delete();
                    }
                }
                break;
            }

            if (PageWorkItem != null)
            {
                IPanelRefreshService refresher = PageWorkItem.Services.Get <IPanelRefreshService>();
                if (refresher != null)
                {
                    refresher.RefreshAll();
                }
            }
        }
    }