private bool ValidateSginRemote(DocumentAttributes da, string methodid, out string errormessage) { bool result = true; errormessage = ""; if (!da.EnableSendViaDocuSign && methodid == "0") { errormessage = "You can NOT send envelope to client as it is " + da.Status + "."; result = false; } if (!da.EnableVoid && methodid == "1") { if (da.Status == null || da.Status.Trim() == "") { errormessage = "You can NOT void this envelope as it doesn't exists."; result = false; } else { errormessage = "You can NOT void an envelope in " + da.Status + " status."; result = false; } } return(result); }
private void RemoveIgnoredProperties(ref Document document, DocumentAttributes attrValues) { foreach (var prop in attrValues.Ignored) { document.Data.Remove(prop.Name); } }
/// <summary> /// Create a new instance of a <see cref="DocumentInfo"/>. /// </summary> internal DocumentInfo( DocumentAttributes attributes, TextLoader?loader, IDocumentServiceProvider?documentServiceProvider ) { Attributes = attributes; TextLoader = loader; DocumentServiceProvider = documentServiceProvider; }
private DocumentInfo With( DocumentAttributes attributes = null, Optional <TextLoader> loader = default) { var newAttributes = attributes ?? Attributes; var newLoader = loader.HasValue ? loader.Value : TextLoader; if (newAttributes == Attributes && newLoader == TextLoader) { return(this); } return(new DocumentInfo(newAttributes, newLoader)); }
private DocumentInfo With( DocumentAttributes attributes = null, Optional<TextLoader> loader = default(Optional<TextLoader>)) { var newAttributes = attributes ?? Attributes; var newLoader = loader.HasValue ? loader.Value : TextLoader; if (newAttributes == Attributes && newLoader == TextLoader) { return this; } return new DocumentInfo(newAttributes, newLoader); }
/// <summary> /// Create a new instance of a <see cref="DocumentInfo"/>. /// </summary> private DocumentInfo(DocumentAttributes attributes, TextLoader loader) { Attributes = attributes; TextLoader = loader; }
/// <summary> /// Create a new instance of a <see cref="DocumentInfo"/>. /// </summary> internal DocumentInfo(DocumentAttributes attributes, TextLoader loader) { Attributes = attributes; TextLoader = loader; }
private void btnSend_Click(object sender, RoutedEventArgs e) { string selecteddoctype = ((DocuSignViewModel)LayoutRoot.DataContext)._documenttype; string selectedreferenceid = ""; string selectedrecipientsname = ""; string selectedrecipientsemail = ""; string selectedOrder = ""; string selectedsortorder = ""; string selectedRecipientType = ""; string actionstring = ""; string mergesurcharge = "0"; string includestd = "0"; string errormessage = ""; int signinofficecount = 0; int customerdocumentsentcount = 0; string customerdocumentname = ""; bool signinoffice = false; BusyIndicator1.IsBusy = true; List <DocumentAttributes> listd = new List <DocumentAttributes>(); string methodid = (cboMethod.SelectedItem as DocuSignMethod).MethodID.ToString(); // get selected value from document grid foreach (var item2 in ((DocuSignViewModel)LayoutRoot.DataContext).DocuSignStatus) { selectedreferenceid = item2.estimateid; if (item2.Selected) { DocumentAttributes da = new DocumentAttributes(); da.VersionType = item2.versiontype; da.VersionNumber = item2.revisionnumber; da.PrintType = item2.printtype; da.EnableSendViaDocuSign = item2.EnableSendViaDocuSign; da.EnableSignInPerson = item2.EnableSignInPerson; da.EnableVoid = item2.EnableVoid; da.Status = item2.status; if (item2.status == null || (item2.status != null && item2.status.ToLower().Contains("voided"))) { da.EnvelopeID = Guid.Empty.ToString(); } else { da.EnvelopeID = item2.envelopeId; } da.IntegrationID = item2.integrationid.ToString(); listd.Add(da); } else { if (item2.versiontype.ToUpper().Contains("CUSTOMER") && (item2.status != null && item2.status.ToUpper() == "SENT")) { customerdocumentname = item2.versiontype; customerdocumentsentcount = customerdocumentsentcount + 1; } } } // get selected value from recipient grid foreach (var item in ((DocuSignViewModel)LayoutRoot.DataContext).Contacts) { if (item.Selected && item.SortOrder > 0) { if (selectedrecipientsname == "") { selectedrecipientsname = item.RecipientName; selectedrecipientsemail = item.RecipientEmail; selectedOrder = item.RoutingOrder.ToString(); actionstring = item.SelectedAction.ToString(); selectedsortorder = item.SortOrder.ToString(); selectedRecipientType = item.RecipientType; } else { selectedrecipientsname = selectedrecipientsname + "," + item.RecipientName; selectedrecipientsemail = selectedrecipientsemail + "," + item.RecipientEmail; selectedOrder = selectedOrder + "," + item.RoutingOrder.ToString(); actionstring = actionstring + "," + item.SelectedAction.ToString(); selectedsortorder = selectedsortorder + "," + item.SortOrder.ToString(); selectedRecipientType = selectedRecipientType + "," + item.RecipientType; } if (item.SelectedAction == 2) { signinofficecount = signinofficecount + 1; signinoffice = true; } } } if ((bool)chkmerge.IsChecked) { mergesurcharge = "1"; } else { mergesurcharge = "0"; } if ((bool)chkinclusion.IsChecked) { includestd = "1"; } else { includestd = "0"; } #region simple validation and warning message of UI if (listd.Count < 1) { MessageBox.Show("Please select at least one of the document."); BusyIndicator1.IsBusy = false; return; } if (methodid == "0") { if (selectedrecipientsname == "") { MessageBox.Show("Please select at least one of the customer recipient."); BusyIndicator1.IsBusy = false; return; } if (actionstring.Contains("0")) { MessageBox.Show("Not all the recipients has the right action."); BusyIndicator1.IsBusy = false; return; } if (customerdocumentsentcount > 0 && listd[0].VersionType.ToUpper().Contains("CUSTOMER")) // only allow one of the 3 customer copy sent to customer at a time { MessageBox.Show("A copy of " + customerdocumentname + " has been sent for signing. Please void the document first then send this copy."); BusyIndicator1.IsBusy = false; return; } if (signinoffice) { if (!ValidateSignInOffice(out errormessage)) { MessageBox.Show(errormessage); BusyIndicator1.IsBusy = false; return; } } else { if (!ValidateSginRemote(listd[0], methodid, out errormessage)) { MessageBox.Show(errormessage); BusyIndicator1.IsBusy = false; return; } } } else if (methodid == "1")// void { if (txtvoidreason.Text.Trim() == "") { MessageBox.Show("Please enter void reason."); BusyIndicator1.IsBusy = false; return; } if (listd[0].Status.ToUpper().Contains("VOIDED") || listd[0].Status.ToUpper().Contains("COMPLETED")) { MessageBox.Show("Can NOT void envelope in status Void or Completed."); BusyIndicator1.IsBusy = false; return; } } if (txtsubject.Text.Trim() == "") { MessageBox.Show("Email subject can NOT be blank."); BusyIndicator1.IsBusy = false; return; } if (txtbody.Text.Trim() == "") { MessageBox.Show("Email body can NOT be blank."); BusyIndicator1.IsBusy = false; return; } #endregion #region validate in database for further business rule if (methodid == "0") { RetailSystemClient mrsClient = new RetailSystemClient(); mrsClient = new RetailSystemClient(); mrsClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(Internal.Utilities.GetMetriconRetailSystemWcfClientEndpointUrl()); mrsClient.DocuSign_ValidateSignerAndDocuemntCompleted += delegate(object o, DocuSign_ValidateSignerAndDocuemntCompletedEventArgs es) { if (es.Error == null) { if (es.Result.ToUpper() == "OK") { Processing(signinoffice, listd, selecteddoctype, includestd, mergesurcharge, selectedrecipientsname, selectedrecipientsemail, selectedOrder, actionstring, selectedsortorder); } else { RadWindow.Alert(es.Result); BusyIndicator1.IsBusy = false; return; } } }; mrsClient.DocuSign_ValidateSignerAndDocuemntAsync(_estimateid, _revisionnumber, selectedrecipientsname, selectedRecipientType, actionstring); } else // void envelope { Processing(false, listd, selecteddoctype, includestd, mergesurcharge, selectedrecipientsname, selectedrecipientsemail, selectedOrder, actionstring, selectedsortorder); } #endregion }
private DocumentAttributes GetDocumentAttributes(T model) { var doc = new DocumentAttributes(); var type = model.GetType(); var properties = type.FindProperties(); var typeOf = type.GetCustomAttribute <TypeOfAttribute>(); if (typeOf == null) { doc.TypeOf = type.Name; } else { doc.TypeOf = typeOf.Name; if (String.IsNullOrWhiteSpace(doc.TypeOf)) { doc.TypeOf = type.Name; } } foreach (PropertyInfo property in properties) { #region Requried - throw exception.. var requried = property.GetAttribute <RequriedAttribute>(); if (requried != null) { requried.Name = property.Name; requried.HasValue = property.GetValue(model, null) != null; if (!requried.HasValue) { throw new ArgumentNullException(requried.Name); } } #endregion #region PrimaryOf set.. var primary = property.GetAttribute <PrimaryAttribute>(); if (primary != null) { var primaryValue = property.GetValue(model, null); var info = Engine.GetTypeOfDocumentInfo(doc.TypeOf, primaryValue, property.PropertyType); doc.PrimaryOf = info.PrimaryOf.ToString(); doc.CacheOf = Engine.Cache.CacheOfDoc(doc.TypeOf, doc.PrimaryOf); doc.Partition = info.Partition; doc.Exists = info.Exists; if (!info.Exists) { property.SetValue(model, Convert.ChangeType(info.PrimaryOf, property.PropertyType)); } continue; } #endregion #region Add keyOfList items.. var keyOf = property.GetAttribute <KeyOfAttribute>(); if (keyOf != null) { TypeCode typeCode = Type.GetTypeCode(property.PropertyType); try { var value = property.GetValue(model, null); if (value != null) { if (property.PropertyType.IsArray) { var list = value as string[]; foreach (var item in list) { doc.KeyOfValues.Add(item.ToLowerInvariant()); } } else { doc.KeyOfValues.Add(value.ToString().ToLowerInvariant()); } } } catch { throw new Exception($"Property {property.Name} KeyOf Unsupported Type {typeCode}"); } } #endregion #region Add Ignore prop list var ignore = property.GetAttribute <IgnoreAttribute>(); if (ignore != null) { ignore.Name = property.Name; doc.Ignored.Add(ignore); } #endregion #region WorkOf set var workOf = property.GetAttribute <WorkOfAttribute>(); if (workOf != null) { var value = property.GetValue(model, null); if (value != null) { doc.WorkOf = value.ToString(); } else { doc.WorkOf = "0"; } } #endregion #region UserOf set var userOf = property.GetAttribute <UserOfAttribute>(); if (userOf != null) { var value = property.GetValue(model, null); if (value != null) { doc.UserOf = value.ToString(); } else { doc.UserOf = "0"; } } #endregion } return(doc); }