public void ChangeTabUnreadManage(string tabName, bool isManage) { int idx; for (idx = 0; idx < ListTab.TabCount; idx++) { if (ListTab.TabPages[idx].Text == tabName) { break; } } _statuses.SetTabUnreadManage(tabName, isManage); if (_configs.TabIconDisp) { ListTab.TabPages[idx].ImageIndex = _statuses.Tabs[tabName].UnreadCount > 0 ? 0 : -1; } if (_curTab.Text == tabName) { _itemCache = null; _postCache = null; _curList.Refresh(); } SetMainWindowTitle(); SetStatusLabelUrl(); if (!_configs.TabIconDisp) { ListTab.Refresh(); } }
public static List <ListTab> GetDataTabForList2(string filePath = "") { try { List <ListTab> tabs = new List <ListTab>(); string xmlPath = HttpContext.Current.Server.MapPath(filePath); //Path of the xml script XmlDocument doc = new XmlDocument(); doc.Load(xmlPath); if (doc != null) { //Get and display the last item node. XmlElement root = doc.DocumentElement; XmlNodeList nodeList = root.GetElementsByTagName("tab"); if (nodeList != null && nodeList.Count > 0) { foreach (XmlNode node in nodeList) { XmlNodeList childs = node.ChildNodes; ListTab tab = new ListTab(); if (childs != null && childs.Count > 0) { foreach (XmlNode child in childs) { if (child.Name == "index") { tab.index = child.InnerText.Trim(); } if (child.Name == "display") { tab.display = child.InnerText; } if (child.Name == "status") { tab.status = child.InnerText; } if (child.Name == "active") { tab.active = Convert.ToInt32(child.InnerText); } } } tabs.Add(tab); } return(tabs); } } return(new List <ListTab>()); } catch (Exception ex) { return(new List <ListTab>()); } }
protected override void Execute(CodeActivityContext context) { Initialize(context); ListTab listTab; listItems = ListItems.Get(context); if (anchorText != null) { listTab = new ListTab(anchorText, offsetX, offsetY, doc.documentId, pageNumber, toolTip, tabLabel, bold, italic, underline, font, fontColor, fontSize, listItems, Required, Shared); } else { listTab = new ListTab(sigX, sigY, doc.documentId, pageNumber, toolTip, tabLabel, bold, italic, underline, font, fontColor, fontSize, listItems, Required, Shared); } AddTabToRecipient(listTab); }
public void ReorderTab(string targetTabText, string baseTabText, bool isBeforeBaseTab) { int baseIndex; for (baseIndex = 0; baseIndex < ListTab.TabPages.Count; baseIndex++) { if (ListTab.TabPages[baseIndex].Text == baseTabText) { break; } } ListTab.SuspendLayout(); TabPage tp = null; for (int j = 0; j < ListTab.TabPages.Count; j++) { if (ListTab.TabPages[j].Text == targetTabText) { tp = ListTab.TabPages[j]; ListTab.TabPages.Remove(tp); if (j < baseIndex) { baseIndex -= 1; } break; } } if (isBeforeBaseTab) { ListTab.TabPages.Insert(baseIndex, tp); } else { ListTab.TabPages.Insert(baseIndex + 1, tp); } ListTab.ResumeLayout(); SaveConfigsTabs(); }
public void TabRefresh(ListTab tab) { switch (tab) { case ListTab.Tour: { tabTour_FromDate.Value = tabTour_FromDate.MinDate; tabTour_ToDate.Value = tabTour_ToDate.MaxDate; tabTour_ToPrice.Value = tabTour_ToPrice.Maximum; tabTour_SearchOption.SelectedIndex = 0; searchBox.Text = ""; isDeleted_ChB.Checked = false; tourGridView.Rows.Clear(); var data = _tourRepo.getAll(); foreach (Tour item in data) { tourGridView.Rows.Add(item.TourId, item.MaTour, item.Ten, item.LHDL.Ten); } break; } case ListTab.Nhanvien: { tabNV_SearchBox.Text = ""; tabNV_CB.Checked = false; NVGridView.Rows.Clear(); var data = _nhanvienRepo.getAll(); foreach (NhanVien item in data) { NVGridView.Rows.Add(item.NVId, item.MaNV, item.Ten, item.SDT); } break; } case ListTab.Chitieu: { tabCT_SearchBox.Text = ""; ChiTieuGridView.Rows.Clear(); var data = _chitieuRepo.getAll(); foreach (ChiTieu item in data) { ChiTieuGridView.Rows.Add(item.CTId, item.Ten); } break; } case ListTab.Doan: { tabDoan_SearchBox.Text = ""; DoanGridView.Rows.Clear(); var data = _doankhachRepo.getAll(); foreach (DoanKhach item in data) { DoanGridView.Rows.Add(item.DoanId, item.MaDoan, item.TenDoan, item.Chitiet, item.Status, item.TourId, item.Tour.MaTour); } break; } case ListTab.HanhKhach: { tabHanhKhach_SearchBox.Text = ""; HanhKhachGridView.Rows.Clear(); var data = _hanhkhachRepo.getAll(); foreach (HanhKhach item in data) { HanhKhachGridView.Rows.Add(item.KhachId, item.MaKhach, item.Ten, item.SDT, item.Email); } break; } } }
private void newContractButton_Click(object sender, EventArgs e) { ListTab.SelectTab("editClientTab"); }
public bool RemoveSpecifiedTab(string tabName, bool confirm) { int idx; for (idx = 0; idx < ListTab.TabPages.Count; idx++) { if (ListTab.TabPages[idx].Text == tabName) { break; } } if (_statuses.IsDefaultTab(tabName)) { return(false); } if (confirm) { string tmp = string.Format(R.RemoveSpecifiedTabText1, Environment.NewLine); var result = MessageBox.Show(tmp, string.Format("{0} {1}", tabName, R.RemoveSpecifiedTabText2), MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (result == DialogResult.Cancel) { return(false); } } SetListProperty(); // 他のタブに列幅等を反映 TabUsageType tabType = _statuses.Tabs[tabName].TabType; // オブジェクトインスタンスの削除 SplitContainer1.Panel1.SuspendLayout(); SplitContainer1.Panel2.SuspendLayout(); SplitContainer1.SuspendLayout(); ListTab.SuspendLayout(); SuspendLayout(); TabPage tabPage = ListTab.TabPages[idx]; var listCustom = (DetailsListView)tabPage.Tag; tabPage.Tag = null; tabPage.SuspendLayout(); if (ReferenceEquals(ListTab.SelectedTab, ListTab.TabPages[idx])) { ListTab.SelectTab(_prevSelectedTab != null && ListTab.TabPages.Contains(_prevSelectedTab) ? _prevSelectedTab : ListTab.TabPages[0]); } ListTab.Controls.Remove(tabPage); if (tabType == TabUsageType.PublicSearch) { Control pnl = tabPage.Controls["panelSearch"]; foreach (Control ctrl in pnl.Controls) { if (ctrl.Name == "buttonSearch") { ctrl.Click -= SearchButton_Click; } ctrl.Enter -= SearchControls_Enter; ctrl.Leave -= SearchControls_Leave; pnl.Controls.Remove(ctrl); ctrl.Dispose(); } tabPage.Controls.Remove(pnl); } tabPage.Controls.Remove(listCustom); listCustom.Columns.Clear(); listCustom.ContextMenuStrip = null; listCustom.SelectedIndexChanged -= MyList_SelectedIndexChanged; listCustom.MouseDoubleClick -= MyList_MouseDoubleClick; listCustom.ColumnClick -= MyList_ColumnClick; listCustom.DrawColumnHeader -= MyList_DrawColumnHeader; listCustom.DragDrop -= TweenMain_DragDrop; listCustom.DragOver -= TweenMain_DragOver; listCustom.DrawItem -= MyList_DrawItem; listCustom.MouseClick -= MyList_MouseClick; listCustom.ColumnReordered -= MyList_ColumnReordered; listCustom.ColumnWidthChanged -= MyList_ColumnWidthChanged; listCustom.CacheVirtualItems -= MyList_CacheVirtualItems; listCustom.RetrieveVirtualItem -= MyList_RetrieveVirtualItem; listCustom.DrawSubItem -= MyList_DrawSubItem; listCustom.HScrolled -= MyList_HScrolled; _tabDialog.RemoveTab(tabName); listCustom.SmallImageList = null; listCustom.ListViewItemSorter = null; // キャッシュのクリア if (_curTab.Equals(tabPage)) { _curTab = null; _curItemIndex = -1; _curList = null; _curPost = null; } _itemCache = null; _itemCacheIndex = -1; _postCache = null; tabPage.ResumeLayout(false); SplitContainer1.Panel1.ResumeLayout(false); SplitContainer1.Panel2.ResumeLayout(false); SplitContainer1.ResumeLayout(false); ListTab.ResumeLayout(false); ResumeLayout(false); PerformLayout(); tabPage.Dispose(); listCustom.Dispose(); _statuses.RemoveTab(tabName); foreach (TabPage tp in ListTab.TabPages) { var lst = (DetailsListView)tp.Tag; lst.VirtualListSize = _statuses.Tabs[tp.Text].AllCount; } return(true); }
public bool AddNewTab(string tabName, bool startup, TabUsageType tabType, ListElement listInfo = null) { // 重複チェック if (ListTab.TabPages.Cast <TabPage>().Any(tb => tb.Text == tabName)) { return(false); } // 新規タブ名チェック if (tabName == R.AddNewTabText1) { return(false); } // タブタイプ重複チェック if (!startup) { if (tabType == TabUsageType.DirectMessage || tabType == TabUsageType.Favorites || tabType == TabUsageType.Home || tabType == TabUsageType.Mentions || tabType == TabUsageType.Related) { if (_statuses.GetTabByType(tabType) != null) { return(false); } } } var tabPage = new TabPage(); int cnt = ListTab.TabPages.Count; //// ToDo:Create and set controls follow tabtypes SplitContainer1.Panel1.SuspendLayout(); SplitContainer1.Panel2.SuspendLayout(); SplitContainer1.SuspendLayout(); ListTab.SuspendLayout(); SuspendLayout(); tabPage.SuspendLayout(); // UserTimeline関連 Label label = null; if (tabType == TabUsageType.UserTimeline || tabType == TabUsageType.Lists) { label = new Label { Dock = DockStyle.Top, Name = "labelUser", Text = tabType == TabUsageType.Lists ? listInfo.ToString() : _statuses.Tabs[tabName].User + "'s Timeline", TextAlign = ContentAlignment.MiddleLeft }; using (var tmpComboBox = new ComboBox()) { label.Height = tmpComboBox.Height; } } ListTab.Controls.Add(tabPage); var listCustom = CreateDetailListView(tabName, startup); listCustom.SelectedIndexChanged += MyList_SelectedIndexChanged; listCustom.MouseDoubleClick += MyList_MouseDoubleClick; listCustom.ColumnClick += MyList_ColumnClick; listCustom.DrawColumnHeader += MyList_DrawColumnHeader; listCustom.DragDrop += TweenMain_DragDrop; listCustom.DragOver += TweenMain_DragOver; listCustom.DrawItem += MyList_DrawItem; listCustom.MouseClick += MyList_MouseClick; listCustom.ColumnReordered += MyList_ColumnReordered; listCustom.ColumnWidthChanged += MyList_ColumnWidthChanged; listCustom.CacheVirtualItems += MyList_CacheVirtualItems; listCustom.RetrieveVirtualItem += MyList_RetrieveVirtualItem; listCustom.DrawSubItem += MyList_DrawSubItem; listCustom.HScrolled += MyList_HScrolled; tabPage.Controls.Add(listCustom); if (_statuses.IsDistributableTab(tabName)) { _tabDialog.AddTab(tabName); } // 検索関連の準備 Panel pnl = null; if (tabType == TabUsageType.PublicSearch) { pnl = CreateSearchPanel(tabName); tabPage.Controls.Add(pnl); } if (tabType == TabUsageType.UserTimeline || tabType == TabUsageType.Lists) { tabPage.Controls.Add(label); } tabPage.Location = new Point(4, 4); tabPage.Name = string.Format("CTab{0}", cnt); tabPage.Size = new Size(380, 260); tabPage.TabIndex = 2 + cnt; tabPage.Text = tabName; tabPage.UseVisualStyleBackColor = true; if (tabType == TabUsageType.PublicSearch) { pnl.ResumeLayout(false); } tabPage.ResumeLayout(false); SplitContainer1.Panel1.ResumeLayout(false); SplitContainer1.Panel2.ResumeLayout(false); SplitContainer1.ResumeLayout(false); ListTab.ResumeLayout(false); ResumeLayout(false); PerformLayout(); tabPage.Tag = listCustom; return(true); }
protected void createEnvelope() { // Set up the envelope CreateEnvelopeRequest createEnvelopeRequest = new CreateEnvelopeRequest(); createEnvelopeRequest.emailSubject = "PDF Form Fields Example"; createEnvelopeRequest.status = "sent"; createEnvelopeRequest.emailBlurb = "Example of how to enable forms to work with DocuSign using PDF Form Fields (Magicstrings)"; // Define first signer Signer signer = new Signer(); signer.email = email.Value; signer.name = firstname.Value + " " + lastname.Value; signer.recipientId = 1; signer.routingOrder = "1"; signer.roleName = "Signer1"; signer.clientUserId = RandomizeClientUserID(); // First signer is embedded // Define 2nd signer Signer signer2 = new Signer(); signer2.email = jointEmail.Value; signer2.name = jointFirstname.Value + " " + jointLastname.Value; signer2.recipientId = 2; signer2.routingOrder = "2"; signer2.roleName = "Signer2"; // Add tabs for the 1st signer. Define the pattern that assigns the form field to a particular signer signer.tabs = new Tabs(); signer.tabs.signHereTabs = new List <SignHereTab>(); SignHereTab signHereTab = new SignHereTab(); signHereTab.documentId = "1"; signHereTab.recipientId = "1"; signHereTab.tabLabel = signer1MagicPattern.Value; signer.tabs.signHereTabs.Add(signHereTab); signer.tabs.dateSignedTabs = new List <DateSignedTab>(); DateSignedTab dateSignedTab = new DateSignedTab(); dateSignedTab.documentId = "1"; dateSignedTab.recipientId = "1"; dateSignedTab.tabLabel = signer1MagicPattern.Value; signer.tabs.dateSignedTabs.Add(dateSignedTab); signer.tabs.fullNameTabs = new List <FullnameTab>(); FullnameTab fullnameTab = new FullnameTab(); fullnameTab.documentId = "1"; fullnameTab.recipientId = "1"; fullnameTab.tabLabel = signer1MagicPattern.Value; signer.tabs.fullNameTabs.Add(fullnameTab); signer.tabs.textTabs = new List <TextTab>(); TextTab textTab = new TextTab(); textTab.documentId = "1"; textTab.recipientId = "1"; textTab.tabLabel = signer1MagicPattern.Value; signer.tabs.textTabs.Add(textTab); signer.tabs.listTabs = new List <ListTab>(); ListTab listTab = new ListTab(); listTab.documentId = "1"; listTab.recipientId = "1"; listTab.tabLabel = signer1MagicPattern.Value; signer.tabs.listTabs.Add(listTab); // Add tabs for the 2nd signer. Define the pattern that assigns the form field to a particular signer signer2.tabs = new Tabs(); signer2.tabs.signHereTabs = new List <SignHereTab>(); SignHereTab signHereTab2 = new SignHereTab(); signHereTab2.documentId = "1"; signHereTab2.recipientId = "2"; signHereTab2.tabLabel = signer2MagicPattern.Value; signer2.tabs.signHereTabs.Add(signHereTab2); signer2.tabs.dateSignedTabs = new List <DateSignedTab>(); DateSignedTab dateSignedTab2 = new DateSignedTab(); dateSignedTab2.documentId = "1"; dateSignedTab2.recipientId = "2"; dateSignedTab2.tabLabel = signer2MagicPattern.Value; signer2.tabs.dateSignedTabs.Add(dateSignedTab2); signer2.tabs.fullNameTabs = new List <FullnameTab>(); FullnameTab fullnameTab2 = new FullnameTab(); fullnameTab2.documentId = "1"; fullnameTab2.recipientId = "2"; fullnameTab2.tabLabel = signer2MagicPattern.Value; signer2.tabs.fullNameTabs.Add(fullnameTab2); // Define a document Document document = new Document(); document.documentId = "1"; document.name = "Sample Form"; document.transformPdfFields = "true"; // Define an inline template InlineTemplate inline1 = new InlineTemplate(); inline1.sequence = "2"; inline1.recipients = new Recipients(); inline1.recipients.signers = new List <Signer>(); inline1.recipients.signers.Add(signer); inline1.recipients.signers.Add(signer2); // Add the inline template to a CompositeTemplate CompositeTemplate compositeTemplate1 = new CompositeTemplate(); compositeTemplate1.inlineTemplates = new List <InlineTemplate>(); compositeTemplate1.inlineTemplates.Add(inline1); compositeTemplate1.document = document; // Add compositeTemplate to the envelope createEnvelopeRequest.compositeTemplates = new List <CompositeTemplate>(); createEnvelopeRequest.compositeTemplates.Add(compositeTemplate1); string output = JsonConvert.SerializeObject(createEnvelopeRequest); // Specify a unique boundary string that doesn't appear in the json or document bytes. string Boundary = "MY_BOUNDARY"; // Set the URI HttpWebRequest request = HttpWebRequest.Create(ConfigurationManager.AppSettings["DocuSignServer"] + "/restapi/v2/accounts/" + ConfigurationManager.AppSettings["API.AccountID"] + "/envelopes") as HttpWebRequest; // Set the method request.Method = "POST"; // Set the authentication header request.Headers["X-DocuSign-Authentication"] = GetSecurityHeader(); // Set the overall request content type aand boundary string request.ContentType = "multipart/form-data; boundary=" + Boundary; request.Accept = "application/json"; // Start forming the body of the request Stream reqStream = request.GetRequestStream(); // write boundary marker between parts WriteStream(reqStream, "\n--" + Boundary + "\n"); // write out the json envelope definition part WriteStream(reqStream, "Content-Type: application/json\n"); WriteStream(reqStream, "Content-Disposition: form-data\n"); WriteStream(reqStream, "\n"); // requires an empty line between the header and the json body WriteStream(reqStream, output); // write out the form bytes for the first form WriteStream(reqStream, "\n--" + Boundary + "\n"); WriteStream(reqStream, "Content-Type: application/pdf\n"); WriteStream(reqStream, "Content-Disposition: file; filename=\"Sample_Form\"; documentId=1\n"); WriteStream(reqStream, "\n"); String filename = uploadFile.Value; if (File.Exists(Server.MapPath("~/App_Data/" + filename))) { // Read the file contents and write them to the request stream byte[] buf = new byte[4096]; int len; // read contents of document into the request stream FileStream fileStream = File.OpenRead(Server.MapPath("~/App_Data/" + filename)); while ((len = fileStream.Read(buf, 0, 4096)) > 0) { reqStream.Write(buf, 0, len); } fileStream.Close(); } // wrte the end boundary marker - ensure that it is on its own line WriteStream(reqStream, "\n--" + Boundary + "--"); WriteStream(reqStream, "\n"); try { HttpWebResponse response = request.GetResponse() as HttpWebResponse; if (response.StatusCode == HttpStatusCode.Created) { byte[] responseBytes = new byte[response.ContentLength]; using (var reader = new System.IO.BinaryReader(response.GetResponseStream())) { reader.Read(responseBytes, 0, responseBytes.Length); } string responseText = Encoding.UTF8.GetString(responseBytes); CreateEnvelopeResponse createEnvelopeResponse = new CreateEnvelopeResponse(); createEnvelopeResponse = JsonConvert.DeserializeObject <CreateEnvelopeResponse>(responseText); if (createEnvelopeResponse.status.Equals("sent")) { // Now that we have created the envelope, get the recipient token for the first signer String url = Request.Url.AbsoluteUri; RecipientViewRequest recipientViewRequest = new RecipientViewRequest(); recipientViewRequest.authenticationMethod = "email"; recipientViewRequest.clientUserId = signer.clientUserId; recipientViewRequest.email = email.Value; if (!Request.Browser.IsMobileDevice) { recipientViewRequest.returnUrl = url.Substring(0, url.LastIndexOf("/")) + "/EmbeddedSigningComplete0.aspx?envelopeID=" + createEnvelopeResponse.envelopeId; } else { recipientViewRequest.returnUrl = url.Substring(0, url.LastIndexOf("/")) + "/ConfirmationPage.aspx?envelopeID=" + createEnvelopeResponse.envelopeId; } recipientViewRequest.userName = firstname.Value + " " + lastname.Value; HttpWebRequest request2 = HttpWebRequest.Create(ConfigurationManager.AppSettings["DocuSignServer"] + "/restapi/v2/accounts/" + ConfigurationManager.AppSettings["API.TemplatesAccountID"] + "/envelopes/" + createEnvelopeResponse.envelopeId + "/views/recipient") as HttpWebRequest; request2.Method = "POST"; // Set the authenticationheader request2.Headers["X-DocuSign-Authentication"] = GetSecurityHeader(); request2.Accept = "application/json"; request2.ContentType = "application/json"; Stream reqStream2 = request2.GetRequestStream(); WriteStream(reqStream2, JsonConvert.SerializeObject(recipientViewRequest)); HttpWebResponse response2 = request2.GetResponse() as HttpWebResponse; responseBytes = new byte[response2.ContentLength]; using (var reader = new System.IO.BinaryReader(response2.GetResponseStream())) { reader.Read(responseBytes, 0, responseBytes.Length); } string response2Text = Encoding.UTF8.GetString(responseBytes); RecipientViewResponse recipientViewResponse = new RecipientViewResponse(); recipientViewResponse = JsonConvert.DeserializeObject <RecipientViewResponse>(response2Text); Session.Add("envelopeID", createEnvelopeResponse.envelopeId); // If it's a non-touch aware device, show the signing session in an iFrame if (!Request.Browser.IsMobileDevice) { if (!Request.Browser.Browser.Equals("InternetExplorer") && (!Request.Browser.Browser.Equals("Safari"))) { docusignFrame.Visible = true; docusignFrame.Src = recipientViewResponse.url; } else // Handle IE differently since it does not allow dynamic setting of the iFrame width and height { docusignFrameIE.Visible = true; docusignFrameIE.Src = recipientViewResponse.url; } } // For touch aware devices, show the signing session in main browser window else { Response.Redirect(recipientViewResponse.url); } } } } catch (WebException ex) { if (ex.Status == WebExceptionStatus.ProtocolError) { HttpWebResponse response = (HttpWebResponse)ex.Response; using (var reader = new System.IO.StreamReader(ex.Response.GetResponseStream(), UTF8Encoding.UTF8)) { string errorMess = reader.ReadToEnd(); log4net.ILog logger = log4net.LogManager.GetLogger(typeof(demos_PDFFormFieldsREST)); logger.Info("\n----------------------------------------\n"); logger.Error("DocuSign Error: " + errorMess); logger.Error(ex.StackTrace); Response.Write(ex.Message); } } else { log4net.ILog logger = log4net.LogManager.GetLogger(typeof(demos_PDFFormFieldsREST)); logger.Info("\n----------------------------------------\n"); logger.Error("WebRequest Error: " + ex.Message); logger.Error(ex.StackTrace); Response.Write(ex.Message); } } }