/// <summary> /// Loads all Used Book list for a specific ProductID. /// </summary> /// <param name="intProductID"></param> /// <param name="intCountryID"></param> /// <param name="intCategoryID"></param> /// <param name="intSubcategoryID"></param> /// <param name="intSecondSubcatID"></param> private void Load_BookList_UsedSeller(int intProductID, int intCountryID, int intCategoryID, int intSubcategoryID, int intSecondSubcatID) { dtUsedBookList = new DataTable(); AjaxControlToolkit.TabPanel tp = (AjaxControlToolkit.TabPanel)TabContainer.FindControl("tpUsedItems"); try { using (BC_Book bcBook = new BC_Book()) { dtUsedBookList = bcBook.Load_BookList_UsedSeller(intProductID, intCountryID, intCategoryID, intSubcategoryID, intSecondSubcatID); if (dtUsedBookList.Rows.Count > 0) { this.grvUsedBookList.DataSource = dtUsedBookList; this.grvUsedBookList.DataBind(); tp.HeaderText = "<span style=\"font-family:verdana; font-weight:bold;font-size:14px\">Used </span>("; tp.HeaderText += dtUsedBookList.Rows.Count + " from " + dtUsedBookList.Rows[0]["Price"].ToString(); tp.HeaderText += " " + dtUsedBookList.Rows[0]["Currency"].ToString() + ")"; } else { this.grvUsedBookList.DataSource = null; this.grvUsedBookList.DataBind(); tp.HeaderText = "<span style=\"font-family:verdana; font-weight:bold;font-size:14px\">Used </span>(0 item)"; } } } catch (Exception ex) { lblSystemMessage.Text = ex.Message; } }
public void ElaborazioneGeneraForm(AjaxControlToolkit.TabContainer TabContainerReferti, int iFormTipo) { string sSql = @"SELECT FormCampi.* FROM FormCampi WHERE (IDFormTipo = @IDFormTipo) ORDER BY Posizione"; SqlCommand cmd = new SqlCommand(sSql, _Conn); SqlParameter par = new SqlParameter("@IDFormTipo", iFormTipo); cmd.Parameters.Add(par); SqlDataAdapter adap = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); adap.Fill(dt); for (int x = 0; x < 6; x++) { AjaxControlToolkit.TabPanel tabPan = new AjaxControlToolkit.TabPanel(); try { foreach (DataRow dr in dt.Select("PosizioneTab = " + x)) { FormCampi campo = new FormCampi(dr); GeneraComponenti(campo, ref tabPan); } } catch { } if (tabPan.Controls.Count > 0) TabContainerReferti.Tabs.Add(tabPan); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //to ensure that the user is loggedin if (Request.IsAuthenticated) { AjaxControlToolkit.TabPanel activeTab = TabContainer1.ActiveTab; if (TabPanel2.TabIndex.ToString() == "1") { getAllBanners(); } //if (typelist.SelectedValue == "0") //{ // getArticlesCategories(); // if (checkNumCategories() != 0 && getArticlesCategories()) // { // getArticlesOrFood("article", departmentlist.SelectedValue); // //new // string encID = HttpUtility.UrlEncode(Encrypt(subjectlist.SelectedValue.ToString())); // HyperLink1.NavigateUrl = string.Format("Article.aspx?id={0}", encID); // url.Text = string.Format("Article.aspx?id={0}", encID); // } //} //else //{ // getStudies(); //} //if (getParentCategories()) //{ // int parentID = Convert.ToInt32(parentCategorylist.SelectedValue); // if (!getChildCategories(parentID).Equals(null)) // { // if (getChildCategories(parentID).Equals("0")) // { // getArticlesOrFood("article", childCategorylist.SelectedValue); // } // else // { // getArticlesOrFood("food", childCategorylist.SelectedValue); // } // } //} } else { Response.Redirect("~/Account/Login"); } } }
protected void atomesAdminPlaceHolder_Init(object sender, EventArgs e) { foreach (var atome in AtomeService.GetAtomesWithAdminWebControl()) { TabPanel tabPanel = new TabPanel(); var ctrl = (AdminWebControlContainer)LoadControl("AdminWebControlContainer.ascx"); ctrl.AtomeInfo = atome; tabPanel.Controls.Add(ctrl); tabPanel.HeaderText = atome.Name; this.TabContainer.Tabs.Add(tabPanel); } }
private void set_page_samples() { ds_analytics.req_samplesDataTable req_samp_dt = req_samples.getSamplesByReqid(process_reqid); //1. Removing extra tabpanels int no_tabs = Convert.ToInt32(Math.Ceiling(no_samples / Convert.ToDouble(no_samples_intab))); while (TabContainer1.Tabs.Count > no_tabs) { TabContainer1.Tabs.RemoveAt(TabContainer1.Tabs.Count - 1); } //2. Removing extra samples from last gridview int sample_inlastgrid = no_samples % no_samples_intab; int columns_tokeep = sample_inlastgrid + 2; //2 columns for Property ID, Name string gv_last = "GridView" + no_tabs.ToString(); //loop through tabcontainer int tab_no = 1; AjaxControlToolkit.TabContainer container = (AjaxControlToolkit.TabContainer)TabContainer1; foreach (object obj in container.Controls) { if (obj is AjaxControlToolkit.TabPanel) { AjaxControlToolkit.TabPanel tabPanel = (AjaxControlToolkit.TabPanel)obj; { GridView gv = ((GridView)(tabPanel.FindControl("GridView" + tab_no.ToString()))); if ((gv.ID == gv_last) && (sample_inlastgrid != 0)) { while (gv.Columns.Count > columns_tokeep) { //removing extra samples from last tab gv.Columns.RemoveAt(gv.Columns.Count - 1); } } DataTable dt_for_gv = get_dt_for_gv(tab_no, no_samples_intab, gv.Columns.Count - 2, req_samp_dt); //2 columns for Property ID, Name gv.DataSource = dt_for_gv; gv.DataBind(); //setting dropdown in gridview according to the Property value int col_gv = gv.Columns.Count; for (int i = 2; i <= col_gv - 1; i++) { DropDownList ddl_stor = ((DropDownList)(gv.Rows[gv.Rows.Count - 1].Cells[i].Controls[5])); ddl_stor.SelectedValue = dt_for_gv.Rows[gv.Rows.Count - 1][i].ToString(); } } tab_no++; } } }
void page_Init(object sender, EventArgs e) { List<tb_SuperMaket> listaa = getmarketList("GZU_North"); foreach (tb_SuperMaket one in listaa) { tttt1 = (GoodsShow)Page.LoadControl(Request.ApplicationPath + "/Control/UserCenter/GoodsShow.ascx"); tttt1.ContextDataShow = tlChechOutDetailRT1.dataBind; TabPanel tpanel = new TabPanel(); tpanel.HeaderText = one.superMarketName; tpanel.Controls.Add(tttt1); TabContainer1.Controls.Add(tpanel); tttt1.dataBind(one.SuperMarketId.ToString()); } }
public void Click(string SelectedParameter, TabPanel tp) { Chart1 = new Chart(); Chart1.ChartAreas.Add("ChartArea1"); Panel2.Controls.Clear(); foreach(ListItem l in listboxAvailable.Items) { if (l.Selected) { datalist.Clear(); generateGraph(SelectedParameter,l); generateTable(SelectedParameter, l); max++; } } }
protected void SelectTab(TabContainer tabContainer, string tabId) { if (tabContainer == null) { throw new ArgumentNullException("tabContainer"); } if (!String.IsNullOrEmpty(tabId)) { AjaxControlToolkit.TabPanel tab = tabContainer.FindControl(tabId) as AjaxControlToolkit.TabPanel; if (tab != null) { tabContainer.ActiveTab = tab; } } }
private void CreateArchivePanel() { DeletedStudyArchiveInfoCollection archiveList = _viewModel.DeletedStudyRecord.Archives; Platform.CheckTrue(archiveList.Count > 0, "archiveList is empty"); // make sure the list is sorted by timestamp archiveList.Sort( (archive1, archive2) => archive2.ArchiveTime.CompareTo(archive1.ArchiveTime)); Control panel = LoadArchiveInformationPanel(GetArchiveType(archiveList[0]), archiveList[0]); ArchiveViewPlaceHolder.Controls.Add(panel); if (archiveList.Count > 1) { var container = new TabContainer {CssClass = "DialogTabControl"}; for (int i = 1; i < archiveList.Count; i++) { DeletedStudyArchiveInfo theArchive = archiveList[i]; Control detailPanel = LoadArchiveInformationPanel(GetArchiveType(theArchive), theArchive); var tabPanel = new TabPanel { HeaderText = String.Format("{0} {1}", DateTimeFormatter.Format(theArchive.ArchiveTime, DateTimeFormatter.Style. Date), TransferSyntax.GetTransferSyntax( theArchive.TransferSyntaxUid). LossyCompressed ? "(Lossy)" : String.Empty) }; tabPanel.Controls.Add(detailPanel); container.Tabs.Add(tabPanel); } AdditionalArchivePlaceHolder.Controls.Add(container); } AdditionalArchivePlaceHolder.Visible = archiveList.Count > 1; ArchiveViewPlaceHolder.DataBind(); AdditionalArchivePlaceHolder.DataBind(); }
private void bind_req_samples() { ds_analytics.req_samplesDataTable req_samp_dt = req_samples.getSamplesByReqid(reqid); int no_samples = req_samp_dt.Rows.Count; int no_samples_intab = int.Parse(System.Configuration.ConfigurationManager.AppSettings["no_samples_intab"].ToString()); //removing extra tabpanels int no_tabs = Convert.ToInt32(Math.Ceiling(no_samples / Convert.ToDouble(no_samples_intab))); while (TabContainer1.Tabs.Count > no_tabs) { TabContainer1.Tabs.RemoveAt(TabContainer1.Tabs.Count - 1); } //removing extra samples from last tab int sample_inlastgrid = no_samples % no_samples_intab; int columns_tokeep = sample_inlastgrid + 2; //2 columns for Property ID, Name string gv_last = "GridView" + no_tabs.ToString(); //loop through tabcontainer int tab_no = 1; AjaxControlToolkit.TabContainer container = (AjaxControlToolkit.TabContainer)TabContainer1; foreach (object obj in container.Controls) { if (obj is AjaxControlToolkit.TabPanel) { AjaxControlToolkit.TabPanel tabPanel = (AjaxControlToolkit.TabPanel)obj; { GridView gv = ((GridView)(tabPanel.FindControl("GridView" + tab_no.ToString()))); if ((gv.ID == gv_last) && (sample_inlastgrid != 0)) { while (gv.Columns.Count > columns_tokeep) { //removing extra samples from last tab gv.Columns.RemoveAt(gv.Columns.Count - 1); } } gv.DataSource = get_dt_for_gv(tab_no, no_samples_intab, gv.Columns.Count - 2, req_samp_dt); //2 columns for Property ID, Name gv.DataBind(); } tab_no++; } } }
private void set_page_samples() { //1. Removing extra tabpanels int no_tabs = Convert.ToInt32(Math.Ceiling(no_samples / Convert.ToDouble(no_samples_intab))); while (TabContainer1.Tabs.Count > no_tabs) { TabContainer1.Tabs.RemoveAt(TabContainer1.Tabs.Count - 1); } //2. Removing extra samples from last gridview int sample_inlastgrid = no_samples % no_samples_intab; int columns_tokeep = sample_inlastgrid + 2; //2 columns for Property ID, Name string gv_last = "GridView" + no_tabs.ToString(); //loop through tabcontainer DataTable dt_properties = other.getProperties(); int tab_no = 1; AjaxControlToolkit.TabContainer container = (AjaxControlToolkit.TabContainer)TabContainer1; foreach (object obj in container.Controls) { if (obj is AjaxControlToolkit.TabPanel) { AjaxControlToolkit.TabPanel tabPanel = (AjaxControlToolkit.TabPanel)obj; { GridView gv = ((GridView)(tabPanel.FindControl("GridView" + tab_no.ToString()))); if ((gv.ID == gv_last) && (sample_inlastgrid != 0)) { while (gv.Columns.Count > columns_tokeep) { //removing extra samples from last tab gv.Columns.RemoveAt(gv.Columns.Count - 1); } } gv.DataSource = dt_properties; gv.DataBind(); } tab_no++; } } }
private void RefreshDetailGroup() { for (int i = TabContainer1.Tabs.Count - 1; i >= 1; i--) { TabContainer1.Tabs.RemoveAt(i); } string FormID = DNTRequest.GetString("fmid"); DataTable dtDetailGroup = DbHelper.GetInstance().GetDBRecords("a.NodeID,d.FormID,d.GroupID,d.GroupName", "Workflow_FlowNode a,Workflow_Base b,Workflow_FormBase c,Workflow_FormFieldGroup d", "a.WorkflowID=b.WorkflowID and b.FormID=c.FormID and c.FormID=d.FormID and a.NodeID=" + DNTRequest.GetString("id"), "d.DisplayOrder"); for (int i = 0; i < dtDetailGroup.Rows.Count; i++) { TabPanel tp = new TabPanel(); DetialFieldControl _DetialFieldControl = (DetialFieldControl)(Page.LoadControl("UserControl/DetialFieldControl.ascx")); _DetialFieldControl.id = DNTRequest.GetString("id"); _DetialFieldControl.gid = dtDetailGroup.Rows[i]["GroupID"].ToString(); tp.Controls.Add(_DetialFieldControl); TabContainer1.Tabs.Add(tp); TabContainer1.Tabs[1 + i].HeaderText = string.Format("明细字段({0})", dtDetailGroup.Rows[i]["GroupName"]); } }
private void RefreshDetailGroup() { for (int i = TabContainer1.Tabs.Count - 1; i >= 1; i--) { TabContainer1.Tabs.RemoveAt(i); } string FormID = DNTRequest.GetString("fmid"); DataTable dtDetailGroup = DbHelper.GetInstance().GetDBRecords("GroupID,GroupName", "Workflow_FormFieldGroup ", "FormID=" + FormID, "DisplayOrder"); for (int i = 0; i < dtDetailGroup.Rows.Count; i++) { TabPanel tp = new TabPanel(); FormFieldRowRule _FormFieldRowRule = (FormFieldRowRule)(Page.LoadControl("UserControl/FormFieldRowRule.ascx")); _FormFieldRowRule.fid = FormID; _FormFieldRowRule.gid = dtDetailGroup.Rows[i]["GroupID"].ToString(); tp.Controls.Add(_FormFieldRowRule); TabContainer1.Tabs.Add(tp); TabContainer1.Tabs[1 + i].HeaderText = string.Format("明细字段({0})", dtDetailGroup.Rows[i]["GroupName"]); } }
protected void RefreshAircraft() { ScheduleDisplayMode sdm = (ScheduleDisplayMode)Enum.Parse(typeof(ScheduleDisplayMode), rbScheduleMode.SelectedValue); SchedulePreferences.DefaultScheduleMode = sdm; IEnumerable <ClubAircraft> lstAc = CurrentClub.MemberAircraft; if (!lstAc.Any()) { mvClubAircraft.SetActiveView(vwNoAircraft); divCalendar.Visible = false; } else if (lstAc.Count() == 1) { divCalendar.Visible = true; mvClubAircraft.SetActiveView(vwOneAircraft); casSingleAircraft.Mode = sdm; casSingleAircraft.Aircraft = lstAc.ElementAt(0); } else { divCalendar.Visible = true; mvClubAircraft.SetActiveView(vwMultipleAircraft); tcAircraftSchedules.Tabs.Clear(); foreach (ClubAircraft ac in lstAc) { AjaxControlToolkit.TabPanel tp = new AjaxControlToolkit.TabPanel(); tcAircraftSchedules.Tabs.Add(tp); tp.HeaderText = ac.TailNumber; Controls_ClubControls_ClubAircraftSchedule cas = (Controls_ClubControls_ClubAircraftSchedule)LoadControl("~/Controls/ClubControls/ClubAircraftSchedule.ascx"); cas.Mode = sdm; tp.CssClass = "mfbDefault"; tp.ID = ac.AircraftID.ToString(CultureInfo.InvariantCulture); tp.Controls.Add(cas); cas.Aircraft = ac; tcAircraftSchedules.ActiveTabIndex = 0; } } }
private void OnAddTabPanel() { IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); if (host != null) { TabContainer tc = TabContainer; using (DesignerTransaction dt = host.CreateTransaction("Add new TabPanel")) { TabPanel tp = (TabPanel)host.CreateComponent(typeof(TabPanel)); if (tp != null) { // set up the inital state // tp.ID = GetUniqueName(typeof(TabPanel), tc); tp.HeaderText = tp.ID; IComponentChangeService changeService = (IComponentChangeService)GetService(typeof(IComponentChangeService)); try { changeService.OnComponentChanging(tc, TypeDescriptor.GetProperties(tc)["Tabs"]); tc.Tabs.Add(tp); } finally { changeService.OnComponentChanged(tc, TypeDescriptor.GetProperties(tc)["Tabs"], tc.Tabs, tc.Tabs); } TypeDescriptor.GetProperties(tc)["ActiveTab"].SetValue(tc, tp); CurrentTabID = tp.ID; } dt.Commit(); } } }
/// <summary> /// Helper method to save the value of a template. This sets up all the right Undo state. /// </summary> /// <param name="panel"></param> /// <param name="host"></param> /// <param name="template"></param> /// <param name="propertyName"></param> private static void PersistTemplate(TabPanel panel, IDesignerHost host, ITemplate template, string propertyName) { PropertyDescriptor descriptor = TypeDescriptor.GetProperties(panel)[propertyName]; using (DesignerTransaction transaction = host.CreateTransaction("SetEditableDesignerRegionContent")) { descriptor.SetValue(panel, template); transaction.Commit(); } }
/// <summary> /// Get the content for a given tab or header /// </summary> /// <param name="tab">The tab to search</param> /// <param name="content">True for ContentTemplate, otherwise it'll do HeaderTemplate</param> /// <returns></returns> private string GetTabContent(TabPanel tab, bool content) { if (tab != null) { if (content && tab.ContentTemplate != null) { return GetTemplateContent(tab.ContentTemplate, "_content"); } else if (!content) { if (tab.HeaderTemplate != null) { return GetTemplateContent(tab.HeaderTemplate, "_header"); } return tab.HeaderText; } } return ""; }
private static void PersistTemplateContent(TabPanel panel, IDesignerHost host, string content, string propertyName) { ITemplate template = ControlParser.ParseTemplate(host, content); PersistTemplate(panel, host, template, propertyName); }
protected void btn_submit_Click(object sender, EventArgs e) { if (mode == "edit") { //update existing request data #region Request //1. update request process_req_row.projectid = Convert.ToInt64(ddl_project.SelectedValue); process_req_row.analysistype = ddl_typeanalysis.SelectedValue; process_req_row.reqtype = ddl_typerequest.SelectedValue; process_req_row.responsible = ddl_lead.SelectedValue; process_req_row.statusid = 2; process_req_row.req_cmnt = tb_addinfo.Text; requests.update_Request(process_req_row); #endregion #region Samples //2. update sample values int tab_no = 1; AjaxControlToolkit.TabContainer container = (AjaxControlToolkit.TabContainer)TabContainer1; foreach (object obj in container.Controls) { if (obj is AjaxControlToolkit.TabPanel) { AjaxControlToolkit.TabPanel tabPanel = (AjaxControlToolkit.TabPanel)obj; { GridView gv = ((GridView)(tabPanel.FindControl("GridView" + tab_no.ToString()))); int cols = gv.Columns.Count; for (int i_col = 2; i_col < cols; i_col++) { int sampleno = Convert.ToInt32(gv.Columns[i_col].HeaderText.Substring(6)); string sampleid = String.Concat(process_reqid, sampleno.ToString("00")); //insert a row in req_samples table String value = ""; int propertyid; foreach (GridViewRow gvr in gv.Rows) { if (gvr.RowType == DataControlRowType.DataRow) { propertyid = Convert.ToInt32(gvr.Cells[0].Text); if (gvr.RowIndex != 11) { value = ((TextBox)(gvr.Cells[i_col].Controls[1])).Text; } else { value = ((DropDownList)(gvr.Cells[i_col].Controls[5])).SelectedValue; } //update a row in sample_pvalue table sample_pvalue.updateSample_Pvalue(sampleid, propertyid, value); } } } } tab_no++; } } #endregion #region Tests foreach (GridViewRow gvr in gv_tests.Rows) { if (gvr.RowType == DataControlRowType.DataRow) { long test_id = Convert.ToInt64(gv_tests.DataKeys[gvr.RowIndex].Value); string testname = ((TextBox)gvr.FindControl("tb_testname")).Text; string reference = ((DropDownList)gvr.FindControl("dd_specification")).SelectedValue; string standard = ((TextBox)gvr.FindControl("tb_standard")).Text; string unit = ((TextBox)gvr.FindControl("tb_unit")).Text; //Update Test Details in req_tests table req_tests.update_Req_Tests(testname, reference, standard, unit, test_id); } } #endregion #region Test_Samples if (!is_test_sample_selected()) { string errorText = "You have not selected the samples for all tests. You should select at least one sample for each test."; ClientScriptManager cs = Page.ClientScript; cs.RegisterStartupScript(this.GetType(), "error", "<script>alert('" + errorText + "');</script>"); } else if (gv_test_sample.EditIndex == -1) { dt_test_sample = (DataTable)Session["dt_test_sample"]; foreach (DataRow dr in dt_test_sample.Rows) { long test_id = Convert.ToInt64(dr["test_id"]); for (int no = 3; no <= dt_test_sample.Columns.Count - 1; no++) { bool isselected = Convert.ToBoolean(dr[no]); string sampleid = process_reqid + (no - 2).ToString("00"); //update test_sample test_samples.updateTest_Sample(test_id, sampleid, isselected); } } //redirect string url = "home.aspx"; ClientScript.RegisterStartupScript(this.GetType(), "callfunction", "alert('Updated Request Submitted Successfully.');window.location.href = '" + url + "';", true); } else { string errorText = "Error: Selection of Samples for Test is not correct. Please ensure you have selected samples for each test."; ClientScriptManager cs = Page.ClientScript; cs.RegisterStartupScript(this.GetType(), "error", "<script>alert('" + errorText + "');</script>"); } #endregion //mail do_mail(mode, process_req_row.reqid); } else if (mode == "copy") { if (!is_test_sample_selected()) { string errorText = "You have not selected the samples for all tests. You should select at least one sample for each test."; ClientScriptManager cs = Page.ClientScript; cs.RegisterStartupScript(this.GetType(), "error", "<script>alert('" + errorText + "');</script>"); } else if (gv_test_sample.EditIndex == -1) { //insert new request data #region Request string new_reqid = requests.get_new_reqid(); //Insert Request Details + add info requests.insert_request(new_reqid, Convert.ToInt64(ddl_project.SelectedValue), ddl_typeanalysis.SelectedValue, ddl_typerequest.SelectedValue, userid, ddl_lead.SelectedValue, ddl_lead.SelectedValue, null, 2, tb_addinfo.Text); #endregion #region Samples int tab_no = 1; AjaxControlToolkit.TabContainer container = (AjaxControlToolkit.TabContainer)TabContainer1; foreach (object obj in container.Controls) { if (obj is AjaxControlToolkit.TabPanel) { AjaxControlToolkit.TabPanel tabPanel = (AjaxControlToolkit.TabPanel)obj; { GridView gv = ((GridView)(tabPanel.FindControl("GridView" + tab_no.ToString()))); int cols = gv.Columns.Count; for (int i_col = 2; i_col < cols; i_col++) { int sampleno = Convert.ToInt32(gv.Columns[i_col].HeaderText.Substring(6)); string sampleid = String.Concat(new_reqid, sampleno.ToString("00")); //insert a row in req_samples table req_samples.insert_Req_Samples(sampleid, new_reqid, sampleno, true); String value = ""; int propertyid; foreach (GridViewRow gvr in gv.Rows) { if (gvr.RowType == DataControlRowType.DataRow) { propertyid = Convert.ToInt32(gvr.Cells[0].Text); if (gvr.RowIndex != 11) { value = ((TextBox)(gvr.Cells[i_col].Controls[1])).Text; } else { value = ((DropDownList)(gvr.Cells[i_col].Controls[5])).SelectedValue; } //insert a row in sample_pvalue table sample_pvalue.insertSample_Pvalue(sampleid, propertyid, value); } } } } tab_no++; } } #endregion #region Tests foreach (GridViewRow gvr in gv_tests.Rows) { if (gvr.RowType == DataControlRowType.DataRow) { string testname = ((TextBox)gvr.FindControl("tb_testname")).Text; string reference = ((DropDownList)gvr.FindControl("dd_specification")).SelectedValue; string standard = ((TextBox)gvr.FindControl("tb_standard")).Text; string unit = ((TextBox)gvr.FindControl("tb_unit")).Text; //Insert Test Details in req_tests table long?test_id = req_tests.insert_Req_Tests(new_reqid, testname, reference, standard, unit); if (test_id.HasValue) { #region Test-Samples dt_test_sample = (DataTable)Session["dt_test_sample"]; for (int no = 3; no <= dt_test_sample.Columns.Count - 1; no++) { //in copy request "dt_test_sample" has one extra column named test_id bool isselected = Convert.ToBoolean(dt_test_sample.Rows[gvr.RowIndex][no]); string sampleid = new_reqid + (no - 2).ToString("00"); //Insert Test-Samples Selected in test_samples table test_samples.insertTest_Sample(test_id, sampleid, isselected); } #endregion } } } #endregion //mail do_mail(mode, new_reqid); //redirect string url = "home.aspx"; ClientScript.RegisterStartupScript(this.GetType(), "callfunction", "alert('Request Submitted Successfully.');window.location.href = '" + url + "';", true); } else { string errorText = "You have not selected the samples for tests appropriately. You should select at least one sample for each test."; ClientScriptManager cs = Page.ClientScript; cs.RegisterStartupScript(this.GetType(), "error", "<script>alert('" + errorText + "');</script>"); } } }
public static void SetDataToControls(TabPanel oPanel, DataTable oDT, int eFormID) { foreach (System.Web.UI.Control oControl in oPanel.Controls) { for (int n = 0; n <= oDT.Columns.Count - 1; n++) { string ColumnName = oDT.Columns[n].ColumnName; Control oWControl = oPanel.FindControl("txtEform" + ColumnName )as Control; if (oWControl != null) { TextBox oText = oWControl as TextBox; oText.Text = oDT.Rows[0][ColumnName].ToString(); } Control oOtherControl = oPanel.FindControl( ColumnName) as Control; if (oOtherControl != null) { if (oOtherControl is TextBox) { TextBox oText = oOtherControl as TextBox; oText.Text = oDT.Rows[0][ColumnName].ToString(); } else if (oOtherControl is DropDownList) { DropDownList oDDL = oOtherControl as DropDownList; oDDL.SelectedValue = oDT.Rows[0][ColumnName].ToString(); } else if (oOtherControl is CheckBox) { CheckBox oChk = oOtherControl as CheckBox; if (oDT.Rows[0][ColumnName].ToString() != string.Empty ) { if (Convert.ToBoolean(oDT.Rows[0][ColumnName]) == false) { oChk.Checked = false; } else { oChk.Checked = true; } } } else if (oOtherControl is UserControl ) { if (oDT.Rows[0][ColumnName] != null) { if (oDT.Rows[0][ColumnName].ToString() != string.Empty) { if (HttpContext.Current.Session[ImageList] == null) { Hashtable oImageValue = new Hashtable(); oImageValue.Add(oOtherControl.ClientID, oDT.Rows[0][ColumnName].ToString()); HttpContext.Current.Session[ImageList] = oImageValue; ucImageControl oImage = oOtherControl as ucImageControl; HttpContext.Current.Session[FormDesign.SessionImageList] = oImageValue; oImage.SetImagePath(); } else { if (oDT.Rows[0][ColumnName] != null) { Hashtable oImageValue = HttpContext.Current.Session[ImageList] as Hashtable; if (!oImageValue.ContainsKey(oOtherControl.ClientID)) { oImageValue.Add(oOtherControl.ClientID, oDT.Rows[0][ColumnName].ToString()); HttpContext.Current.Session[ImageList] = oImageValue; HttpContext.Current.Session[FormDesign.SessionImageList] = oImageValue; ucImageControl oImage = oOtherControl as ucImageControl ; oImage.SetImagePath(); } } } } } } } } } }
protected void Bind() { if (m_checklistRow == null) { return; } ContentRow contentRow = m_checklistRow as ContentRow; CheckboxRow checkboxRow = m_checklistRow as CheckboxRow; // Container rows are subclasses of contentrow, so check for contentrow last. if (m_checklistRow is ContainerRow containerRow) { mvItem.SetActiveView(vwRepeater); if (!NoHeader) { lblHeader.Text = HttpUtility.HtmlEncode(m_checklistRow.Content ?? string.Empty); } List <ChecklistRow> contents = new List <ChecklistRow>(); List <ChecklistRow> tabs = new List <ChecklistRow>(); List <ChecklistRow> headers = new List <ChecklistRow>(); List <ChecklistRow> subheaders = new List <ChecklistRow>(); foreach (ChecklistRow ckl in containerRow.ContainedItems) { if (ckl is TabContainer) { tabs.Add(ckl); } else if (ckl is HeaderContainer) { headers.Add(ckl); } else if (ckl is SubHeaderContainer) { subheaders.Add(ckl); } else { contents.Add(ckl); } } // OK. First bind the leaf content nodes - plain text and checkbox items. rptRows.DataSource = contents; rptRows.DataBind(); // Now bind subheaders if (subheaders.Count != 0) { rptSubHeaders.DataSource = subheaders; rptSubHeaders.DataBind(); } // Now bind the header rows: accordionRows.DataSource = headers; accordionRows.DataBind(); // Finally, do any tabs for (int i = 0; i < tabs.Count; i++) { ChecklistRow tabRow = tabs[i]; AjaxControlToolkit.TabPanel tp = new AjaxControlToolkit.TabPanel(); tabRows.Tabs.Add(tp); tp.HeaderText = HttpUtility.HtmlEncode(tabRow.Content); tp.ID = String.Format(CultureInfo.InvariantCulture, "cklTabItem{0}", i); Controls_ChecklistControls_ChecklistItem ckli = (Controls_ChecklistControls_ChecklistItem)LoadControl("~/Controls/ChecklistControls/ChecklistItem.ascx"); tp.Controls.Add(ckli); ckli.NoHeader = true; ckli.DataItem = tabRow; } } else if (checkboxRow != null || contentRow != null) { rptRows.DataSource = new ChecklistRow[] { m_checklistRow }; rptRows.DataBind(); } }
void buildJobPanel(Job j, Alerts alerts, string category, string alliswelltext) { AlertSet catAlerts = alerts[category]; TabContainer tc = new TabContainer(); tc.Height = 200; tc.ScrollBars = ScrollBars.Vertical; TabPanel tabSummary = buildSummaryTab(category, alliswelltext, alerts); TabPanel tabStats = new TabPanel(); tabStats.HeaderTemplate = new TabHeaderTemplate(AlertLevel.None, "Statistics", "Statistical information about the job."); tabStats.ContentTemplate = new TabContentTemplate(new List<string>()); tabStats.Controls.Add(buildStatistics(j, category)); tc.Tabs.Add(tabSummary); tc.Tabs.Add(tabStats); tc.Tabs.Add(buildListTab("Errors", AlertLevel.Warning, j.Errors[category], "A benchmark is classified as erroneous when its return value is non-zero (except for memory outs).")); tc.Tabs.Add(buildListTab("Bugs", AlertLevel.Critical, j.Bugs[category], "A benchmark is classified as buggy when its result does not agree with its annotation.")); tc.Tabs.Add(buildListTab("Underperformers", AlertLevel.None, j.Underperformers[category], "A benchmark underperforms when it has SAT/UNSAT annotations and some of them were not achieved.")); tc.Tabs.Add(buildListTab("Dippers", AlertLevel.None, j.Dippers[category], "A benchmark is classified as a dipper when it takes more than 10x more time than in a reference job (usually the previous).")); phMain.Controls.Add(tc); }
protected Control buildTabPanels() { TabContainer tc = new TabContainer(); tc.Height = 250; tc.ScrollBars = ScrollBars.Vertical; TabPanel tabStats = new TabPanel(); tabStats.HeaderTemplate = new TabHeaderTemplate(AlertLevel.None, "Statistics", "Various statistical values."); tabStats.Controls.Add(buildSummary()); tc.Tabs.Add(tabStats); tabStats = new TabPanel(); tabStats.HeaderTemplate = new TabHeaderTemplate(AlertLevel.None, "Mean Happiness [Subdirs]", "A rating of the subdirectories by mean happiness."); tabStats.Controls.Add(buildMeanHappinessPanel()); tc.Tabs.Add(tabStats); tabStats = new TabPanel(); tabStats.HeaderTemplate = new TabHeaderTemplate(AlertLevel.None, "Mean Happiness [Top " + top_n + " Users]", "A rating of the users by mean happiness."); tabStats.Controls.Add(buildMeanHappinessPanelUsers(top_n)); tc.Tabs.Add(tabStats); tabStats = new TabPanel(); tabStats.HeaderTemplate = new TabHeaderTemplate(AlertLevel.None, "Dispersion Happiness [Subdirs]", "A rating of the subdirectories by dispersion happiness."); tabStats.Controls.Add(buildDispersionHappinessPanel()); tc.Tabs.Add(tabStats); tabStats = new TabPanel(); tabStats.HeaderTemplate = new TabHeaderTemplate(AlertLevel.None, "Dispersion Happiness [Top " + top_n + " Users]", "A rating of the users by dispersion happiness."); tabStats.Controls.Add(buildDispersionHappinessPanelUsers(top_n)); tc.Tabs.Add(tabStats); return tc; }
private static TabPanel CreateTab(string name, string desc) { TabPanel tp = new TabPanel(); // tp.HeaderTemplate = new MyHeaderTemplate(name, desc); ; //tp.Controls.Add(new LiteralControl(string.Formatndiv class=\"tabBody\">{0}</div>", name))); return tp; }
TabPanel buildListTab(string title, AlertLevel level, List<string> items, string toolTip) { TabPanel result = new TabPanel(); TabHeaderTemplate htm = new TabHeaderTemplate(items.Count == 0 ? AlertLevel.None : level, title, toolTip); if (items.Count > 0) htm._title += " (" + items.Count + ")"; result.HeaderTemplate = htm; result.ContentTemplate = new TabContentTemplate(new List<string>()); result.Controls.Add(buildList(items)); return result; }
public void SetupLoadPartitionTabs(GetTabPanel tabDelegate) { if(ServerPartitionList == null || ServerPartitionList.Count == 0) { NoPartitionPanel.Visible = true; PartitionPanel.Visible = false; return; } NoPartitionPanel.Visible = false; PartitionPanel.Visible = true; int n = 0; this.PartitionTabContainer.Tabs.Clear(); foreach (ServerPartition part in ServerPartitionList) { n++; // create a tab TabPanel tabPanel = new TabPanel(); tabPanel.HeaderText = part.AeTitle; tabPanel.ID = "Tab_" + n; if (tabDelegate != null) { // create a panel for the control UserControl panel = tabDelegate(part); // wrap an updatepanel around the tab UpdatePanel updatePanel = new UpdatePanel(); updatePanel.ContentTemplateContainer.Controls.Add(panel); // put the panel into a lookup table to be used later _mapPanel[part.GetKey()] = updatePanel; // Add the device panel into the tab tabPanel.Controls.Add(updatePanel); } // Add the tab into the tabstrip PartitionTabContainer.Tabs.Add(tabPanel); } if (ServerPartitionList != null && ServerPartitionList.Count > 0) { PartitionTabContainer.ActiveTabIndex = 0; } else { PartitionTabContainer.ActiveTabIndex = -1; } }
TabPanel buildSummaryTab(string category, string alliswelltext, Alerts alerts) { TabPanel tabSummary = new TabPanel(); string toolTip = "This tab lists all alerts."; if (category == "") { int total = 0; AlertLevel al = AlertLevel.None; foreach (KeyValuePair<string, CategoryStatistics> kvp in timeline.Categories) { string cat = kvp.Key; AlertSet catAlerts = alerts[cat]; total += catAlerts.Count; if ((al == AlertLevel.None && catAlerts.Level != al) || (al == AlertLevel.Warning && catAlerts.Level == AlertLevel.Critical)) al = catAlerts.Level; if (catAlerts.Count > 0) { Label l = new Label(); l.Text = string.Format("Alerts in <a href='" + selfLink(cat) + "' style='text-decoration:none;'>{0}</a>:", cat); tabSummary.Controls.Add(l); tabSummary.Controls.Add(buildAlertMessages(catAlerts, "")); } } TabHeaderTemplate htm = new TabHeaderTemplate(al, "Alerts", toolTip); if (total > 0) htm._title += " (" + total + ")"; tabSummary.HeaderTemplate = htm; tabSummary.ContentTemplate = new TabContentTemplate(new List<string>()); if (total == 0) { Label l = new Label(); l.Text = alliswelltext; l.ForeColor = Color.Green; tabSummary.Controls.Add(l); } } else { AlertSet catAlerts = alerts[category]; TabHeaderTemplate htm = new TabHeaderTemplate(catAlerts.Level, "Alerts", toolTip); if (catAlerts.Count > 0) htm._title += " (" + catAlerts.Count + ")"; tabSummary.HeaderTemplate = htm; tabSummary.ContentTemplate = new TabContentTemplate(new List<string>()); tabSummary.Controls.Add(buildAlertMessages(catAlerts, alliswelltext)); } return tabSummary; }
public void SetPanelControl(TabPanel oPanel, List<DesignFormField> oControlList) { // DataMappingDataContext db = new DataMappingDataContext(AppModuleManager.ConnectionString); // hash table to hold all build in control Hashtable BuildInControlList = new Hashtable(); if (HttpContext.Current.Session[SessionFormDesignControlList] != null) { BuildInControlList = (Hashtable)HttpContext.Current.Session[SessionFormDesignControlList]; } //Session[AppConstManager.SessionFormDesignControlList] = string.Empty ; string cssStyle = string.Empty; int num; foreach (var oItem in oControlList) { // Button if (oItem.ControlType == Convert.ToInt32(ControlType.Button)) { Button oButton = new Button(); oButton.ID = oItem.Name; // add some buid in control to session if ((oButton.ID == BuildInChangeButtonControl) || (oButton.ID == BuildInChangeLoginNameButtonControl)) { if (!BuildInControlList.ContainsKey(oButton.ID)) { BuildInControlList.Add(oButton.ID, oButton); } } if (oButton.SkinID != null) { if (oItem.SkinID != string.Empty) { oButton.SkinID = oItem.SkinID; } else { oButton.SkinID = ButtonSkinID; } } else { oButton.SkinID = ButtonSkinID; } string cStyle = string.Empty; bool IsTop = int.TryParse(oItem.ControlTop.ToString(), out num); if (IsTop == true) { cssStyle = ccsRelative + ccsTop + num.ToString() + ccsPX; } cStyle = cssStyle; bool IsLeft = int.TryParse(oItem.ControlLeft.ToString(), out num); if (IsLeft == true) { cssStyle = cssStyle + ccsLeft + num.ToString() + ccsPX; } LiteralControl oLiteral = new LiteralControl(); oLiteral.Text = "<Div id=\"DIV" + oButton.ID + "\" Style='" + cssStyle + "'>"; // oLabel.Attributes.Add(AppConstManager.cStyle, cssStyle); oPanel.Controls.Add(oLiteral); oButton.Text = oItem.Label; oButton.ToolTip = oItem.Label; oPanel.Controls.Add(oButton); LiteralControl oEndLiteral = new LiteralControl(); oEndLiteral.Text = "</Div>"; // Button oExist = (Button)oPanel.FindControl(oButton.ID); //if (oExist == null) { oPanel.Controls.Add(oEndLiteral); } //oButton.Attributes.Add(AppConstManager.cStyle, cssStyle); } //Literal if (oItem.ControlType == Convert.ToInt32(ControlType.Literal)) { Literal oLiteral = new Literal(); oLiteral.ID = oItem.Name; if (oLiteral.SkinID != null) { if (oItem.SkinID != string.Empty) { oLiteral.SkinID = oItem.SkinID; } else { oLiteral.SkinID = LieralSkinID; } } else { oLiteral.SkinID = LieralSkinID; } string cStyle = string.Empty; bool IsTop = int.TryParse(oItem.ControlTop.ToString(), out num); if (IsTop == true) { cssStyle = ccsRelative + ccsTop + num.ToString() + ccsPX; } cStyle = cssStyle; bool IsLeft = int.TryParse(oItem.ControlLeft.ToString(), out num); if (IsLeft == true) { cssStyle = cssStyle + ccsLeft + num.ToString() + ccsPX; } cStyle = cStyle + "; " + cssStyle; String oHTML = oItem.Label.Replace("[position]", cStyle); oLiteral.Text = oHTML; oPanel.Controls.Add(oLiteral); } else if (oItem.ControlType == Convert.ToInt32(ControlType.DrowDownList)) { DropDownList oDDL = new DropDownList(); oDDL.ID = oItem.Name; // +oItem.ControlType; oDDL.ToolTip = oItem.Name; if (oItem.SkinID != null) { if (oItem.SkinID != string.Empty) { oDDL.SkinID = oItem.SkinID; } else { oDDL.SkinID = DropDownListSkinID; } } else { oDDL.SkinID = DropDownListSkinID; } //oDDL.SkinID = "sDropDownList"; if (oItem.IsVisible == true) { if (oItem.IsEnabled == false) { oDDL.Enabled = false; } bool IsTop = int.TryParse(oItem.ControlTop.ToString(), out num); if (IsTop == true) { cssStyle = ccsRelative + ccsTop + num.ToString() + ccsPX; // oDDL.Attributes.Add(AppConstManager.cStyle, AppConstManager.ccsRelative); // oDDL.Attributes.Add(AppConstManager.cStyle, num.ToString() + AppConstManager.ccsPX); } bool IsLeft = int.TryParse(oItem.ControlLeft.ToString(), out num); if (IsLeft == true) { cssStyle = cssStyle + ccsLeft + num.ToString() + ccsPX; //oDDL.Attributes.Add(AppConstManager.cStyle, AppConstManager.ccsLeft + num.ToString() + AppConstManager.ccsPX); } // oDDL.Attributes.Add(AppConstManager.cStyle, cssStyle); //Get data source if (oItem.QueryStatement != null) { if (oItem.QueryStatement != string.Empty) { DBManager oDB = new DBManager(); DataTable oDS = oDB.GetDataTableFromSQL(oItem.QueryStatement); string DisplayValue = oDS.Columns[0].ColumnName; string IDValue = oDS.Columns[1].ColumnName; SetListToDropDownList(oDS, oDDL, DisplayValue, IDValue); // oDDLManager.SetDatasetToDropDownList(oDS, oDDL, DisplayValue, IDValue, true); } } else { if (oItem.DataListType != null && oItem.DataListType != string.Empty) { List<DesignFormDataList> oDDLList = DesignFormDataList.GetDataListByType(oItem.DataListType); oDDL.DataSource = oDDLList; oDDL.DataTextField = "DisplayField"; oDDL.DataValueField = "ValueField"; oDDL.DataBind(); } } //set label if (oItem.IsReadOnly == true) { oDDL.Enabled = false; } SetControlLabel(oPanel, oItem, eFormID); LiteralControl oLiteral = new LiteralControl(); oLiteral.Text = "<Div id=\"DIV" + oDDL.ID + "\" Style='" + cssStyle + "'>"; // oLabel.Attributes.Add(AppConstManager.cStyle, cssStyle); oPanel.Controls.Add(oLiteral); oPanel.Controls.Add(oDDL); LiteralControl oEndLiteral = new LiteralControl(); oEndLiteral.Text = "</Div>"; oPanel.Controls.Add(oEndLiteral); } } else if (oItem.ControlType == Convert.ToInt32(ControlType.CheckBox)) { CheckBox oChk = new CheckBox(); oChk.ID = oItem.Name; //+ oItem.ControlType; oChk.ToolTip = oItem.Name; if (oItem.SkinID != null) { if (oItem.SkinID != string.Empty) { oChk.SkinID = oItem.SkinID; } else { oChk.SkinID = CheckBoxSkinID; } } else { oChk.SkinID = CheckBoxSkinID; } if (oItem.HasDefault== true) { oChk.Checked = true; } else { oChk.Checked = false; } //oChk.SkinID = "DesignCheckBox"; if (oItem.IsVisible == true) { if (oItem.IsEnabled == false) { oChk.Enabled = false; } bool IsTop = int.TryParse(oItem.ControlTop.ToString(), out num); if (IsTop == true) { cssStyle = ccsRelative + ccsTop + num.ToString() + ccsPX; // oDDL.Attributes.Add(AppConstManager.cStyle, AppConstManager.ccsRelative); // oDDL.Attributes.Add(AppConstManager.cStyle, num.ToString() + AppConstManager.ccsPX); } bool IsLeft = int.TryParse(oItem.ControlLeft.ToString(), out num); if (IsLeft == true) { cssStyle = cssStyle + ccsLeft + num.ToString() + ccsPX; //oDDL.Attributes.Add(AppConstManager.cStyle, AppConstManager.ccsLeft + num.ToString() + AppConstManager.ccsPX); } Boolean IsSetTrue = false; //oChk.Attributes.Add(AppConstManager.cStyle, cssStyle); //set label SetControlLabel(oPanel, oItem, eFormID); if (IsSetTrue) { oChk.Checked = true; } LiteralControl oLiteral = new LiteralControl(); oLiteral.Text = "<Div id=\"DIV" + oChk.ID + "\" Style='" + cssStyle + "'>"; // oLabel.Attributes.Add(AppConstManager.cStyle, cssStyle); oPanel.Controls.Add(oLiteral); oPanel.Controls.Add(oChk); LiteralControl oEndLiteral = new LiteralControl(); oEndLiteral.Text = "</Div>"; oPanel.Controls.Add(oEndLiteral); oChk = null; } } //Text area else if (oItem.ControlType == Convert.ToInt32(ControlType.TextArea)) { TextBox oTextArea = new TextBox(); oTextArea.TextMode = System.Web.UI.WebControls.TextBoxMode.MultiLine; oTextArea.ID = oItem.Name;// +oItem.ControlType; oTextArea.ToolTip = oItem.Name; oTextArea.Width = Unit.Pixel(Convert.ToInt16(oItem.Width)); oTextArea.Height = Unit.Pixel(Convert.ToInt16(oItem.Height)); if (oItem.SkinID != null) { if (oItem.SkinID != string.Empty) { oTextArea.SkinID = oItem.SkinID; } else { oTextArea.SkinID = TextAreaSkinID; } } else { oTextArea.SkinID = TextAreaSkinID; } if (oItem.IsVisible == true) { if (oItem.IsEnabled == false) { oTextArea.Enabled = false; } if (oItem.IsReadOnly == true) { oTextArea.ReadOnly = true; } bool IsTop = int.TryParse(oItem.ControlTop.ToString(), out num); if (IsTop == true) { cssStyle = ccsRelative + ccsTop + num.ToString() + ccsPX; // oDDL.Attributes.Add(AppConstManager.cStyle, AppConstManager.ccsRelative); // oDDL.Attributes.Add(AppConstManager.cStyle, num.ToString() + AppConstManager.ccsPX); } bool IsLeft = int.TryParse(oItem.ControlLeft.ToString(), out num); if (IsLeft == true) { cssStyle = cssStyle + ccsLeft + num.ToString() + ccsPX; //oDDL.Attributes.Add(AppConstManager.cStyle, AppConstManager.ccsLeft + num.ToString() + AppConstManager.ccsPX); } //oTextArea.Attributes.Add(AppConstManager.cStyle, cssStyle); //set label SetControlLabel(oPanel, oItem, eFormID); LiteralControl oLiteral = new LiteralControl(); oLiteral.Text = "<Div id=\"DIV" + oTextArea.ID + "\" Style='" + cssStyle + "'>"; // oLabel.Attributes.Add(AppConstManager.cStyle, cssStyle); oPanel.Controls.Add(oLiteral); oPanel.Controls.Add(oTextArea); LiteralControl oEndLiteral = new LiteralControl(); oEndLiteral.Text = "</Div>"; oPanel.Controls.Add(oEndLiteral); //oPanel.Controls.Add(oTextArea); } } //Hyperlink else if (oItem.ControlType == Convert.ToInt32(ControlType.HyperLink)) { HyperLink oHyperlink = new HyperLink(); oHyperlink.ID = oItem.Name;// +oItem.ControlType; oHyperlink.ToolTip = oItem.Message; oHyperlink.Text = oItem.Message; if (oItem.NewWindow == true) { // "popOpenWindow('FileUpload.aspx', 'FileUpload', // 'ImageClientID=ImageLoad<%= this.ClientID %>&ImageHiddenPath=<%=this.HidImagePath.ClientID %>', 450, 120, 'No', false)" oHyperlink.NavigateUrl = @"Javascript: popOpenWindow('" + oItem.URL + "', 'URLNewWindow', '', 900, 600, 'Yes', true)"; } else { oHyperlink.NavigateUrl = oItem.URL; } if (oItem.NewWindow == true) { } if (oItem.IsMandatory == true) { oHyperlink.Target = "_blank"; } if (oItem.SkinID != null) { if (oItem.SkinID != string.Empty) { oHyperlink.SkinID = oItem.SkinID; } else { oHyperlink.SkinID = HyperlinkSkinID; } } else { oHyperlink.SkinID = HyperlinkSkinID; } if (oItem.IsVisible == true) { if (oItem.IsEnabled == false) { oHyperlink.Enabled = false; } bool IsTop = int.TryParse(oItem.ControlTop.ToString(), out num); if (IsTop == true) { cssStyle = ccsRelative + ccsTop + num.ToString() + ccsPX; // oDDL.Attributes.Add(AppConstManager.cStyle, AppConstManager.ccsRelative); // oDDL.Attributes.Add(AppConstManager.cStyle, num.ToString() + AppConstManager.ccsPX); } bool IsLeft = int.TryParse(oItem.ControlLeft.ToString(), out num); if (IsLeft == true) { cssStyle = cssStyle + ccsLeft + num.ToString() + ccsPX; //oDDL.Attributes.Add(AppConstManager.cStyle, AppConstManager.ccsLeft + num.ToString() + AppConstManager.ccsPX); } //oTextArea.Attributes.Add(AppConstManager.cStyle, cssStyle); LiteralControl oLiteral = new LiteralControl(); //set label if (oItem.WithLabel == true) { SetControlLabel(oPanel, oItem, eFormID); // oLiteral.Text = "<Div id=\"DIV" + oHyperlink.ID + "\" Style='" + cssStyle + "'>"; } oLiteral.Text = "<Div id=\"DIV" + oHyperlink.ID + "\" Style='" + cssStyle + "'>"; // oLabel.Attributes.Add(AppConstManager.cStyle, cssStyle); oPanel.Controls.Add(oLiteral); oPanel.Controls.Add(oHyperlink); LiteralControl oEndLiteral = new LiteralControl(); oEndLiteral.Text = "</Div>"; oPanel.Controls.Add(oEndLiteral); //oPanel.Controls.Add(oTextArea); } } //Image else if (oItem.ControlType == Convert.ToInt32(ControlType.Image)) { //UserControl oImageControl = (UserControl)oPage.LoadControl("~/" + AppConstManager.ctrFormDesignImageControl); ////Set this into a hash table and session // DesignFormField oImageDesign = (DesignFormField)oItem; if (HttpContext.Current.Session[SessionImageList] != null) { oImageList = (Hashtable)HttpContext.Current.Session[SessionImageList]; } if (!oImageList.ContainsKey(oItem.Name)) { oImageList.Add(oItem.Name, oItem); HttpContext.Current.Session[SessionImageList] = oImageList; } //DesignFormField oTextBoxField = (DesignFormField)oItem; //if (HttpContext.Current.Session[SessionTextBoxList] != null) //{ // oTextBoxList = (Hashtable)HttpContext.Current.Session[SessionTextBoxList]; //} //if (!oTextBoxList.ContainsKey(oItem.Name)) //{ // oTextBoxList.Add(oItem.Name, oTextBoxField); // HttpContext.Current.Session[SessionTextBoxList] = oTextBoxList; //} } //datetime else if (oItem.ControlType == Convert.ToInt32(ControlType.DateTime)) { TextBox oDateTime = new TextBox(); oDateTime.Width = Unit.Pixel(Convert.ToInt16(oItem.Width)); oDateTime.Height = Unit.Pixel(Convert.ToInt16(oItem.Height)); DesignFormField oTextBoxdesign = (DesignFormField)oItem; if (HttpContext.Current.Session[SessionTextBoxList] != null) { oTextBoxList = (Hashtable)HttpContext.Current.Session[SessionTextBoxList]; } if (!oTextBoxList.ContainsKey(oItem.Name)) { oTextBoxList.Add(oItem.Name, oTextBoxdesign); HttpContext.Current.Session[SessionTextBoxList] = oTextBoxList; } oDateTime.ID = oItem.Name;// +oItem.ControlType; oDateTime.ToolTip = oItem.Name; if (oItem.SkinID != null) { if (oItem.SkinID != string.Empty) { oDateTime.SkinID = oItem.SkinID; } else { oDateTime.SkinID = TextBoxSkinID; } } else { oDateTime.SkinID = TextBoxSkinID; } if (oItem.IsVisible == true) { if (oItem.IsEnabled == false) { oDateTime.Enabled = false; } //if (oItem.IsReadOnly == true) //{ // oDateTime.ReadOnly = true; //} bool IsTop = int.TryParse(oItem.ControlTop.ToString(), out num); if (IsTop == true) { cssStyle = ccsRelative + ccsTop + num.ToString() + ccsPX; // oDDL.Attributes.Add(AppConstManager.cStyle, AppConstManager.ccsRelative); // oDDL.Attributes.Add(AppConstManager.cStyle, num.ToString() + AppConstManager.ccsPX); } bool IsLeft = int.TryParse(oItem.ControlLeft.ToString(), out num); if (IsLeft == true) { cssStyle = cssStyle + ccsLeft + num.ToString() + ccsPX; //oDDL.Attributes.Add(AppConstManager.cStyle, AppConstManager.ccsLeft + num.ToString() + AppConstManager.ccsPX); } // oTextBox.Attributes.Add(AppConstManager.cStyle, cssStyle); oDateTime.MaxLength = 40; //set label SetControlLabel(oPanel, oItem, eFormID); LiteralControl oLiteral = new LiteralControl(); oLiteral.Text = "<Div id=\"DIV" + oDateTime.ID + "\" Style='" + cssStyle + "'>"; // oLabel.Attributes.Add(AppConstManager.cStyle, cssStyle); oPanel.Controls.Add(oLiteral); oPanel.Controls.Add(oDateTime); //Add calendar if (oItem.IsCalendar == true) { DateFormat oDF = DateFormat.Load<DateFormat>(oItem.DateFormat); FormDesign.AddCalendar(oDateTime.ID, oPanel, oDF.Format); } LiteralControl oEndLiteral = new LiteralControl(); oEndLiteral.Text = "</Div>"; oPanel.Controls.Add(oEndLiteral); } } //Money box //text box else if (oItem.ControlType == Convert.ToInt32(ControlType.TextBox) || oItem.ControlType == Convert.ToInt32(ControlType.Money)) { TextBox oTextBox = new TextBox(); oTextBox.ID = "txtEform" + oItem.Name;// +oItem.ControlType; oTextBox.ToolTip = oItem.Name; oTextBox.Width = Unit.Pixel(Convert.ToInt16(oItem.Width)); oTextBox.Height = Unit.Pixel(Convert.ToInt16(oItem.Height)); if (oItem.SkinID != null) { if (oItem.SkinID != string.Empty) { oTextBox.SkinID = oItem.SkinID; } else { oTextBox.SkinID = TextBoxSkinID; } } else { oTextBox.SkinID = TextBoxSkinID; } if (oItem.IsVisible == true) { if (oItem.IsEnabled == false) { oTextBox.Enabled = false; } if (oItem.ControlType == Convert.ToInt32(ControlType.TextBox)) { if (oItem.IsReadOnly == true) { oTextBox.ReadOnly = true; DesignFormField oDesign = (DesignFormField)oItem; if (HttpContext.Current.Session[SessionTextBoxList] != null) { oTextBoxList = (Hashtable)HttpContext.Current.Session[SessionTextBoxList]; } if (!oTextBoxList.ContainsKey(oItem.Name)) { oTextBoxList.Add(oItem.Name, oDesign); HttpContext.Current.Session[SessionTextBoxList] = oTextBoxList; } } } if (oItem.ControlType == Convert.ToInt32(ControlType.Money)) { DesignFormField oDesign = (DesignFormField)oItem; if (HttpContext.Current.Session[SessionTextBoxList] != null) { oTextBoxList = (Hashtable)HttpContext.Current.Session[SessionTextBoxList]; } if (!oTextBoxList.ContainsKey(oItem.Name)) { oTextBoxList.Add(oItem.Name, oDesign); HttpContext.Current.Session[SessionTextBoxList] = oTextBoxList; } } bool IsTop = int.TryParse(oItem.ControlTop.ToString(), out num); if (IsTop == true) { cssStyle = ccsRelative + ccsTop + num.ToString() + ccsPX; // oDDL.Attributes.Add(AppConstManager.cStyle, AppConstManager.ccsRelative); // oDDL.Attributes.Add(AppConstManager.cStyle, num.ToString() + AppConstManager.ccsPX); } bool IsLeft = int.TryParse(oItem.ControlLeft.ToString(), out num); if (IsLeft == true) { cssStyle = cssStyle + ccsLeft + num.ToString() + ccsPX; //oDDL.Attributes.Add(AppConstManager.cStyle, AppConstManager.ccsLeft + num.ToString() + AppConstManager.ccsPX); } // oTextBox.Attributes.Add(AppConstManager.cStyle, cssStyle); string MaxLength = Option.GetOptionByKey(MaxLenghtOptionKey); if (MaxLength == string.Empty) { MaxLength = "100"; } oTextBox.MaxLength = Convert.ToInt32(MaxLength); //set label SetControlLabel(oPanel, oItem, eFormID); LiteralControl oLiteral = new LiteralControl(); oLiteral.Text = "<Div id=\"DIV" + oTextBox.ID + "\" Style='" + cssStyle + "'>"; // oLabel.Attributes.Add(AppConstManager.cStyle, cssStyle); oPanel.Controls.Add(oLiteral); oPanel.Controls.Add(oTextBox); LiteralControl oEndLiteral = new LiteralControl(); oEndLiteral.Text = "</Div>"; oPanel.Controls.Add(oEndLiteral); //oPanel.Controls.Add(oTextBox); } } } HttpContext.Current.Session[SessionFormDesignControlList] = BuildInControlList; }
protected void btnStartVerify_Click(object sender, EventArgs e) { FlowExpress oFlow = new FlowExpress(); labFlowVerifyMsg.Text = ""; string strShowPopBtnJS = ""; //取得流程意見,若為空白則補上預設值 if (string.IsNullOrEmpty(txtFlowOpinion.ucTextData)) { txtFlowOpinion.ucTextData = oFlow.FlowDefOpinion; } //取得指派對象,需將 value 中包含的項目Key移除 AjaxControlToolkit.TabPanel TabVerify = TabVerifyContainer.ActiveTab; string strBtnSeqNo = TabVerify.ID.Right(2); Dictionary <string, string> oAssDic = new Dictionary <string, string>(); //單選指派 Util_ucCommSingleSelect oneVerify = (Util_ucCommSingleSelect)Util.FindControlEx(TabVerify, "oneVerify" + strBtnSeqNo); if (oneVerify.Visible) { oAssDic.AddRange(Util.getDictionary(oneVerify.ucSelectedDictionary, false)); } //複選指派 //可能是 ucCommMultiSelect 或是 ucCheckBoxList 2016.09.20 Util_ucCommMultiSelect muiVerify = (Util_ucCommMultiSelect)Util.FindControlEx(TabVerify, "muiVerify" + strBtnSeqNo); if (muiVerify.Visible) { oAssDic.AddRange(Util.getDictionary(muiVerify.ucSelectedDictionary, false)); } Util_ucCheckBoxList chkVerify = (Util_ucCheckBoxList)Util.FindControlEx(TabVerify, "chkVerify" + strBtnSeqNo); if (chkVerify.Visible) { oAssDic.AddRange(Util.getDictionary(chkVerify.ucSelectedDictionary, false)); } //2014.10.20 新增 //任意指派 Util_ucUserPicker anyVerify = (Util_ucUserPicker)Util.FindControlEx(TabVerify, "anyVerify" + strBtnSeqNo); if (anyVerify.Visible && !string.IsNullOrEmpty(anyVerify.ucSelectedUserIDList)) { for (int i = 0; i < anyVerify.ucSelectedUserIDList.Split(',').Count(); i++) { oAssDic.Add(anyVerify.ucSelectedUserIDList.Split(',')[i], UserInfo.findUserName(anyVerify.ucSelectedUserIDList.Split(',')[i])); } } //2014.11.05 新增 //全部指派 ListBox allVerify = (ListBox)Util.FindControlEx(TabVerify, "allVerify" + strBtnSeqNo); if (allVerify.Visible) { oAssDic.AddRange(Util.getDictionary(Util.getDictionary(allVerify.GetAllItems()), false)); } //只顯示 [tabFlowVerify] 頁籤 2017.02.07 tabCustForm.Visible = false; tabFlowAttach.Visible = false; tabFlowFullLog.Visible = false; DivVerifyBtnArea.Visible = false; DivVerifyMsgArea.Visible = true; strShowPopBtnJS += "var oClose = parent.document.getElementById('ucFlowTodoList1_ucModalPopup1_btnClose');"; strShowPopBtnJS += "if (oClose != null){oClose.style.display='';}"; strShowPopBtnJS += "var oComplete = parent.document.getElementById('ucFlowTodoList1_ucModalPopup1_btnComplete');"; strShowPopBtnJS += "if (oComplete != null){oComplete.style.display='';}"; Util.setJSContent(strShowPopBtnJS); if (oAssDic.Count > 0) { //指派對象有值,可進行審核 labFlowVerifyMsg.Text = ""; Dictionary <string, string> dicBtnContext = Util.getDictionary(TabVerify.DynamicContextKey); //取出btn參數 string strFlowStepBtnID = dicBtnContext["FlowStepBtnID"].ToString().Trim(); string strFlowStepBtnIsAddMultiSubFlow = dicBtnContext["FlowStepBtnIsAddMultiSubFlow"].ToString().Trim().ToUpper(); string strFlowStepBtnAddSubFlowID = dicBtnContext["FlowStepBtnAddSubFlowID"].ToString().Trim(); string strFlowStepBtnAddSubFlowStepBtnID = dicBtnContext["FlowStepBtnAddSubFlowStepBtnID"].ToString().Trim(); string strFlowStepOpinion = txtFlowOpinion.ucTextData; bool IsNeedAddSubFlow = false; bool IsAddSubFlowSucceed = false; //檢查是否有按鈕停止條件 2017.05.25 新增 string[] oStopReasonList; string strStopResonMsg; if (FlowExpress.IsFlowStepButtonStop(oFlow, strFlowStepBtnID, out oStopReasonList)) { strStopResonMsg = string.Format(WorkRS.Resources.FlowVerifyMsg_StopVerify1, oFlow.FlowCaseHtmlInfo); if (!oStopReasonList.IsNullOrEmpty()) { string strStopReasonTip = string.Format(" {0} \n", WorkRS.Resources.FlowVerifyMsg_StopReasonTipTitle); for (int i = 0; i < oStopReasonList.Length; i++) { strStopReasonTip += string.Format(" ● {0}\n", oStopReasonList[i]); } strStopResonMsg = string.Format("<span title=\"{0}\">{1}</span>", strStopReasonTip, strStopResonMsg); } labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, strStopResonMsg); return; } //檢查是否有自訂審核URL if (!string.IsNullOrEmpty(oFlow.FlowCurrStepCustVerifyURL)) { if (System.IO.File.Exists(Server.MapPath(oFlow.FlowCurrStepCustVerifyURL))) { //==若有自訂審核URL== //設定Session傳遞參數[FlowVerifyInfo] dicBtnContext.Add("FlowStepAssignToList", Util.getJSON(oAssDic)); dicBtnContext.Add("FlowStepOpinion", strFlowStepOpinion); dicBtnContext.Add("FlowVerifyJS", strShowPopBtnJS); Session["FlowVerifyInfo"] = dicBtnContext; //因為 Ajax Page 無法使用Server.Transfer,故 CustVerifyURL 改用 Response.Redirect()執行 //設定 CustVerifyURL string strVerifyURL = string.Format("{0}?FlowID={1}&FlowLogID={2}", oFlow.FlowCurrStepCustVerifyURL, oFlow.FlowID, oFlow.FlowLogID); for (int i = 0; i < oFlow.FlowKeyFieldList.Count(); i++) { if (oFlow.FlowKeyFieldList[i].ToUpper() != "_AUTONO") { strVerifyURL += string.Format("&{0}={1}", oFlow.FlowKeyFieldList[i], oFlow.FlowKeyValueList[i]); } } Response.Redirect(strVerifyURL); } else { labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, string.Format(RS.Resources.Msg_NotExist1, oFlow.FlowCurrStepCustVerifyURL)); } return; } //==無自訂審核URL== //處理[新增子流程] if (!string.IsNullOrEmpty(strFlowStepBtnAddSubFlowID) && !string.IsNullOrEmpty(strFlowStepBtnAddSubFlowStepBtnID)) { //檢查是否自動新增子流程 FlowExpress oSubFlow = new FlowExpress(strFlowStepBtnAddSubFlowID, null, false, false); //該子流程需符合以下條件才能自動新增: //01.子流程與父流程名稱不同 // 子流程的 KeyFieldList 需只比主流程多出 _AutoNo 欄位 // 子流程的 KeyFieldsList 需與主流程的 KeyShowFieldList 相同 //02.子流程與父流程名稱相同(遞迴) // KeyFieldList 最後一欄需為 _AutoNo 欄位 if (oFlow.FlowID != strFlowStepBtnAddSubFlowID) { //01.子流程與父流程名稱不同 string[] diffList = Util.getCompareList(oFlow.FlowKeyFieldList, oSubFlow.FlowKeyFieldList, Util.ListCompareMode.Diff); if (diffList.Count() == 1 && diffList[0].ToUpper() == "_AUTONO") { if (Util.getCompareList(oFlow.FlowShowFieldList, oSubFlow.FlowShowFieldList, Util.ListCompareMode.Diff).Count() == 0) { IsNeedAddSubFlow = true; if (strFlowStepBtnIsAddMultiSubFlow == "Y") { Dictionary <string, string> oTmpAss = new Dictionary <string, string>(); //每個指派對象都產生獨立子流程(只要其中一個子流程新增失敗,就自動中斷) IsAddSubFlowSucceed = true; foreach (var pair in oAssDic) { oTmpAss.Clear(); oTmpAss.Add(pair.Key, pair.Value); if (IsAddSubFlowSucceed) { if (FlowExpress.IsFlowInsVerify(oSubFlow.FlowID, oFlow.FlowKeyValueList, oFlow.FlowShowValueList, strFlowStepBtnAddSubFlowStepBtnID, oTmpAss, strFlowStepOpinion, oFlow.FlowID, oFlow.FlowLogID)) { IsAddSubFlowSucceed = true; labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, WorkRS.Resources.FlowVerifyMsg_FlowVerifyAddSubFlowSucceed); } else { IsAddSubFlowSucceed = false; labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, WorkRS.Resources.FlowVerifyMsg_FlowVerifyAddSubFlowError); } } } } else { //所有指派對象只產生一個子流程 if (FlowExpress.IsFlowInsVerify(oSubFlow.FlowID, oFlow.FlowKeyValueList, oFlow.FlowShowValueList, strFlowStepBtnAddSubFlowStepBtnID, oAssDic, strFlowStepOpinion, oFlow.FlowID, oFlow.FlowLogID)) { IsAddSubFlowSucceed = true; labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, WorkRS.Resources.FlowVerifyMsg_FlowVerifyAddSubFlowSucceed); } else { IsAddSubFlowSucceed = false; labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, WorkRS.Resources.FlowVerifyMsg_FlowVerifyAddSubFlowError); } } } } } else { //02.子流程與父流程名稱相同(遞迴) if (oFlow.FlowKeyFieldList[oFlow.FlowKeyFieldList.Count() - 1].ToUpper() == "_AUTONO") { IsNeedAddSubFlow = true; //組合子流程的 KeyValueList string[] subKeyValueList = new string[oFlow.FlowKeyFieldList.Count() - 1]; for (int i = 0; i < subKeyValueList.Count(); i++) { subKeyValueList[i] = oFlow.FlowKeyValueList[i]; } if (strFlowStepBtnIsAddMultiSubFlow == "Y") { Dictionary <string, string> oTmpAss = new Dictionary <string, string>(); //每個指派對象都產生獨立子流程(只要其中一個子流程新增失敗,就自動中斷) IsAddSubFlowSucceed = true; foreach (var pair in oAssDic) { oTmpAss.Clear(); oTmpAss.Add(pair.Key, pair.Value); if (IsAddSubFlowSucceed) { if (FlowExpress.IsFlowInsVerify(oSubFlow.FlowID, subKeyValueList, oFlow.FlowShowValueList, strFlowStepBtnAddSubFlowStepBtnID, oTmpAss, strFlowStepOpinion, oFlow.FlowID, oFlow.FlowLogID)) { IsAddSubFlowSucceed = true; labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, WorkRS.Resources.FlowVerifyMsg_FlowVerifyAddSubFlowSucceed); } else { IsAddSubFlowSucceed = false; labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, WorkRS.Resources.FlowVerifyMsg_FlowVerifyAddSubFlowError); } } } } else { //所有指派對象只產生一個子流程 if (FlowExpress.IsFlowInsVerify(oSubFlow.FlowID, subKeyValueList, oFlow.FlowShowValueList, strFlowStepBtnAddSubFlowStepBtnID, oAssDic, strFlowStepOpinion, oFlow.FlowID, oFlow.FlowLogID)) { IsAddSubFlowSucceed = true; labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, WorkRS.Resources.FlowVerifyMsg_FlowVerifyAddSubFlowSucceed); } else { IsAddSubFlowSucceed = false; labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, WorkRS.Resources.FlowVerifyMsg_FlowVerifyAddSubFlowError); } } } } } //處理[主流程審核] if (IsNeedAddSubFlow) { //需先[新增子流程] if (IsAddSubFlowSucceed) { //若[新增子流程]成功 //當[FlowStepBtnAssignToList]有值,才執行主流程的[一般審核] 2015.08.26 優化 oAssDic.Clear(); oAssDic = Util.getDictionary(dicBtnContext["FlowStepBtnAssignToList"].ToString()); if (oAssDic != null && oAssDic.Count > 0) { if (FlowExpress.IsFlowVerify(oFlow.FlowID, oFlow.FlowLogID, strFlowStepBtnID, oAssDic, strFlowStepOpinion)) { labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, string.Format(WorkRS.Resources.FlowVerifyMsg_FlowVerifySucceed1, oFlow.FlowCaseHtmlInfo)); //2017.05.11 改顯示 FlowCaseHtmlInfo } else { labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, string.Format(WorkRS.Resources.FlowVerifyMsg_FlowVerifyError1, oFlow.FlowCaseHtmlInfo)); //2017.05.11 改顯示 FlowCaseHtmlInfo //2014.11.27 顯示審核錯誤原因 DataTable dtError = FlowExpressTraceLog.getFlowExpressErrorLogData(oFlow.FlowID, oFlow.FlowCaseID, oFlow.FlowLogID); if (dtError != null && dtError.Rows.Count > 0) { labFlowVerifyMsg.Text += "<ul>"; for (int i = 0; i < dtError.Rows.Count; i++) { labFlowVerifyMsg.Text += string.Format("<li style='color:gray;'>{0}</li>", dtError.Rows[i]["LogDesc"].ToString().Trim()); } labFlowVerifyMsg.Text += "</ul>"; } } } } } else { //一般審核 if (FlowExpress.IsFlowVerify(oFlow.FlowID, oFlow.FlowLogID, strFlowStepBtnID, oAssDic, strFlowStepOpinion)) { labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, string.Format(WorkRS.Resources.FlowVerifyMsg_FlowVerifySucceed1, oFlow.FlowCaseHtmlInfo)); //2017.05.11 改顯示 FlowCaseHtmlInfo } else { labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, string.Format(WorkRS.Resources.FlowVerifyMsg_FlowVerifyError1, oFlow.FlowCaseHtmlInfo)); //2017.05.11 改顯示 FlowCaseHtmlInfo //2014.11.27 顯示審核錯誤原因 DataTable dtError = FlowExpressTraceLog.getFlowExpressErrorLogData(oFlow.FlowID, oFlow.FlowCaseID, oFlow.FlowLogID); if (dtError != null && dtError.Rows.Count > 0) { labFlowVerifyMsg.Text += "<ul>"; for (int i = 0; i < dtError.Rows.Count; i++) { labFlowVerifyMsg.Text += string.Format("<li style='color:gray;'>{0}</li>", dtError.Rows[i]["LogDesc"].ToString().Trim()); } labFlowVerifyMsg.Text += "</ul>"; } } } } else { labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, WorkRS.Resources.FlowVerifyMsg_AssignToNotFound); } }
public void SetDataToDB(TabPanel oPanel, DataTable oDT, String DBTable) { foreach (System.Web.UI.Control oControl in oPanel.Controls) { String ControlName = oControl.ID; if (ControlName != null) { ControlName = ControlName.Replace("txtEform", string.Empty); } if (oControl is TextBox) { TextBox oTextBox = (TextBox)oControl; //if (oSMMember.Tables[0].Rows[0][ControlName].ToString() != null) { if (oTextBox.Text != string.Empty) { String sText = oTextBox.Text; try { oDT.Rows[0][ControlName] = HttpUtility.HtmlEncode(sText); } catch (Exception ex) { oDT.Rows[0]["[" + ControlName + "]"] = HttpUtility.HtmlEncode(sText); } } } } else if (oControl is CheckBox) { CheckBox oCk = (CheckBox)oControl; try { oDT.Rows[0][ControlName] = oCk.Checked; } catch (Exception ex) { oDT.Rows[0]["[" + ControlName + "]"] = oCk.Checked; ; } } else if (oControl is DropDownList) { DropDownList oDDL = (DropDownList)oControl; try { oDT.Rows[0][ControlName] = oDDL.SelectedValue; } catch (Exception ex) { oDT.Rows[0]["[" + ControlName + "]"] = oDDL.SelectedValue; } } else if (oControl is UserControl) { Hashtable oImageValue = (Hashtable)HttpContext.Current.Session[ImageList]; if (HttpContext.Current.Session[ImageList] != null) { if (oImageValue.ContainsKey(oControl.ClientID)) { oDT.Rows[0][ControlName] = oImageValue[oControl.ClientID].ToString(); } } } } }
protected void Page_Load(object sender, EventArgs e) { FlowExpress oFlow = new FlowExpress(); //設定 TabContainer 樣式 labCustForm.Text = WorkRS.Resources.FlowVerifyTab_CustForm; labFlowVerify.Text = WorkRS.Resources.FlowVerifyTab_FlowVerify; labFlowAttach.Text = WorkRS.Resources.FlowVerifyTab_FlowAttach; labFlowFullLog.Text = WorkRS.Resources.FlowVerifyTab_FlowFullLog; btnSaveTempOpinion.Text = WorkRS.Resources.FlowVerifyTab_SaveFlowTempOpinion; labFlowVerifyButton.Text = string.Format(" [{0}-{1}] ", oFlow.FlowCurrStepID, oFlow.FlowCurrStepName); //設定「開始審核」按鈕相關機制 ucLightBox.ucLightBoxMsg = WorkRS.Resources.FlowVerifyMsg_FlowVerifyProcessing; string strJS = "var isStartVerify = true;"; //檢查是否必需輸入意見 2014.11.20 調整判斷方式 //若需輸入意見,但為空白,則出現警告訊息 //若不一定需輸入意見,但為空白,則自動填上預設意見 strJS += "var oOpiConfirm = document.getElementById('" + opiStartVerify.ClientID + "');"; strJS += "var oOpinion = document.getElementById('TabMainContainer_tabFlowVerify_txtFlowOpinion_txtData');"; //ucTextBox的內部物件 strJS += "if (oOpiConfirm.value == 'Y') {"; strJS += " if (oOpinion.value.trim().length == 0) {alert('" + WorkRS.Resources.FlowVerifyMsg_OpinionRequired + "'); isStartVerify = false; return false;}"; strJS += "} else {"; strJS += " if (oOpinion.value.trim().length == 0) { oOpinion.value='" + oFlow.FlowDefOpinion + "';}"; strJS += "} "; //是否需出現確認訊息 strJS += "var oMsgConfirm = document.getElementById('" + msgStartVerify.ClientID + "');"; strJS += "if (oMsgConfirm.value.length > 0) {"; strJS += " if (!confirm(oMsgConfirm.value)) {isStartVerify = false; return false;}"; strJS += "}"; strJS += "if (isStartVerify) {"; strJS += " this.style.display = 'none';"; strJS += ucLightBox.ucShowClientJS; strJS += " var oClose = parent.document.getElementById('ucFlowTodoList1_ucModalPopup1_btnClose');"; strJS += " if (oClose != null){oClose.style.display='none';}"; strJS += " var oComplete = parent.document.getElementById('ucFlowTodoList1_ucModalPopup1_btnComplete');"; strJS += " if (oComplete != null){oComplete.style.display='none';}"; strJS += "}"; btnStartVerify.OnClientClick = strJS; btnStartVerify.Text = WorkRS.Resources.FlowVerifyTab_btnStartVerify; if (Util.getRequestQueryStringKey("ProxyType", "", true) == "SEMI") { //助理無審核權 btnStartVerify.Visible = false; labNotVerify.Text = WorkRS.Resources.FlowVerifyMsg_AssistantNotAllowVerify; labNotVerify.Visible = true; } if (!IsPostBack) { if (oFlow.FlowCurrLogIsClose) { // FlowCurrLogIsClose = true DivVerifyBtnArea.Visible = false; DivVerifyMsgArea.Visible = true; labFlowVerifyMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Error, WorkRS.Resources.FlowLogClosed); } else { //強制切到[tabCustForm] TabMainContainer.ActiveTabIndex = 0; //設定 TabMainContainer 顯示範圍(依據BtnComplete是否顯示自動計算) int intTabAreaHeight = oFlow.FlowVerifyPopupHeight - 140; if (Util.getRequestQueryStringKey("IsShowBtnComplete", "Y", true) == "Y") { intTabAreaHeight = oFlow.FlowVerifyPopupHeight - 140; } else { intTabAreaHeight = oFlow.FlowVerifyPopupHeight - 110; } int intTabAreaWidth = oFlow.FlowVerifyPopupWidth - 40; if (oFlow.FlowVerifyPopupWidth > 0) { TabMainContainer.Width = Unit.Pixel(intTabAreaWidth); divVerifyArea.Style["width"] = string.Format("{0}px", intTabAreaWidth.ToString()); } if (oFlow.FlowVerifyPopupHeight > 0) { TabMainContainer.Height = Unit.Pixel(intTabAreaHeight); } //載入 CustFormUrl 並設定顯示範圍 string strFlowVerifyCustFormURL = string.Format("{0}?FlowID={1}&FlowLogID={2}", Util.getFixURL(oFlow.FlowVerifyCustFormURL), oFlow.FlowID, oFlow.FlowLogID); for (int i = 0; i < oFlow.FlowKeyFieldList.Count(); i++) { if (oFlow.FlowKeyFieldList[i].ToUpper() != "_AUTONO") { strFlowVerifyCustFormURL += string.Format("&{0}={1}", oFlow.FlowKeyFieldList[i], oFlow.FlowKeyValueList[i]); } } CustFormFrame.Attributes["src"] = strFlowVerifyCustFormURL; CustFormFrame.Attributes["width"] = (intTabAreaWidth - 10).ToString(); CustFormFrame.Attributes["height"] = (intTabAreaHeight - 5).ToString(); //流程附檔 tabFlowAttach.Visible = false; if (oFlow.FlowCurrStepAttachMaxQty > 0) { tabFlowAttach.Visible = true; string strFlowAttachID = string.Format(FlowExpress._FlowAttachIDFormat, oFlow.FlowID, oFlow.FlowLogID); string strFlowAttachURL = Util._AttachAdminUrl; strFlowAttachURL += string.Format("?AttachDB={0}&AttachID={1}&AttachFileMaxQty={2}&AttachFileMaxKB={3}&AttachFileTotKB={4}&AttachFileExtList={5}", oFlow.FlowAttachDB, strFlowAttachID, oFlow.FlowCurrStepAttachMaxQty, oFlow.FlowCurrStepAttachMaxKB, oFlow.FlowCurrStepAttachTotKB, Util.getStringJoin(oFlow.FlowCurrStepAttachExtList)); FlowAttachFrame.Attributes["src"] = strFlowAttachURL; FlowAttachFrame.Attributes["width"] = (intTabAreaWidth - 20).ToString(); FlowAttachFrame.Attributes["height"] = (intTabAreaHeight - 10).ToString(); } //流程記錄 //新增 FlowLogID 2016.10.14 string strFlowLogDisplayURL = string.Format("{0}?FlowID={1}&FlowCaseID={2}&FlowLogID={3}", FlowExpress._FlowLogDisplayURL, oFlow.FlowID, oFlow.FlowCaseID, oFlow.FlowLogID); FlowLogFrame.Attributes["src"] = strFlowLogDisplayURL; FlowLogFrame.Attributes["width"] = (intTabAreaWidth - 20).ToString(); FlowLogFrame.Attributes["height"] = (intTabAreaHeight - 10).ToString(); Util.setJS_SetFrameHeight(FlowLogFrame.ID); //流程意見 labFlowOpinion.Text = WorkRS.Resources.FlowVerifyTab_FlowOpinion; txtFlowOpinion.ucRows = 3; txtFlowOpinion.ucDispEnteredWordsObjClientID = dispFlowOpinion.ClientID; txtFlowOpinion.ucWidth = intTabAreaWidth - 50; txtFlowOpinion.ucMaxLength = oFlow.FlowOpinionMaxLength; txtFlowOpinion.ucTextData = FlowExpress.getFlowOpenLogVerifyInfo(oFlow).Rows[0]["FlowStepOpinion"].ToString(); txtFlowOpinion.Refresh(); //按鈕清單 DataTable dtBtn = Util.getDataTable(FlowExpress.getFlowOpenLogVerifyInfo(oFlow).Rows[0]["FlowStepBtnInfoJSON"].ToString()); Dictionary <string, string> dicBtnAssignToList = new Dictionary <string, string>(); //用 dtBtn 初始按鈕及指派對象 TabVerifyContainer.ActiveTabIndex = 0; Dictionary <string, string> dicBtnContext = new Dictionary <string, string>(); string strBtnSeqNo = ""; for (int i = 0; i < dtBtn.Rows.Count; i++) { strBtnSeqNo = (i + 1).ToString().PadLeft(2, '0'); AjaxControlToolkit.TabPanel TabVerify = (AjaxControlToolkit.TabPanel)Util.FindControlEx(TabVerifyContainer, "TabVerify" + strBtnSeqNo); if (TabVerify != null) { Label TabVerifyHeader = (Label)Util.FindControlEx(TabVerify, "TabVerifyHeader" + strBtnSeqNo); if (TabVerifyHeader != null) { TabVerifyHeader.Text = dtBtn.Rows[i]["FlowStepBtnCaption"].ToString(); } TabVerify.Visible = true; //設定審核前的確認訊息(由JS作檢查) ((HiddenField)Util.FindControlEx(this, "msgVerify" + strBtnSeqNo, true)).Value = dtBtn.Rows[i]["FlowStepBtnConfirmMsg"].ToString().Trim(); //設定檢核意見是否必需輸入(由JS作檢查) ((HiddenField)Util.FindControlEx(this, "opiVerify" + strBtnSeqNo, true)).Value = (dtBtn.Rows[i]["FlowStepBtnIsNeedOpinion"].ToString().ToUpper() == "Y") ? "Y" : "N"; dicBtnContext.Clear(); dicBtnContext.Add("FlowStepBtnID", dtBtn.Rows[i]["FlowStepBtnID"].ToString()); dicBtnContext.Add("FlowStepBtnIsAddMultiSubFlow", dtBtn.Rows[i]["FlowStepBtnIsAddMultiSubFlow"].ToString()); dicBtnContext.Add("FlowStepBtnAddSubFlowID", dtBtn.Rows[i]["FlowStepBtnAddSubFlowID"].ToString()); dicBtnContext.Add("FlowStepBtnAddSubFlowStepBtnID", dtBtn.Rows[i]["FlowStepBtnAddSubFlowStepBtnID"].ToString()); if (!string.IsNullOrEmpty(dtBtn.Rows[i]["FlowStepBtnAddSubFlowID"].ToString()) && !string.IsNullOrEmpty(dtBtn.Rows[i]["FlowStepBtnAddSubFlowStepBtnAssignToList"].ToString())) { //若會新增子流程 if (oFlow.FlowCurrLogStepID != dtBtn.Rows[i]["FlowStepBtnNextStepID"].ToString()) { //若主流程下一關不為同關卡代號,才傳遞主流程的原始指派清單備用 2015.08.26 優化 dicBtnContext.Add("FlowStepBtnAssignToList", dtBtn.Rows[i]["FlowStepBtnAssignToList"].ToString()); } else { dicBtnContext.Add("FlowStepBtnAssignToList", ""); } } TabVerify.DynamicContextKey = Util.getJSON(dicBtnContext); //儲存必要的傳遞參數,方便執行審核時使用 Label labVerify = (Label)Util.FindControlEx(TabVerify, "labVerify" + strBtnSeqNo); labVerify.CssClass = "Util_txtDone"; if (string.IsNullOrEmpty(dtBtn.Rows[i]["FlowStepBtnAddSubFlowID"].ToString()) && string.IsNullOrEmpty(dtBtn.Rows[i]["FlowStepBtnAddSubFlowStepBtnAssignToList"].ToString())) { //一般指派處理 dicBtnAssignToList = Util.getDictionary(dtBtn.Rows[i]["FlowStepBtnAssignToList"].ToString()); //按鈕提示訊息 if (!string.IsNullOrEmpty(dtBtn.Rows[i]["FlowStepBtnDesc"].ToString())) { labVerify.CssClass = "Util_txtErr"; labVerify.Text = "※ " + dtBtn.Rows[i]["FlowStepBtnDesc"].ToString(); } else { labVerify.Text = string.Format(WorkRS.Resources.FlowVerifyTab_labVerifyToolTip1, dtBtn.Rows[i]["FlowStepBtnNextStepID"].ToString() + "-" + dtBtn.Rows[i]["FlowStepBtnNextStepName"].ToString()); } } else { //會新增子流程的指派處理 dicBtnAssignToList = Util.getDictionary(dtBtn.Rows[i]["FlowStepBtnAddSubFlowStepBtnAssignToList"].ToString()); //按鈕提示訊息 if (!string.IsNullOrEmpty(dtBtn.Rows[i]["FlowStepBtnDesc"].ToString())) { labVerify.CssClass = "Util_txtErr"; labVerify.Text = "※ " + dtBtn.Rows[i]["FlowStepBtnDesc"].ToString(); } else { FlowExpress oSubFlow = new FlowExpress(dtBtn.Rows[i]["FlowStepBtnAddSubFlowID"].ToString(), null, false, false); labVerify.Text = string.Format(WorkRS.Resources.FlowVerifyTab_labVerifyAddSubToolTip1, dtBtn.Rows[i]["FlowStepBtnNextStepID"].ToString() + "-" + dtBtn.Rows[i]["FlowStepBtnNextStepName"].ToString(), oSubFlow.FlowName); } } if (dicBtnAssignToList.Count > 0) { if (dicBtnAssignToList.Count == 1) { //當指派清單只有一筆資料 if (dicBtnAssignToList.First().Key == "*") { //若為任意指派 Util_ucUserPicker anyVerify = (Util_ucUserPicker)Util.FindControlEx(TabVerify, "anyVerify" + strBtnSeqNo); UserInfo oUser = UserInfo.getUserInfo(); if (anyVerify != null) { switch (dicBtnAssignToList.First().Value.ToUpper()) { case "COMP": //同公司對象 if (oUser != null) { anyVerify.ucIsSelectCommUserYN = "N"; anyVerify.ucValidCompIDList = oUser.CompID; } break; case "PART": //同公司(含兼職)對象 if (oUser != null) { anyVerify.ucIsSelectCommUserYN = "N"; string[] oPartList = Util.getArray(oUser.PartInfoTable, "CompID"); if (oPartList != null) { anyVerify.ucValidCompIDList = Util.getStringJoin(Util.getCompareList(oUser.CompID.Split(','), oPartList, Util.ListCompareMode.Merge)); } else { anyVerify.ucValidCompIDList = oUser.CompID; } } break; default: // [* / ANY] 任意指派 2014.10.20 新增 break; } if (dtBtn.Rows[i]["FlowStepBtnIsMultiSelect"].ToString().ToUpper() != "N") { //若不為[N]單選 anyVerify.ucIsMultiSelectYN = "Y"; } if (oUser != null) { //預設為自己部門 2016.06.06 anyVerify.ucDefCompID = oUser.CompID; anyVerify.ucDefDeptID = oUser.DeptID; } anyVerify.ucWidth = 350; anyVerify.Visible = true; anyVerify.Refresh(); } } else { //若為單一對象 ListBox allVerify = (ListBox)Util.FindControlEx(TabVerify, "allVerify" + strBtnSeqNo); if (allVerify != null) { //檢查可顯示鍵值的鍵值最大長度 if (_ChkMaxKeyLen > 0 && dicBtnAssignToList.Where(p => p.Key.Length > _ChkMaxKeyLen).Count() > 0) { allVerify.DataSource = dicBtnAssignToList; } else { allVerify.DataSource = Util.getDictionary(dicBtnAssignToList); } allVerify.DataTextField = "value"; allVerify.DataValueField = "key"; allVerify.CssClass = "Util_clsDropDownListReadOnly"; //2017.02.02 allVerify.DataBind(); allVerify.Width = 400; allVerify.Height = 22; allVerify.Rows = 2; //避免出現捲軸 allVerify.Visible = true; } } } else { //若指派清單有多筆資料 switch (dtBtn.Rows[i]["FlowStepBtnIsMultiSelect"].ToString().ToUpper()) { case "A": //全選 2014.11.05 ListBox allVerify = (ListBox)Util.FindControlEx(TabVerify, "allVerify" + strBtnSeqNo); Label labAllVerify = (Label)Util.FindControlEx(TabVerify, "labAllVerify" + strBtnSeqNo); if (allVerify != null && labAllVerify != null) { //檢查可顯示鍵值的鍵值最大長度 if (_ChkMaxKeyLen > 0 && dicBtnAssignToList.Where(p => p.Key.Length > _ChkMaxKeyLen).Count() > 0) { allVerify.DataSource = dicBtnAssignToList; } else { allVerify.DataSource = Util.getDictionary(dicBtnAssignToList); } allVerify.DataTextField = "value"; allVerify.DataValueField = "key"; allVerify.CssClass = "Util_clsDropDownListReadOnly"; //2017.02.02 allVerify.DataBind(); allVerify.Width = 400; allVerify.Rows = 10; labAllVerify.ForeColor = System.Drawing.Color.DarkRed; labAllVerify.Text = WorkRS.Resources.FlowVerifyTab_labAllAssigned; allVerify.Visible = true; labAllVerify.Visible = true; } break; case "Y": //複選 //2016.09.20 改成支援 ucCommMultiSelect 或是 ucCheckBoxList 實作 if (_IsCheckBoxListEnabled) { //使用 ucCheckBoxList Util_ucCheckBoxList chkVerify = (Util_ucCheckBoxList)Util.FindControlEx(TabVerify, "chkVerify" + strBtnSeqNo); if (chkVerify != null) { if (_ChkMaxKeyLen > 0 && dicBtnAssignToList.Where(p => p.Key.Length > _ChkMaxKeyLen).Count() > 0) { chkVerify.ucSourceDictionary = dicBtnAssignToList; } else { chkVerify.ucSourceDictionary = Util.getDictionary(dicBtnAssignToList); } chkVerify.ucWidth = 400; chkVerify.ucRows = 10; chkVerify.ucChkBoxListWidth = 410; chkVerify.ucChkBoxListOffsetX = -8; chkVerify.ucChkBoxListHeight = 170; chkVerify.ucChkBoxListOffsetY = (Util.getIEVersion() > 0) ? -145 : -15; chkVerify.ucRangeMaxQty = dicBtnAssignToList.Count; chkVerify.ucIsAutoPopWhenNoSelection = true; //若無選擇結果,就自動彈出候選清單 2016.09.01 chkVerify.Refresh(); chkVerify.Visible = true; } } else { //使用 ucCommMultiSelect Util_ucCommMultiSelect muiVerify = (Util_ucCommMultiSelect)Util.FindControlEx(TabVerify, "muiVerify" + strBtnSeqNo); if (muiVerify != null) { if (_ChkMaxKeyLen > 0 && dicBtnAssignToList.Where(p => p.Key.Length > _ChkMaxKeyLen).Count() > 0) { muiVerify.ucSourceDictionary = dicBtnAssignToList; } else { muiVerify.ucSourceDictionary = Util.getDictionary(dicBtnAssignToList); } muiVerify.ucMultiSelectOffsetY = -15; muiVerify.ucBoxListHeight = 100; muiVerify.ucBoxListWidth = 200; muiVerify.Refresh(); muiVerify.Visible = true; } } break; case "N": //單選 Util_ucCommSingleSelect oneVerify = (Util_ucCommSingleSelect)Util.FindControlEx(TabVerify, "oneVerify" + strBtnSeqNo); if (oneVerify != null) { if (_ChkMaxKeyLen > 0 && dicBtnAssignToList.Where(p => p.Key.Length > _ChkMaxKeyLen).Count() > 0) { oneVerify.ucSourceDictionary = dicBtnAssignToList; } else { oneVerify.ucSourceDictionary = Util.getDictionary(dicBtnAssignToList); } oneVerify.Refresh(); oneVerify.ucDropDownSourceListWidth = 250; oneVerify.Visible = true; } break; default: break; } } } } } //設定「開始審核」初始狀態 opiStartVerify.Value = opiVerify01.Value; msgStartVerify.Value = msgVerify01.Value; } } //!IsPostBack }
//Dataset value to each control on panel, a part of form design public void SetPanelControlValue(TabPanel oPanel, DataSet oDSFields) { if (oDSFields.Tables.Count > 0) { if (oDSFields.Tables[0].Rows.Count > 0) { for (int n = 0; n <= oDSFields.Tables[0].Columns.Count - 1; n++) { String ControlName = oDSFields.Tables[0].Columns[n].ToString(); System.Web.UI.Control oCnt = oPanel.FindControl(ControlName); if (oCnt != null) { if (oCnt is TextBox) { TextBox oTextBox = (TextBox)oCnt; //Check Read only if (oTextBoxList != null) { if (IsNotDefaultSeasonID) { oTextBox.Enabled = false; } if (oDSFields.Tables[0].Rows[0][ControlName].ToString() != null) { if (oDSFields.Tables[0].Rows[0][ControlName].ToString() != string.Empty) { String sText = oDSFields.Tables[0].Rows[0][ControlName].ToString(); oTextBox.Text = HttpUtility.HtmlDecode(sText); } else { oTextBox.Text = string.Empty; } } } } else if (oCnt is DropDownList) { DropDownList oDDL = (DropDownList)oCnt; //if (IsNotDefaultSeasonID) //{ // oDDL.Enabled = false; //} for (int i = 0; i <= oDDL.Items.Count - 1; i++) if (oDSFields.Tables[0].Rows[0][ControlName] != null) { if (oDSFields.Tables[0].Rows[0][ControlName].ToString() != string.Empty) { if (oDDL.Items[i].Value == oDSFields.Tables[0].Rows[0][ControlName].ToString()) { oDDL.SelectedIndex = i; break; } } } } else if (oCnt is CheckBox) { CheckBox oCk = (CheckBox)oCnt; if (IsNotDefaultSeasonID) { oCk.Enabled = false; } if (oDSFields.Tables[0].Rows[0][ControlName] != null) { if (oDSFields.Tables[0].Rows[0][ControlName].ToString() != string.Empty) { if (Convert.ToBoolean(oDSFields.Tables[0].Rows[0][ControlName]) == true) { oCk.Checked = true; } else { oCk.Checked = false; } } } //oCk.Checked = true; } } } } } }
// 12/03/2009 Add support for tabbed subpanels. protected void AppendDetailViewRelationships(string sDETAIL_NAME, PlaceHolder plc, Guid gUSER_ID, bool bGroupTabs, bool bEditView) { // 11/17/2007 Convert all view requests to a mobile request if appropriate. sDETAIL_NAME = sDETAIL_NAME + (this.IsMobile ? ".Mobile" : ""); //int nPlatform = (int) Environment.OSVersion.Platform; DataTable dtFields = null; if ( Sql.IsEmptyGuid(gUSER_ID) ) dtFields = SplendidCache.DetailViewRelationships(sDETAIL_NAME); else dtFields = SplendidCache.UserDashlets(sDETAIL_NAME, gUSER_ID); // 02/27/2010 Save the Detail Name so that it can be used in the Page.Items["DETAIL_NAME"] = sDETAIL_NAME; //bGroupTabs = false; if ( bGroupTabs ) { GetL10n(); DataTable dtTabGroups = SplendidCache.TabGroups(); DataView vwModuleGroups = new DataView(SplendidCache.ModuleGroups()); Literal litBR = new Literal(); litBR.Text = "<br />"; plc.Controls.Add(litBR); List<String> lstPlacedControls = new List<String>(); int nControlsInserted = 0; AjaxControlToolkit.TabContainer tc = new AjaxControlToolkit.TabContainer(); tc.TabStripPlacement = TabStripPlacement.Top; plc.Controls.Add(tc); // 02/27/2010 Capture the ActiveTabIndex. This only works during postback. // Just clicking tab will not cause the event to fire. // It would be nice to always remember the Tab, but it is too much work at this stage. tc.ActiveTabChanged += new EventHandler(tc_ActiveTabChanged); AjaxControlToolkit.TabPanel tabOther = null; foreach(DataRow rowTabs in dtTabGroups.Rows) { string sGROUP_NAME = Sql.ToString(rowTabs["NAME" ]); string sTITLE = Sql.ToString(rowTabs["TITLE"]); AjaxControlToolkit.TabPanel tab = new AjaxControlToolkit.TabPanel(); tab.HeaderText = L10n.Term(sTITLE); tc.Tabs.Add(tab); if ( sGROUP_NAME == "Other" ) tabOther = tab; foreach(DataRow row in dtFields.Rows) { // 12/03/2009 The Title is used for the tabbed subpanels. string sMODULE_NAME = Sql.ToString(row["MODULE_NAME" ]); string sCONTROL_NAME = Sql.ToString(row["CONTROL_NAME"]); // 04/27/2006 Only add the control if the user has access. vwModuleGroups.RowFilter = "GROUP_NAME = '" + sGROUP_NAME + "' and MODULE_NAME = '" + sMODULE_NAME + "'"; if ( Security.GetUserAccess(sMODULE_NAME, "list") >= 0 && vwModuleGroups.Count > 0 ) { try { UpdatePanel pnl = new UpdatePanel(); // 05/06/2010 Try using the UpdatePanel Conditional mode. pnl.UpdateMode = UpdatePanelUpdateMode.Conditional; tab.Controls.Add(pnl); Control ctl = LoadControl(sCONTROL_NAME + ".ascx"); // 07/10/2009 If this is a Dashlet, then set the DetailView name. DashletControl ctlDashlet = ctl as DashletControl; if ( ctlDashlet != null ) { ctlDashlet.DetailView = sDETAIL_NAME; } pnl.ContentTemplateContainer.Controls.Add(ctl); nControlsInserted++; // 01/09/2009 Keep a list of controls we have placed so that unplaced items can be added to the Other tab. if ( !lstPlacedControls.Contains(sCONTROL_NAME) ) lstPlacedControls.Add(sCONTROL_NAME); // 02/14/2013 Now that the DetailViewRelationships are added in Page_Load, we need to manually fire the DataBind event. if ( !Page.IsPostBack ) ctl.DataBind(); } catch(Exception ex) { if ( !Utils.IsOfflineClient ) { Label lblError = new Label(); lblError.Text = Utils.ExpandException(ex); lblError.ForeColor = System.Drawing.Color.Red; lblError.EnableViewState = false; tab.Controls.Add(lblError); } } } } if ( tab.Controls.Count == 0 ) { tab.Visible = false; } } if ( tabOther != null ) { // 01/09/2009 Keep a list of controls we have placed so that unplaced items can be added to the Other tab. foreach(DataRow row in dtFields.Rows) { string sMODULE_NAME = Sql.ToString(row["MODULE_NAME" ]); string sCONTROL_NAME = Sql.ToString(row["CONTROL_NAME"]); if ( Security.GetUserAccess(sMODULE_NAME, "list") >= 0 && !lstPlacedControls.Contains(sCONTROL_NAME) ) { try { UpdatePanel pnl = new UpdatePanel(); // 05/06/2010 Try using the UpdatePanel Conditional mode. pnl.UpdateMode = UpdatePanelUpdateMode.Conditional; tabOther.Controls.Add(pnl); Control ctl = LoadControl(sCONTROL_NAME + ".ascx"); // 07/10/2009 If this is a Dashlet, then set the DetailView name. DashletControl ctlDashlet = ctl as DashletControl; if ( ctlDashlet != null ) { ctlDashlet.DetailView = sDETAIL_NAME; } pnl.ContentTemplateContainer.Controls.Add(ctl); nControlsInserted++; lstPlacedControls.Add(sCONTROL_NAME); // 02/14/2013 Now that the DetailViewRelationships are added in Page_Load, we need to manually fire the DataBind event. if ( !Page.IsPostBack ) ctl.DataBind(); } catch(Exception ex) { if ( !Utils.IsOfflineClient ) { Label lblError = new Label(); lblError.Text = Utils.ExpandException(ex); lblError.ForeColor = System.Drawing.Color.Red; lblError.EnableViewState = false; tabOther.Controls.Add(lblError); } } tabOther.Visible = true; } } } if ( !IsPostBack ) { // 02/27/2010 Restore the ActiveTabIndex. int nActiveTabIndex = Sql.ToInteger(Session[sDETAIL_NAME + ".ActiveTabIndex"]); if ( nActiveTabIndex > 0 ) { tc.ActiveTabIndex = nActiveTabIndex; } else { for ( int i=0; i < tc.Tabs.Count; i++ ) { TabPanel tab = tc.Tabs[i]; if ( tab.Controls.Count > 0 ) { tc.ActiveTabIndex = i; break; } } } } // 12/28/2009 If no controls were placed, then this might be an admin area that does not use tabs. // Try again, but without the tabs. if ( dtFields.Rows.Count > 0 && nControlsInserted == 0 ) { tc.Visible = false; AppendDetailViewRelationships(sDETAIL_NAME, plc, gUSER_ID, false, bEditView); } } else { foreach(DataRow row in dtFields.Rows) { string sMODULE_NAME = Sql.ToString(row["MODULE_NAME" ]); string sCONTROL_NAME = Sql.ToString(row["CONTROL_NAME"]); // 04/27/2006 Only add the control if the user has access. if ( Security.GetUserAccess(sMODULE_NAME, "list") >= 0 ) { try { // 09/21/2008 Mono does not fully support AJAX at this time. // 09/22/2008 The UpdatePanel is no longer crashing Mono, so resume using it. // 01/27/2010 We cannot use an UpdatePanel in EditView mode as the async requests prevent the subpanel data from being submitted. if ( bEditView ) { Control ctl = LoadControl(sCONTROL_NAME + ".ascx"); SubPanelControl ctlSubPanel = ctl as SubPanelControl; if ( ctlSubPanel != null ) { ctlSubPanel.IsEditView = true; plc.Controls.Add(ctl); // 02/14/2013 Now that the DetailViewRelationships are added in Page_Load, we need to manually fire the DataBind event. if ( !Page.IsPostBack ) ctl.DataBind(); } } else { // 04/24/2008 Put an update panel around all sub panels. This will allow in-place pagination and sorting. UpdatePanel pnl = new UpdatePanel(); // 05/06/2010 Try using the UpdatePanel Conditional mode. pnl.UpdateMode = UpdatePanelUpdateMode.Conditional; plc.Controls.Add(pnl); Control ctl = LoadControl(sCONTROL_NAME + ".ascx"); // 07/10/2009 If this is a Dashlet, then set the DetailView name. DashletControl ctlDashlet = ctl as DashletControl; if ( ctlDashlet != null ) { ctlDashlet.DetailView = sDETAIL_NAME; } pnl.ContentTemplateContainer.Controls.Add(ctl); // 02/14/2013 Now that the DetailViewRelationships are added in Page_Load, we need to manually fire the DataBind event. if ( !Page.IsPostBack ) ctl.DataBind(); } } catch(Exception ex) { // 11/29/2009 Ignore the missing file on the offline client. This might be intentional. if ( !Utils.IsOfflineClient ) { Label lblError = new Label(); // 06/09/2006 Catch the error and display a message instead of crashing. // 12/27/2008 Don't specify an ID as there can be multiple errors. lblError.Text = Utils.ExpandException(ex); lblError.ForeColor = System.Drawing.Color.Red; lblError.EnableViewState = false; plc.Controls.Add(lblError); } } } } } }
/// <summary> /// Helper method to save the value of a template. This sets up all the right Undo state. /// </summary> /// <param name="panel"></param> /// <param name="host"></param> /// <param name="template"></param> /// <param name="propertyName"></param> private static void PersistTemplate(TabPanel panel, IDesignerHost host, ITemplate template, string propertyName) { using (var transaction = host.CreateTransaction("SetEditableDesignerRegionContent")) { var propertyInfo = panel.GetType().GetProperty(propertyName); if (propertyInfo != null) { propertyInfo.SetValue(panel, template, null); transaction.Commit(); } } }