using System;
using System.Collections.Generic;
using System.Globalization;
using System.Threading;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TABS.MailCarrier.WebSDK;

public partial class Approval_Folders : System.Web.UI.Page
{
    protected override void InitializeCulture()
    {
        string defLang = WebUser.CurrentUser.UiLanguage;
        Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(defLang);
        Thread.CurrentThread.CurrentUICulture = new CultureInfo(defLang);
        base.InitializeCulture();
    }

    protected void Page_Init(object sender, EventArgs e)
    {
        WebUtil.SetMcCommonCss(Page.Header);
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Page.Title = AppSetting.GetTitleInfo(Request).Title;
        }
    }

    protected string GetClickEventFunction(Guid parentId, Guid id)
    {
        if (parentId == Guid.Empty)
        {
            if (id == Guid.Empty)
                return "";
            else if (id == AppFolderDataSource.OPTION_FOLDERID)
                return "location.href = 'Options.aspx'";
            else
                return string.Format("location.href = 'List.aspx?type={0}'", id.ToString());
        }
        else
        {
            return string.Format("location.href = 'List.aspx?type={0}&id={1}'", parentId.ToString(), id.ToString());
        }
    }

    protected string GetIndent(int indent)
    {
        return (indent * 16).ToString();
    }

    protected string GetFolderIcon(string iconName)
    {
        if (iconName != "")
        {
            return string.Format("<img src='../Images/Approval/{0}' border='0' /> ", iconName);
        }
        else
        {
            return "";
        }
    }

    protected string GetFolderIconEx(string iconName)
    {
        if (iconName == "")
        {
            return "";
        }
        else if (iconName == "folder_16.gif")
        {
            return FontIcon.ApvFolder;
        }
        else if (iconName == "approval07.png")
        {
            return FontIcon.ApvTempbox;
        }
        else if (iconName == "approval08.png")
        {
            return FontIcon.ApvOption;
        }
        else
        {
            return FontIcon.ApvInbox;
        }
    }

    protected string GetFolderName(Guid parentId, Guid id, string folderName)
    {
        string encFolderName = Server.HtmlEncode(folderName);
        if (parentId == Guid.Empty)
        {
            if (id == Guid.Empty)
                return string.Format("<strong>{0}</strong>", encFolderName);
            else 
                return encFolderName;
        }
        else
        {
            return encFolderName;
        }
    }

    protected string GetCount(Guid id, int newCount, int totalCount)
    {
        if (id == Guid.Empty || id == AppFolderDataSource.TEMP_FOLDERID || id == AppFolderDataSource.OPTION_FOLDERID)
        {
            return "";
        }
        else
        {
            return string.Format("&nbsp;({0}/{1})", newCount, totalCount);
        }
    }
}