public void AddFieldValidation(ValidationInsertRequest obj)
        {
            FileControl       filectr     = FORIS.Interbilling.NTS.Mediation.Configurations.Configuration.GetNotCashedConfiguration <FileControl>();
            bool              exist       = filectr.FieldsValidations.Exists(p => p.FileType == obj.Platform);
            List <Validation> validations = new List <Validation>();

            if (exist)
            {
                validations = filectr.FieldsValidations.Find(p => p.FileType == obj.Platform).Validations;
            }

            Validation validation = new Validation();

            //TextBox txtInputField = gvFileControl.FooterRow.FindControl("TextBox1") as TextBox;
            //DropDownList ddlValidationRule = (DropDownList)gvFileControl.FooterRow.FindControl("DropDownList2");
            //TextBox txtDateFrom = gvFileControl.FooterRow.FindControl("TextBox3") as TextBox;
            //TextBox txtDateTo = gvFileControl.FooterRow.FindControl("TextBox4") as TextBox;
            //TextBox txtValues = gvFileControl.FooterRow.FindControl("TextBox5") as TextBox;
            //DropDownList ddlOutputFileType = (DropDownList)gvFileControl.FooterRow.FindControl("DropDownList6");

            validation.InputField     = obj.InputField;
            validation.DateFrom       = obj.DateFrom;
            validation.DateTo         = obj.DateTo;
            validation.ValidationRule = (ValidationRule)Enum.Parse(typeof(ValidationRule), obj.ValidationRule.ToString());
            validation.OutputFileType = (OutputFileType)Enum.Parse(typeof(OutputFileType), obj.OutputFileType.ToString());

            string normValues = obj.FieldValues;

            if (obj.FieldValues.ToString() != "")
            {
                List <string> listVal = new List <string>();

                if (normValues.Substring(normValues.Length - 1, 1) == ";")
                {
                    normValues = normValues.Remove(normValues.Length - 1);
                }
                string[] val = normValues.Split(';');
                for (int i = 0; i < val.Length; i++)
                {
                    listVal.Add(val[i]);
                }
                validation.FieldValues = listVal;
            }
            validations.Add(validation);
            if (!exist)
            {
                List <FieldsValidation> list             = filectr.FieldsValidations;
                FieldsValidation        fieldsValidation = new FieldsValidation();
                fieldsValidation.Validations = validations;
                fieldsValidation.FileType    = obj.OutputFileType.ToString();
                list.Add(fieldsValidation);
            }

            FORIS.Interbilling.NTS.Mediation.Configurations.Configuration.SaveConfiguration(filectr.GetType(), filectr);
        }
示例#2
0
 public void AddFieldValidation(ValidationInsertRequest obj)
 {
     _configurationService.AddFieldValidation(obj);
 }