/// <summary> /// /// </summary> /// <param name="xsd_ns"></param> /// <param name="xsd_file_path"></param> public void setupCustomFields(string xsd_ns, string xsd_file_path) { try { ValidationRuleEngine.Configuration.Attribute customVariable = new ValidationRuleEngine.Configuration.Attribute(); customVariable.enabled = true; customVariable.name = Constants.XsdValidator_CustomFields.xsd_ns; customVariable.path = ""; customVariable.value = xsd_ns; customVariable.is_rectifiable = false; this.LocalAttributes.Add(customVariable); customVariable = new ValidationRuleEngine.Configuration.Attribute(); customVariable.enabled = true; customVariable.name = Constants.XsdValidator_CustomFields.xsd_file_path; customVariable.path = ""; customVariable.value = xsd_file_path; customVariable.is_rectifiable = false; this.LocalAttributes.Add(customVariable); } catch (Exception ex) { Logger.Instance.GetLogInstance().Error(JsonConvert.SerializeObject(ex)); } }
/// <summary> /// /// </summary> /// <param name="ClientCode"></param> /// <param name="CompanyCode"></param> /// <param name="WarehouseCode"></param> /// <param name="OrderNumber"></param> /// <param name="OrderDate"></param> /// <param name="DocumentType"></param> public void setupMandatoryFields(string ClientCode, string CompanyCode, string WarehouseCode, string OrderNumber, string OrderDate, string DocumentType) { try { this.varDocumentType = DocumentType; this.globalAttributesCopy.Clear(); ValidationRuleEngine.Configuration.Attribute customVariable = new ValidationRuleEngine.Configuration.Attribute(); this.clientCode = ClientCode; customVariable.enabled = true; customVariable.name = Constants.MandatoryField_NameTags.ClientCode; customVariable.path = ""; customVariable.value = this.clientCode; customVariable.is_rectifiable = false; this.globalAttributesCopy.Add(customVariable); customVariable = new ValidationRuleEngine.Configuration.Attribute(); this.companyCode = CompanyCode; customVariable.enabled = true; customVariable.name = Constants.MandatoryField_NameTags.CompanyCode; customVariable.path = ""; customVariable.value = this.companyCode; customVariable.is_rectifiable = false; this.globalAttributesCopy.Add(customVariable); customVariable = new ValidationRuleEngine.Configuration.Attribute(); this.warehouseCode = WarehouseCode; customVariable.enabled = true; customVariable.name = Constants.MandatoryField_NameTags.WarehouseCode; customVariable.path = ""; customVariable.value = this.warehouseCode; customVariable.is_rectifiable = false; this.globalAttributesCopy.Add(customVariable); customVariable = new ValidationRuleEngine.Configuration.Attribute(); this.orderNumber = OrderNumber; customVariable.enabled = true; customVariable.name = Constants.MandatoryField_NameTags.OrderNumber; customVariable.path = ""; customVariable.value = this.orderNumber; customVariable.is_rectifiable = false; this.globalAttributesCopy.Add(customVariable); customVariable = new ValidationRuleEngine.Configuration.Attribute(); this.orderDate = (this.globalAttributesCopy.Where(field => field.name == Constants.MandatoryField_NameTags.OrderDate).Count() == 0) ? DateTime.Now : DateTime.ParseExact(this.globalAttributesCopy .Where(field => field.name == Constants.MandatoryField_NameTags.OrderDate) .First <ValidationRuleEngine.Configuration.Attribute>().value, "yyyyMMdd", CultureInfo.InvariantCulture); customVariable.enabled = true; customVariable.name = Constants.MandatoryField_NameTags.OrderDate; customVariable.path = ""; customVariable.value = this.orderDate.ToShortDateString(); customVariable.is_rectifiable = false; this.globalAttributesCopy.Add(customVariable); } catch (Exception ex) { Logger.Instance.GetLogInstance().Error(JsonConvert.SerializeObject(ex)); } }