public CustomerSign(int estimateRevisionId, int revisiontypeid, int estimateid, int revisionnumber, string accountid) { _estimateRevisionId = estimateRevisionId; _revisiontypeid = revisiontypeid; _revisionnumber = revisionnumber.ToString(); _estimateid = estimateid.ToString(); cvm = new DocuSignViewModel(estimateRevisionId.ToString(), estimateid.ToString(), revisiontypeid.ToString(), revisionnumber.ToString(), accountid); InitializeComponent(); this.DataContext = cvm; }
private void Processing(bool signinoffice, List <DocumentAttributes> listd, string selecteddoctype, string includestd, string mergesurcharge, string selectedrecipientsname, string selectedrecipientsemail, string selectedOrder, string actionstring, string selectedsortorder) { string methodid = (cboMethod.SelectedItem as DocuSignMethod).MethodID.ToString(); string emailbody = txtbody.Text.Replace(Environment.NewLine, "~!~").Replace("\n", "~!~").Replace("\r", "~!~"); try { if (signinoffice) { MessageBoxResult result = MessageBox.Show("Are you sure you want to sign the document now?", "Confirmation", MessageBoxButton.OKCancel); if (result == MessageBoxResult.OK) { foreach (DocumentAttributes da in listd) { if ((da.EnvelopeID == null || da.EnvelopeID == "" || da.EnvelopeID == Guid.Empty.ToString()) && da.IntegrationID != "0" && !da.Status.ToLower().Contains("voided")) { BusyIndicator1.IsBusy = false; MessageBox.Show("Please wait until the document has been integrated to Docusign."); } else { if (da.VersionType.ToUpper().Contains("CUSTOMER")) { Uri uri = new Uri("../PrintEstimateNewTemplate.aspx?merge=" + mergesurcharge + "&type=customer&version=" + da.PrintType + "&documenttype=" + selecteddoctype + "&EstimateRevisionId=" + _estimateRevisionId.ToString() + "&includestd=" + includestd + "&userid=" + ((App)App.Current).CurrentUserId.ToString() + "&action=signinoffice" + "&recipients=" + selectedrecipientsname + "&recipientsemail=" + selectedrecipientsemail + "&routingorder=" + selectedOrder + "&methods=" + actionstring + "&envelopeid=" + da.EnvelopeID + "&sortorder=" + selectedsortorder + "&docusignintegration=1&emailsubject=" + txtsubject.Text + "&emailbody=" + emailbody, UriKind.Relative); BusyIndicator1.IsBusy = false; System.Windows.Browser.HtmlPage.Window.Navigate(uri, "_blank", "toolbar=0,menubar=1,location=0,status=0,top=0,left=0,resizable=1"); } else if (da.VersionType.ToUpper().Contains("STUDIO")) { BusyIndicator1.IsBusy = true; Uri uri = new Uri("../PrintEstimateStudioMTemplate.aspx?merge=" + mergesurcharge + "&type=studiom&version=" + da.PrintType + "&documenttype=" + selecteddoctype + "&EstimateRevisionId=" + _estimateRevisionId.ToString() + "&includestd=" + includestd + "&userid=" + ((App)App.Current).CurrentUserId.ToString() + "&action=signinoffice" + "&recipients=" + selectedrecipientsname + "&recipientsemail=" + selectedrecipientsemail + "&routingorder=" + selectedOrder + "&sortorder=" + selectedsortorder + "&methods=" + actionstring + "&docusignintegration=1&emailsubject=" + txtsubject.Text + "&emailbody=" + emailbody, UriKind.Relative); BusyIndicator1.IsBusy = false; System.Windows.Browser.HtmlPage.Window.Navigate(uri, "_blank", "toolbar=0,menubar=1,location=0,status=0,top=0,left=0,resizable=1"); } else if (da.VersionType.ToUpper().Contains("VARIATION")) { BusyIndicator1.IsBusy = true; Uri uri = new Uri("../PrintVariation.aspx?merge=" + mergesurcharge + "&type=variation&version=" + da.PrintType + "&documenttype=" + selecteddoctype + "&EstimateRevisionId=" + _estimateRevisionId.ToString() + "&includestd=" + includestd + "&userid=" + ((App)App.Current).CurrentUserId.ToString() + "&action=signinoffice" + "&recipients=" + selectedrecipientsname + "&recipientsemail=" + selectedrecipientsemail + "&routingorder=" + selectedOrder + "&sortorder=" + selectedsortorder + "&methods=" + actionstring + "&docusignintegration=1&emailsubject=" + txtsubject.Text + "&emailbody=" + emailbody, UriKind.Relative); BusyIndicator1.IsBusy = false; System.Windows.Browser.HtmlPage.Window.Navigate(uri, "_blank", "toolbar=0,menubar=1,location=0,status=0,top=0,left=0,resizable=1"); } else { BusyIndicator1.IsBusy = false; } } } CloseRadWindow(); } else { BusyIndicator1.IsBusy = false; } } else { foreach (DocumentAttributes da in listd) { //if (!ValidateSginRemote(da, methodid, out errormessage)) //{ // MessageBox.Show(errormessage); // return; //} //else //{ foreach (var item2 in ((DocuSignViewModel)LayoutRoot.DataContext).DocuSignStatus) { if (item2.Selected) { if (methodid == "0") { item2.status = "Sent"; } else if (methodid == "1") { item2.status = "Voided"; } item2.statusChangedDateTime = DateTime.Now.ToString("dd/MM/yyyy"); } } //} if (methodid == "0") { if (da.VersionType.ToUpper().Contains("CUSTOMER")) { BusyIndicator1.IsBusy = true; Uri uri = new Uri("../PrintEstimateNewTemplate.aspx?merge=" + mergesurcharge + "&type=customer&version=" + da.PrintType + "&documenttype=" + selecteddoctype + "&EstimateRevisionId=" + _estimateRevisionId.ToString() + "&includestd=" + includestd + "&userid=" + ((App)App.Current).CurrentUserId.ToString() + "&action=SendViaDocuSign" + "&recipients=" + selectedrecipientsname + "&recipientsemail=" + selectedrecipientsemail + "&routingorder=" + selectedOrder + "&sortorder=" + selectedsortorder + "&methods=" + actionstring + "&docusignintegration=1&emailsubject=" + txtsubject.Text + "&emailbody=" + emailbody, UriKind.Relative); System.Net.WebClient client = new System.Net.WebClient(); client.DownloadStringCompleted += new System.Net.DownloadStringCompletedEventHandler(client_DownloadStringCompleted); client.DownloadStringAsync(uri); } else if (da.VersionType.ToUpper().Contains("STUDIO")) { BusyIndicator1.IsBusy = true; Uri uri = new Uri("../PrintEstimateStudioMTemplate.aspx?merge=" + mergesurcharge + "&type=studiom&version=" + da.PrintType + "&documenttype=" + selecteddoctype + "&EstimateRevisionId=" + _estimateRevisionId.ToString() + "&includestd=" + includestd + "&userid=" + ((App)App.Current).CurrentUserId.ToString() + "&action=SendViaDocuSign" + "&recipients=" + selectedrecipientsname + "&recipientsemail=" + selectedrecipientsemail + "&routingorder=" + selectedOrder + "&sortorder=" + selectedsortorder + "&methods=" + actionstring + "&docusignintegration=1&emailsubject=" + txtsubject.Text + "&emailbody=" + emailbody, UriKind.Relative); System.Net.WebClient client = new System.Net.WebClient(); client.DownloadStringCompleted += new System.Net.DownloadStringCompletedEventHandler(client_DownloadStringCompleted); client.DownloadStringAsync(uri); } else if (da.VersionType.ToUpper().Contains("VARIATION")) { BusyIndicator1.IsBusy = true; Uri uri = new Uri("../PrintVariation.aspx?merge=" + mergesurcharge + "&type=variation&version=" + da.PrintType + "&documenttype=" + selecteddoctype + "&EstimateRevisionId=" + _estimateRevisionId.ToString() + "&includestd=" + includestd + "&userid=" + ((App)App.Current).CurrentUserId.ToString() + "&action=SendViaDocuSign" + "&recipients=" + selectedrecipientsname + "&recipientsemail=" + selectedrecipientsemail + "&routingorder=" + selectedOrder + "&sortorder=" + selectedsortorder + "&methods=" + actionstring + "&docusignintegration=1&emailsubject=" + txtsubject.Text + "&emailbody=" + emailbody, UriKind.Relative); System.Net.WebClient client = new System.Net.WebClient(); client.DownloadStringCompleted += new System.Net.DownloadStringCompletedEventHandler(client_DownloadStringCompleted); client.DownloadStringAsync(uri); } else { BusyIndicator1.IsBusy = false; } } else { BusyIndicator1.IsBusy = true; if (da.EnvelopeID != null && da.EnvelopeID != "" && da.EnvelopeID != Guid.Empty.ToString()) { Uri uri = new Uri("../DocuSignVoidEnvelope.aspx?integrationid=" + da.IntegrationID.ToString() + "&envelopeid=" + da.EnvelopeID + "&username="******"&voidreason=" + txtvoidreason.Text.Replace(Environment.NewLine, "~!~").Replace("\n", "~!~").Replace("\r", "~!~"), UriKind.Relative); System.Net.WebClient client = new System.Net.WebClient(); client.DownloadStringCompleted += new System.Net.DownloadStringCompletedEventHandler(client_DownloadStringCompleted); client.DownloadStringAsync(uri); } else { DocuSignViewModel dmv = this.DataContext as DocuSignViewModel; dmv.RemoveDocuSignDocumentsFromQueue(da.IntegrationID); BusyIndicator1.IsBusy = false; MessageBox.Show("The document has been successfully voided."); CloseRadWindow(); } } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }