using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using GZTW.AyaNova.BLL; public partial class dashboard : BaseThemePage { protected void Page_Load(object sender, EventArgs e) { Util.Localize(this.Page); Page.Title = Util.LocaleText("Dashboard.Label.Dashboard"); RefreshDisplay(); //if (!IsPostBack && !IsAjaxCallback) //{ //} } private void RefreshDisplay() { DashBoardInfo di = DashBoardInfo.Get(Util.LocaleText("Common.Label.More")); #region "My" panel if (di.MyPanelVisible) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); //sb.Append("

" + Util.LocaleText("UI.Label.CurrentUserName") + "

"); sb.Append("

" + System.Threading.Thread.CurrentPrincipal.Identity.Name + "

"); if (di.HasMyOverdueList) AppendDashboardSection(di.myOverdueList, "Dashboard.Label.Overdue", sb); if (di.HasMyScheduledList) AppendDashboardSection(di.myScheduledList, "Dashboard.Label.Scheduled", sb); if (di.HasMyServiceRateSummaryList) AppendDashboardSection(di.myServiceRateSummaryList, "WorkorderItemLabor.Label.ServiceRateQuantity", sb); if (di.HasMyReminderList) AppendDashboardSection(di.myRemindersList, "Dashboard.Label.Reminders", sb); if (di.HasMyNewMemoList) AppendDashboardSection(di.myNewMemosList, "Memo.Label.List", sb); litMy.Text = sb.ToString(); } #endregion my panel #region Company / Region panel if (di.CompPanelVisible) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("

" + di.CurrentCompanyOrRegionName + "

"); if (di.HasCompNotAssignedList) AppendDashboardSection(di.compNotAssignedList, "Dashboard.Label.NotAssigned", sb); if (di.HasCompOverdueList) AppendDashboardSection(di.compOverdueList, "Dashboard.Label.Overdue", sb); if (di.HasCompScheduledList) AppendDashboardSection(di.compScheduledList, "Dashboard.Label.Next", sb); if (di.HasCompServiceRateSummaryList) AppendDashboardSection(di.compServiceRateSummaryList, "WorkorderItemLabor.Label.ServiceRateQuantity", sb); if (di.HasCompServiceRequestList) AppendDashboardSection(di.compServiceRequestsList, "ClientServiceRequest.Label.List", sb); litCompany.Text = sb.ToString(); } #endregion company / region panel. #region hide / show panels as appropriate if (di.MyPanelVisible && di.CompPanelVisible) { pnlCompany.Attributes.Add("class", "onehalfcolumn"); pnlMy.Attributes.Add("class", "onehalfcolumn"); pnlCompany.Visible = true; pnlMy.Visible = true; } else { //One of the two panels isn't visible //so make the other one take up all the space and hide the invisible one if (!di.MyPanelVisible) { pnlCompany.Visible = true; pnlMy.Visible = false; pnlCompany.Attributes.Add("class", "onecolumn"); } else { pnlCompany.Visible = false; pnlMy.Visible = true; pnlMy.Attributes.Add("class", "onecolumn"); } } #endregion hide show panels as appropriate } private static void AppendDashboardSection(System.Collections.Generic.List dList, string SectionLocaleKey, System.Text.StringBuilder sb) { sb.Append("

" + Util.LocaleText(SectionLocaleKey) + "

"); bool HasOpenableItems = false; sb.Append(""); } private static string TidToUrl(TypeAndID tid) { string toUrl = ""; string sObject=tid.RootObjectType.ToString(); switch (sObject) { case "Part": toUrl = "PartInventoryView.aspx?id=" + tid.ID.ToString(); break; case "WikiPage": toUrl = "Wiki?id=" + tid.ID.ToString(); break; case "WorkorderItemScheduledUser": { toUrl = "WorkorderEdit.aspx?id=" + Workorder.GetWorkorderByRelativeNoMRU(tid.RootObjectType, tid.ID).ID.ToString(); } break; default: { if (tid.ID == Guid.Empty) toUrl = sObject + "Edit.aspx"; else toUrl = sObject + "Edit.aspx?id=" + tid.ID.ToString(); } break; } return toUrl; } protected void btnNewWo_Click(object sender, EventArgs e) { Response.Write(""); } protected void btnNewClient_Click(object sender, EventArgs e) { Response.Write(""); } protected void btnRefresh_Click(object sender, EventArgs e) { //no-op, let it refresh } }//eoc