Ejemplo n.º 1
0
        public int RefreshFields()
        {
            if (string.IsNullOrEmpty(ViewObject.Name))
            {
                return(lvFields.Items.Count);
            }

            string         cmd = SQLStatementsClass.Instance().GetViewFields(DBReg.Version, ViewObject.Name);
            ViewFieldClass vf  = null;

            lvFields.Items.Clear();
            dgExportGrid.Rows.Clear();
            try
            {
                var con = new FbConnection(ConnectionStrings.Instance().MakeConnectionString(DBReg));
                con.Open();
                var fcmd  = new FbCommand(cmd, con);
                var dread = fcmd.ExecuteReader();
                if (dread.HasRows)
                {
                    while (dread.Read())
                    {
                        object ob = dread.GetValue(0);
                        object ob_field_position = dread.GetValue(1);

                        string fieldstr   = ob.ToString();
                        string posstr     = ob_field_position.ToString();
                        string typename   = dread.GetValue(3).ToString();
                        string typelength = dread.GetValue(4).ToString();

                        vf = new ViewFieldClass()
                        {
                            Name = fieldstr.Trim()
                        };

                        string[] obarr        = { posstr.Trim(), fieldstr.Trim(), typename.Trim(), typelength.Trim() };
                        object[] obarr_export = { posstr.Trim(), fieldstr.Trim(), true, true };

                        var lvi = new ListViewItem(obarr)
                        {
                            Tag     = vf,
                            Checked = true
                        };
                        lvFields.Items.Add(lvi);
                        dgExportGrid.Rows.Add(obarr_export);
                    }
                }
                con.Close();
            }
            catch (Exception ex)
            {
                NotifiesClass.Instance().AddToERROR(BasicClassLibrary.StaticFunctionsClass.DateTimeNowStr() + " ViewManagerForm->RefreshDependenciesFrom->" + ex.Message);
            }
            return(lvFields.Items.Count);
        }
Ejemplo n.º 2
0
 private bool ViewFieldsEqual(ViewFieldClass tcf1, ViewFieldClass tcf2)
 {
     return((tcf1.Domain.FieldType == tcf2.Domain.FieldType) && (tcf1.Domain.Length == tcf2.Domain.Length) && (tcf1.Domain.CharSet == tcf2.Domain.CharSet));
 }