Example #1
0
    protected void btnShowField_Click(object sender, EventArgs e)
    {
        var pdfPath   = Path.Combine(Server.MapPath("~/Templates"), ddlPDFs.SelectedValue);
        var fieldInfo = new List <string>();

        var reader     = new PdfReader(pdfPath);
        var formFields = reader.AcroFields;

        foreach (DictionaryEntry entry in formFields.Fields)
        {
            var formFieldType = FieldsType.GetType(formFields.GetFieldType(entry.Key.ToString()));
            if (formFieldType is CheckBoxesType)
            {
                fieldInfo.Add(string.Format("{0} - {1} - Export Value; {2}",
                                            entry.Key,
                                            formFieldType, AssociatesType.GetExportValue(entry.Value as AcroFields.Item)));
            }
            else
            {
                fieldInfo.Add(string.Format("{0} - {1}", entry.Key, formFieldType));
            }
        }
        reader.Close();
        blFields.DataSource = fieldInfo;
        blFields.DataBind();
    }
Example #2
0
 public AutoProcedure(string sqlExpression, string[] fields, FieldsType fieldsType, bool isAsync) : base()
 {
     sql             = sqlExpression;
     this.fields     = fields;
     this.fieldsType = fieldsType;
     this.IsAsync    = isAsync;
 }
Example #3
0
 /// <summary>
 /// 执行 update 操作
 /// </summary>
 /// <param name="updateExpression">执行 update 操作的sql语句</param>
 /// <param name="fields">执行 update 操作时必须排除的字段名称</param>
 /// <param name="fieldsType">指示字段名称集合类型是 Exclude(排除) 或 Contain(包含), 默认为 Exclude</param>
 /// <param name="sqlExecType">sql 表达式执行类型</param>
 public AutoUpdate(string updateExpression, string[] fields, FieldsType fieldsType, DataOptType sqlExecType) : base()
 {
     sql              = updateExpression;
     this.fields      = fields;
     this.fieldsType  = fieldsType;
     this.sqlExecType = sqlExecType;
 }
Example #4
0
 /// <summary>
 /// 执行 update 操作
 /// </summary>
 /// <param name="updateExpression">执行 update 操作的sql语句</param>
 /// <param name="fields">执行 update 操作时必须排除的字段名称</param>
 /// <param name="fieldsType">指示字段名称集合类型是 Exclude(排除) 或 Contain(包含), 默认为 Exclude</param>
 /// <param name="EnabledBuffer">是否启用缓存机制, 默认为 false(不启用)</param>
 public AutoUpdate(string updateExpression, string[] fields, FieldsType fieldsType, bool EnabledBuffer) : base()
 {
     sql                = updateExpression;
     this.fields        = fields;
     this.fieldsType    = fieldsType;
     this.EnabledBuffer = EnabledBuffer;
 }
Example #5
0
 /// <summary>
 /// 执行 insert 操作
 /// </summary>
 /// <param name="insertExpression">执行 insert 操作的sql语句</param>
 /// <param name="fields">执行 insert 操作时必须排除\包含的字段名称</param>
 /// <param name="fieldsType">指示字段名称集合类型是 Exclude(排除) 或 Contain(包含), 默认为 Exclude</param>
 /// <param name="sqlExecType">sql 表达式执行类型</param>
 public AutoInsert(string insertExpression, string[] fields, FieldsType fieldsType, DataOptType sqlExecType) : base()
 {
     sql              = insertExpression;
     this.fields      = fields;
     this.fieldsType  = fieldsType;
     this.sqlExecType = sqlExecType;
 }
Example #6
0
 /// <summary>
 /// 执行 insert 操作
 /// </summary>
 /// <param name="insertExpression">执行 insert 操作的sql语句</param>
 /// <param name="fields">执行 insert 操作时必须排除\包含的字段名称</param>
 /// <param name="fieldsType">指示字段名称集合类型是 Exclude(排除) 或 Contain(包含), 默认为 Exclude</param>
 /// <param name="EnabledBuffer">是否启用缓存机制, 默认为 false(不启用)</param>
 public AutoInsert(string insertExpression, string[] fields, FieldsType fieldsType, bool EnabledBuffer) : base()
 {
     sql                = insertExpression;
     this.fields        = fields;
     this.fieldsType    = fieldsType;
     this.EnabledBuffer = EnabledBuffer;
 }
Example #7
0
 public AutoProcedure(string sqlExpression, string[] fields, FieldsType fieldsType, bool isAsync, int msInterval) : base()
 {
     sql             = sqlExpression;
     this.fields     = fields;
     this.fieldsType = fieldsType;
     this.IsAsync    = isAsync;
     MsInterval      = msInterval;
 }
Example #8
0
 public static void AddFields(FieldsType pFields, string[] pFieldNames)
 {
     foreach (string pName in pFieldNames)
     {
         FieldType vField = new FieldType(pName);
         vField.DataField = vField.Name;
         pFields.Add(vField);
     }
 }
        private FieldsType CreateFields()
        {
            FieldsType fields = new FieldsType();

            fields.Field = new FieldType[m_allFields.Count];
            for (int i = 0; i < m_allFields.Count; i++)
            {
                fields.Field[i] = CreateField(m_allFields[i]);
            }

            return(fields);
        }
Example #10
0
        public static void AddExecutionDetailsToLog(eExecutionPhase objExecutionPhase, string objType, string objName, object obj)
        {
            if (Reporter.AppLoggingLevel == eAppReporterLoggingLevel.Debug || Reporter.ReportAllAlsoToConsole == true)//needed for not derlling the objects if not needed to be reported
            {
                string prefix = string.Empty;

                StringBuilder stringBuilder = new StringBuilder();
                switch (objExecutionPhase)
                {
                case eExecutionPhase.Start:
                    stringBuilder.Append("--> ").Append(objType + " Execution Started");
                    break;

                case eExecutionPhase.End:
                    stringBuilder.Append("<-- ").Append(objType + " Execution Ended");
                    break;
                }
                stringBuilder.Append(": '").Append(objName).Append("'").AppendLine();

                //get the execution fields and their values
                if (objExecutionPhase == eExecutionPhase.End && obj != null)
                {
                    stringBuilder.Append("Details:").AppendLine();
                    try
                    {
                        PropertyInfo[] props = obj.GetType().GetProperties();
                        foreach (PropertyInfo prop in props)
                        {
                            try
                            {
                                FieldParamsFieldType attr = ((FieldParamsFieldType)prop.GetCustomAttribute(typeof(FieldParamsFieldType)));
                                if (attr == null)
                                {
                                    continue;
                                }
                                FieldsType ftype = attr.FieldType;
                                if (ftype == FieldsType.Field)
                                {
                                    string propName     = prop.Name;
                                    string propFullName = ((FieldParamsNameCaption)prop.GetCustomAttribute(typeof(FieldParamsNameCaption))).NameCaption;
                                    object propVal      = prop.GetValue(obj);//obj.GetType().GetProperty(propName, BindingFlags.Public | BindingFlags.Instance).GetValue(obj).ToString();
                                    string propValue;
                                    if (propVal != null)
                                    {
                                        propValue = propVal.ToString();
                                    }
                                    else
                                    {
                                        propValue = "";
                                    }

                                    stringBuilder.Append(propFullName).Append("= ").Append(propValue).AppendLine();
                                }
                            }
                            catch (Exception) { }
                        }
                    }
                    catch (Exception) { }
                }

                Reporter.ToLog(eLogLevel.DEBUG, stringBuilder.ToString());
            }
        }
        public static void AddExecutionDetailsToLog(eExecutionPhase objExecutionPhase, string objType, string objName, object obj)
        {
            if (WorkSpace.Instance != null && WorkSpace.Instance.RunningInExecutionMode || Reporter.AppLoggingLevel == eAppReporterLoggingLevel.Debug || Reporter.ReportAllAlsoToConsole == true)//needed for not derlling the objects if not needed to be reported
            {
                string prefix = string.Empty;

                StringBuilder stringBuilder = new StringBuilder();
                switch (objExecutionPhase)
                {
                case eExecutionPhase.Start:
                    stringBuilder.Append("--> ").Append(objType + " Execution Started");
                    break;

                case eExecutionPhase.End:
                    stringBuilder.Append("<-- ").Append(objType + " Execution Ended");
                    break;
                }
                stringBuilder.Append(": '").Append(objName).Append("'").AppendLine();

                //get the execution fields and their values
                if (objExecutionPhase == eExecutionPhase.End && obj != null)
                {
                    stringBuilder.Append("Details:").AppendLine();
                    try
                    {
                        PropertyInfo[] props = obj.GetType().GetProperties();
                        foreach (PropertyInfo prop in props)
                        {
                            try
                            {
                                FieldParamsFieldType attr = ((FieldParamsFieldType)prop.GetCustomAttribute(typeof(FieldParamsFieldType)));
                                if (attr == null)
                                {
                                    continue;
                                }
                                FieldsType ftype = attr.FieldType;
                                if (ftype == FieldsType.Field)
                                {
                                    string propName     = prop.Name;
                                    string propFullName = ((FieldParamsNameCaption)prop.GetCustomAttribute(typeof(FieldParamsNameCaption))).NameCaption;
                                    object propValueobj = prop.GetValue(obj);//obj.GetType().GetProperty(propName, BindingFlags.Public | BindingFlags.Instance).GetValue(obj).ToString();
                                    string propValueStr = "";
                                    if (propValueobj != null)
                                    {
                                        //special case for execution time convertion from UTC format
                                        if (Attribute.IsDefined(prop, typeof(UsingUTCTimeFormat)))
                                        {
                                            try
                                            {
                                                propValueStr = ((DateTime)propValueobj).ToLocalTime().ToString("dd-MMM-yy HH:mm:ss");
                                            }
                                            catch
                                            {
                                                propValueStr = propValueobj.ToString();
                                            }
                                        }
                                        else
                                        {
                                            propValueStr = propValueobj.ToString();
                                        }
                                    }

                                    stringBuilder.Append(propFullName).Append("= ").Append(propValueStr).AppendLine();
                                }
                            }
                            catch (Exception ex)
                            {
                            }
                        }
                    }
                    catch (Exception) { }
                }

                if (WorkSpace.Instance.RunningInExecutionMode || Reporter.ReportAllAlsoToConsole == true)
                {
                    Reporter.ToLog(eLogLevel.INFO, stringBuilder.ToString());
                }
                else
                {
                    Reporter.ToLog(eLogLevel.DEBUG, stringBuilder.ToString());
                }
            }
        }
Example #12
0
 public FieldParamsFieldType(FieldsType FieldType)
 {
     this.FieldType = FieldType;
 }
Example #13
0
        public void GetSegmentFromSql(MethodInformation method, Type dataType, ref string insertFields, ref string insertParas, ref string updateSets, ref string procParas)
        {
            string dbTag         = DJTools.GetParaTagByDbDialect(DataAdapter.dbDialect);
            string insertFields1 = "";
            string insertParas1  = "";
            string updateSets1   = "";
            string procParas1    = "";

            bool mbool = false;

            string[]   _fields    = method.fields;
            FieldsType fieldsType = method.fieldsType;

            _fields = null == _fields ? new string[] { } : _fields;

            Action <string, string, string> action = (fn1, fn2, fn_lower) =>
            {
                mbool = true;
                foreach (string e in _fields)
                {
                    if (e.ToLower().Equals(fn_lower))
                    {
                        mbool = false;
                        break;
                    }
                }

                if (FieldsType.Contain == fieldsType && 0 < _fields.Length)
                {
                    mbool = !mbool;
                }

                if (mbool)
                {
                    fn2            = string.IsNullOrEmpty(fn2) ? fn1 : fn2;
                    insertFields1 += "," + fn2;
                    insertParas1  += "," + dbTag + fn1;
                    updateSets1   += "," + fn2 + "=" + dbTag + fn1;
                    procParas1    += "," + procParaSign + fn2 + "=" + dbTag + fn1;
                }
            };

            string fn   = "";
            string fn_2 = "";

            if (typeof(DataEntity <DataElement>) == dataType || typeof(List <DataEntity <DataElement> >) == dataType)
            {
                object paraVal = null;
                if (typeof(List <DataEntity <DataElement> >) == dataType)
                {
                    List <DataEntity <DataElement> > dataElements1 = (List <DataEntity <DataElement> >)method.paraList[0].ParaValue;
                    if (0 < dataElements1.Count)
                    {
                        paraVal = dataElements1[0];
                    }
                }
                else
                {
                    if (null != method.paraList[0].ParaValue)
                    {
                        paraVal = (DataEntity <DataElement>)method.paraList[0].ParaValue;
                    }
                }

                if (null == paraVal)
                {
                    paraVal = new DataEntity <DataElement>();
                }
                DataEntity <DataElement> dataElements = (DataEntity <DataElement>)paraVal;
                foreach (DataElement item in dataElements)
                {
                    if (!string.IsNullOrEmpty(item.fieldNameOfSourceTable))
                    {
                        continue;
                    }
                    fn = item.name.ToLower();
                    action(item.name, fn_2, fn);
                }
            }
            else if (null != dataType.GetInterface("IDictionary"))
            {
                //
            }
            else
            {
                Type t = dataType;
                if (typeof(Collections.IEnumerable) == dataType.GetInterface("IEnumerable"))
                {
                    Type[] types = dataType.GetGenericArguments();
                    if (null != dataType.GetInterface("IList"))
                    {
                        t = types[0];
                    }
                    else if (dataType.IsArray)
                    {
                        t = dataType.GetElementType();
                    }
                }
                PropertyInfo[] piArr = t.GetProperties(BindingFlags.Instance | BindingFlags.Public);
                foreach (PropertyInfo item in piArr)
                {
                    fn_2 = FieldMapping.GetFieldMapping(item);
                    fn   = item.Name.ToLower();
                    action(item.Name, fn_2, fn);
                }
            }

            if (!string.IsNullOrEmpty(insertFields1))
            {
                insertFields1 = insertFields1.Substring(1);
                insertParas1  = insertParas1.Substring(1);
                updateSets1   = updateSets1.Substring(1);
                procParas1    = procParas1.Substring(1);
            }

            insertFields = insertFields1;
            insertParas  = insertParas1;
            updateSets   = updateSets1;
            procParas    = procParas1;
        }
Example #14
0
 /// <summary>
 /// 执行 procedure 操作
 /// </summary>
 /// <param name="sqlExpression">执行 procedure 操作的sql语句</param>
 /// <param name="fields">执行 procedure 操作时必须排除的字段名称</param>
 /// <param name="fieldsType">指示字段名称集合类型是 Exclude(排除) 或 Contain(包含), 默认为 Exclude</param>
 public AutoProcedure(string sqlExpression, string[] fields, FieldsType fieldsType) : base()
 {
     sql             = sqlExpression;
     this.fields     = fields;
     this.fieldsType = fieldsType;
 }
Example #15
0
 /// <summary>
 /// 执行 update 操作
 /// </summary>
 /// <param name="updateExpression">执行 update 操作的sql语句</param>
 /// <param name="fields">执行 update 操作时必须排除的字段名称</param>
 /// <param name="fieldsType">指示字段名称集合类型是 Exclude(排除) 或 Contain(包含), 默认为 Exclude</param>
 public AutoUpdate(string updateExpression, string[] fields, FieldsType fieldsType) : base()
 {
     sql             = updateExpression;
     this.fields     = fields;
     this.fieldsType = fieldsType;
 }
Example #16
0
 /// <summary>
 /// 执行 insert 操作
 /// </summary>
 /// <param name="insertExpression">执行 insert 操作的sql语句</param>
 /// <param name="fields">执行 insert 操作时必须排除的字段名称</param>
 /// <param name="fieldsType">指示字段名称集合类型是 Exclude(排除) 或 Contain(包含), 默认为 Exclude</param>
 public AutoInsert(string insertExpression, string[] fields, FieldsType fieldsType) : base()
 {
     sql             = insertExpression;
     this.fields     = fields;
     this.fieldsType = fieldsType;
 }