/// <summary> /// Resolves the owner. /// </summary> /// <param name="task">The task.</param> private void ResolveOwner(ICampaignTask task) { string ownerType = Request.Form[txtOwnerType.ClientID.Replace("_", "$")]; task.OwnerType = ownerType; string ownerName = string.Empty; string Id = string.Empty; switch (ownerType) { case "0": Id = slxOwner.ClientID + "_LookupText"; ownerName = Request.Form[Id.Replace("_", "$")]; break; case "1": Id = ddlDepartments.ClientID; ownerName = Request.Form[Id.Replace("_", "$")]; break; case "2": Id = luContact.ClientID + "_LookupText"; ownerName = Request.Form[Id.Replace("_", "$")]; break; case "3": ownerName = Request.Form[txtOther.ClientID.Replace("_", "$")]; break; case "4": ownerName = ""; break; } task.OwnerName = ownerName; }
/// <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) { ICampaignTask task = BindingSource.Current as ICampaignTask; ResolveOwner(task); task.Save(); IPanelRefreshService refresher = PageWorkItem.Services.Get <IPanelRefreshService>(); refresher.RefreshAll(); }
/// <summary> /// Handles the OnCurrentEntitySet event of the BindingSource 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 BindingSource_IntOnCurrentEntitySet(object sender, EventArgs e) { _parentEntity = GetParentEntity() as IPersistentEntity; _task = BindingSource.Current as ICampaignTask; if (DialogService.DialogParameters.Count > 0) { object mode; if (DialogService.DialogParameters.TryGetValue("Mode", out mode)) _mode = mode.ToString(); } LoadView(); }
/// <summary> /// Handles the OnCurrentEntitySet event of the BindingSource 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 BindingSource_IntOnCurrentEntitySet(object sender, EventArgs e) { _parentEntity = GetParentEntity() as IPersistentEntity; _task = BindingSource.Current as ICampaignTask; if (DialogService.DialogParameters.Count > 0) { object mode; if (DialogService.DialogParameters.TryGetValue("Mode", out mode)) { _mode = mode.ToString(); } } LoadView(); }
/// <summary> /// Handles the OnCurrentEntitySet event of the BindingSource 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 BindingSource_IntOnCurrentEntitySet(object sender, EventArgs e) { this._parentEntity = GetParentEntity() as Sage.Platform.Orm.Interfaces.IPersistentEntity; this._parentEntityReference = this._parentEntity as Sage.Platform.ComponentModel.IComponentReference; _task = this.BindingSource.Current as ICampaignTask; 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(); } } }
/// <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(); } } } }