Exemplo n.º 1
0
        //public static bool Contains(this string source, string toCheck, StringComparison comp)
        //{
        //    Contract.Requires(source != null);

        //    return source.IndexOf(toCheck, comp) >= 0;
        //}

        public static string GetCommentLegalLabel(DDLFieldOfCommentLegal commentLegalField, DataRow row, string fieldName, IDbDriver database)
        {
            if (commentLegalField != null)
            {
                string phaCode = row[fieldName].ToString();

                string columnName = commentLegalField.TextColumnName;
                string tableName  = commentLegalField.SourceTableName;

                Query     selectQuery = database.CreateQuery("SELECT * FROM " + tableName); // may be inefficient if called over many contacts, perhaps look at caching this table and passing it in?
                DataTable phaTable    = database.Select(selectQuery);

                foreach (DataRow phaRow in phaTable.Rows)
                {
                    string rowValue  = phaRow[0].ToString();
                    int    dashIndex = rowValue.IndexOf("-");

                    if (dashIndex >= 0 && rowValue.Length >= dashIndex + 1)
                    {
                        string rowCode  = rowValue.Substring(0, dashIndex);
                        string rowLabel = rowValue.Substring(dashIndex + 1).Trim();

                        if (rowCode.Equals(phaCode, StringComparison.OrdinalIgnoreCase))
                        {
                            return(rowLabel);
                        }
                    }
                }
            }

            return(String.Empty);
        }
 /// <summary>
 /// Constructor for the class
 /// </summary>
 /// <param name="frm">The parent form</param>
 /// <param name="field">The fied to be edited</param>
 public CommentLegalFieldDefinition(MainForm frm, DDLFieldOfCommentLegal field)
     : base(frm)
 {
     InitializeComponent();
     this.mode  = FormMode.Edit;
     this.field = field;
     this.page  = field.Page;
     LoadFormData();
 }
Exemplo n.º 3
0
        /// <summary>
        /// Constructor for the Comment Legal dialog
        /// </summary>
        /// <param name="field">The comment legal field</param>
        /// <param name="currentPage">The current page</param>
        public CommentLegalDialog(RenderableField field, Page currentPage)
            : base(field, currentPage)
        {
            InitializeComponent();
            page = currentPage;
            DDLFieldOfCommentLegal ddlField = (DDLFieldOfCommentLegal)field;

            codeTable = ddlField.GetSourceData();
            //if (dgCodes.AllowSorting)
            //{
            //    ddlField.ShouldSort = true;
            //}
            //else
            //{
            //    ddlField.ShouldSort = false;
            //}

            dgCodes.DataSource = codeTable;
            sourceTableName    = codeTable.TableName;
            textColumnName     = fieldName;
            //dgCodes.AllowSorting = true;
        }