using System;
using System.Data;
using System.Collections;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CMS.GlobalHelper;
using CMS.ProjectManagement;
using CMS.SettingsProvider;
using CMS.UIControls;
using CMS.ExtendedControls;
public partial class CMSModules_ProjectManagement_Controls_UI_Projecttaskstatus_List : CMSAdminListControl
{
#region "Properties"
///
/// Messages placeholder
///
public override MessagesPlaceHolder MessagesPlaceHolder
{
get
{
return plcMess;
}
}
///
/// Inner grid.
///
public UniGrid Grid
{
get
{
return gridElem;
}
}
///
/// Indicates if the control should perform the operations.
///
public override bool StopProcessing
{
get
{
return base.StopProcessing;
}
set
{
base.StopProcessing = value;
gridElem.StopProcessing = value;
}
}
///
/// Indicates if the control is used on the live site.
///
public override bool IsLiveSite
{
get
{
return base.IsLiveSite;
}
set
{
base.IsLiveSite = value;
plcMess.IsLiveSite = value;
gridElem.IsLiveSite = value;
}
}
#endregion
#region "Methods"
///
/// Handles the Load event of the Page control.
///
protected void Page_Load(object sender, EventArgs e)
{
CheckPermissions("CMS.ProjectManagement", ProjectManagementPermissionType.MANAGE_CONFIGURATION);
if (StopProcessing)
{
return;
}
// Grid initialization
gridElem.OnAction += new OnActionEventHandler(gridElem_OnAction);
gridElem.OnExternalDataBound += new OnExternalDataBoundEventHandler(gridElem_OnExternalDataBound);
}
///
/// Handles UniGrid's OnExternalDataBound event.
///
/// Sender object (image button if it is an external databoud for action button)
/// External source name of the column specified in the grid XML
/// Source parameter (original value of the field)
protected object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter)
{
switch (sourceName.ToLowerCSafe())
{
case "taskstatuscolor":
string statusColor = "-";
if (!string.IsNullOrEmpty(parameter.ToString()))
{
statusColor = "
";
}
return statusColor;
case "taskstatusenabled":
return UniGridFunctions.ColoredSpanYesNo(parameter);
case "taskstatusisnotstarted":
return UniGridFunctions.ColoredSpanYesNo(parameter);
case "taskstatusicon":
string url = ValidationHelper.GetString(parameter, "");
if (!String.IsNullOrEmpty(url))
{
url = "
";
return url;
}
return "";
case "taskstatusisfinished":
return UniGridFunctions.ColoredSpanYesNo(parameter);
}
return parameter;
}
///
/// Handles UniGrid's OnAction event.
///
/// Name of the action which should be performed
/// ID of the item the action should be performed with
protected void gridElem_OnAction(string actionName, object actionArgument)
{
int projecttaskstatusId = ValidationHelper.GetInteger(actionArgument, 0);
if (projecttaskstatusId > 0)
{
switch (actionName.ToLowerCSafe())
{
case "edit":
SelectedItemID = projecttaskstatusId;
RaiseOnEdit();
break;
case "delete":
if (!ProjectTaskStatusInfoProvider.CheckDependencies(projecttaskstatusId))
{
ShowError(GetString("pm.projecttaskstatus.removedenied"));
return;
}
if (ProjectTaskStatusInfoProvider.GetStatusCount() <= 1)
{
ltlInfo.Text = ScriptHelper.GetScript("alert('" + GetString("pm.projectstatus.deletealert") + "');");
return;
}
// Delete the object
ProjectTaskStatusInfoProvider.DeleteProjectTaskStatusInfo(projecttaskstatusId);
RaiseOnDelete();
// Reload data
gridElem.ReloadData();
break;
case "up":
ProjectTaskStatusInfoProvider.MoveStatusUp(projecttaskstatusId);
break;
case "down":
ProjectTaskStatusInfoProvider.MoveStatusDown(projecttaskstatusId);
break;
}
}
}
#endregion
}