/// <summary> /// 取得後端作業選項資料 /// </summary> public OperationForBackend GetOperationData(int opId) { OperationForBackend entity = null; using (EmployeeAuthorityDataAccess empAuthDao = new EmployeeAuthorityDataAccess()) { entity = empAuthDao.GetOperationDataForBackend(opId); dbErrMsg = empAuthDao.GetErrMsg(); } return(entity); }
private void DisplayProperties() { if (c.qsId == 0) { return; } PropertyArea.Visible = true; if (levelNumOfThis >= maxLevelNum) { PropertyDivider.Visible = false; } OperationForBackend op = empAuth.GetOperationData(c.qsId); if (op != null) { string iconImageFile = op.IconImageFile; if (iconImageFile != "") { imgIcon.Src = "BPimages/icon/" + iconImageFile; } ltrLinkUrl.Text = op.LinkUrl; bool isNewWindow = op.IsNewWindow; ltrIsNewWindow.Text = isNewWindow ? Resources.Lang.IsNewWindow_Yes : Resources.Lang.IsNewWindow_No; bool isHideSelf = op.IsHideSelf; ltrIsHideSelf.Text = isHideSelf ? Resources.Lang.IsHideSelf_Hide : Resources.Lang.IsHideSelf_Show; ltrCommonClass.Text = op.CommonClass; string mdfAccount = op.MdfAccount; DateTime mdfDate; if (!op.MdfDate.HasValue) { mdfAccount = op.PostAccount; mdfDate = op.PostDate.Value; } else { mdfDate = op.MdfDate.Value; } ltrMdfAccount.Text = mdfAccount; ltrMdfDate.Text = mdfDate.ToString("yyyy-MM-dd HH:mm:ss"); } }
private void DisplayOperationData() { if (c.qsAct == ConfigFormAction.edit) { OperationForBackend op = empAuth.GetOperationData(c.qsId); if (op != null) { txtSortNo.Text = op.SortNo.Value.ToString(); txtOpSubject.Text = op.OpSubject; txtEnglishSubject.Text = op.EnglishSubject; txtIconImageFile.Text = op.IconImageFile; txtLinkUrl.Text = op.LinkUrl; chkIsNewWindow.Checked = op.IsNewWindow; chkIsHideSelf.Checked = op.IsHideSelf; txtCommonClass.Text = op.CommonClass; if (txtCommonClass.Text != "") { ddlCommonClasses.SelectedValue = txtCommonClass.Text; } //modification info ltrPostAccount.Text = op.PostAccount; ltrPostDate.Text = string.Format("{0:yyyy-MM-dd HH:mm:ss}", op.PostDate); if (op.MdfDate.HasValue) { ltrMdfAccount.Text = op.MdfAccount; ltrMdfDate.Text = string.Format("{0:yyyy-MM-dd HH:mm:ss}", op.MdfDate.Value); } btnSave.Visible = true; } } else if (c.qsAct == ConfigFormAction.add) { int newSortNo = empAuth.GetOperationMaxSortNo(c.qsId) + 10; txtSortNo.Text = newSortNo.ToString(); btnSave.Visible = true; } }
/// <summary> /// 取得用來組成麵包屑節點連結的後端作業選項資料 /// </summary> public OperationHtmlAnchorData GetOperationHtmlAnchorData(int opId, bool useEnglishSubject) { OperationHtmlAnchorData result = null; OperationForBackend op = GetOperationData(opId); if (op != null) { string opSubject = op.OpSubject; string englishSubject = op.EnglishSubject; if (useEnglishSubject && !string.IsNullOrEmpty(englishSubject)) { opSubject = englishSubject; } result = new OperationHtmlAnchorData(); result.Subject = opSubject; result.LinkUrl = op.LinkUrl; result.IconImageFileUrl = op.IconImageFile; result.Html = string.Format("<a href=\"{0}\">{1}</a>", result.LinkUrl, result.Subject); } return(result); }
protected void rptSubitems_ItemDataBound(object sender, RepeaterItemEventArgs e) { OperationForBackend opData = (OperationForBackend)e.Item.DataItem; int opId = opData.OpId; string subject = opData.Subject; bool isNewWindow = opData.IsNewWindow; string iconImageFile = opData.IconImageFile; bool isHideSelf = opData.IsHideSelf; string commonClass = opData.CommonClass; HtmlTableRow ItemArea = (HtmlTableRow)e.Item.FindControl("ItemArea"); if (isHideSelf) { ItemArea.Attributes["class"] = "table-danger"; } LinkButton btnMoveDown = (LinkButton)e.Item.FindControl("btnMoveDown"); btnMoveDown.ToolTip = Resources.Lang.btnMoveDown; LinkButton btnMoveUp = (LinkButton)e.Item.FindControl("btnMoveUp"); btnMoveUp.ToolTip = Resources.Lang.btnMoveUp; int itemNum = e.Item.ItemIndex + 1; if (itemNum == 1) { btnMoveUp.Visible = false; } if (itemNum == totalSubitems) { btnMoveDown.Visible = false; } if (c.qsSortField != "") { btnMoveUp.Visible = false; btnMoveDown.Visible = false; } HtmlAnchor btnItem = (HtmlAnchor)e.Item.FindControl("btnItem"); btnItem.Title = subject; btnItem.HRef = string.Format("Operation-Node.aspx?id={0}", opId); HtmlImage imgItem = (HtmlImage)e.Item.FindControl("imgItem"); if (iconImageFile != "") { imgItem.Src = "BPimages/icon/" + iconImageFile; } Literal ltrSubject = (Literal)e.Item.FindControl("ltrSubject"); ltrSubject.Text = subject; Literal ltrIsNewWindow = (Literal)e.Item.FindControl("ltrIsNewWindow"); ltrIsNewWindow.Text = isNewWindow ? Resources.Lang.IsNewWindow_Yes : Resources.Lang.IsNewWindow_No; Literal ltrCommonClass = (Literal)e.Item.FindControl("ltrCommonClass"); string commonClassBadge = string.Format("<span class='badge badge-secondary' title='{0}'>{1}</span>", commonClass, Resources.Lang.CommonClass_HasValue); ltrCommonClass.Text = string.IsNullOrEmpty(commonClass) ? "" : commonClassBadge; HtmlAnchor btnEdit = (HtmlAnchor)e.Item.FindControl("btnEdit"); btnEdit.Attributes["onclick"] = string.Format("popWin('Operation-Config.aspx?act={0}&id={1}', 700, 600); return false;", ConfigFormAction.edit, opId); btnEdit.Title = Resources.Lang.Main_btnEdit_Hint; Literal ltrEdit = (Literal)e.Item.FindControl("ltrEdit"); ltrEdit.Text = Resources.Lang.Main_btnEdit; LinkButton btnDelete = (LinkButton)e.Item.FindControl("btnDelete"); btnDelete.CommandArgument = string.Join(",", opId.ToString(), subject); btnDelete.Text = "<i class='fa fa-trash-o'></i> " + Resources.Lang.Main_btnDelete; btnDelete.ToolTip = Resources.Lang.Main_btnDelete_Hint; btnDelete.OnClientClick = string.Format("return confirm('" + Resources.Lang.Operation_ConfirmDelete_Format + "');", subject); if (!c.IsInRole("admin")) { btnMoveDown.Visible = false; btnMoveUp.Visible = false; btnEdit.Visible = false; btnDelete.Visible = false; } }