Esempio n. 1
0
        public void ShowLookupForm()
        {
            FrmLookup_LookupHide(null, null);

            frmLookup = new LookupForm();

            switch (lookupColName)
            {
            case MASTERTABLESITEMS.DATATYPE:
            {
                frmLookup.LookupColNames      = new string[] { MASTERTABLESITEMS.DATATYPE };
                frmLookup.SelectedPkValue     = editgrid[MASTERTABLESITEMS.DATATYPE, lookupRow].Value;
                frmLookup.AllowNewEntry       = true;
                frmLookup.AllowEmptySelection = true;

                frmLookup.LookupList = Datatypes.Lookups();
                frmLookup.LoadLookupList();
            }
            break;

            case MASTERTABLESITEMS.INPUTTYPE:
            {
                frmLookup.LookupColNames      = new string[] { MASTERTABLESITEMS.INPUTTYPE };
                frmLookup.SelectedPkValue     = editgrid[MASTERTABLESITEMS.INPUTTYPE, lookupRow].Value;
                frmLookup.AllowNewEntry       = true;
                frmLookup.AllowEmptySelection = true;

                frmLookup.LookupList = AutoCode.InputType();
                frmLookup.LoadLookupList();
            }
            break;

            case MASTERTABLESITEMS.WIDTH:
            {
                frmLookup.LookupColNames      = new string[] { MASTERTABLESITEMS.WIDTH };
                frmLookup.SelectedPkValue     = editgrid[MASTERTABLESITEMS.WIDTH, lookupRow].Value;
                frmLookup.AllowNewEntry       = true;
                frmLookup.AllowEmptySelection = true;

                frmLookup.LookupList = AutoCode.Width();
                frmLookup.LoadLookupList();
            }
            break;

            case MASTERTABLESITEMS.HEIGHT:
            {
                frmLookup.LookupColNames      = new string[] { MASTERTABLESITEMS.HEIGHT };
                frmLookup.SelectedPkValue     = editgrid[MASTERTABLESITEMS.HEIGHT, lookupRow].Value;
                frmLookup.AllowNewEntry       = true;
                frmLookup.AllowEmptySelection = true;

                frmLookup.LookupList = AutoCode.Height();
                frmLookup.LoadLookupList();
            }
            break;

            case MASTERTABLESITEMS.CPOSITION:
            {
                frmLookup.LookupColNames      = new string[] { MASTERTABLESITEMS.CPOSITION };
                frmLookup.SelectedPkValue     = editgrid[MASTERTABLESITEMS.CPOSITION, lookupRow].Value;
                frmLookup.AllowNewEntry       = true;
                frmLookup.AllowEmptySelection = true;

                frmLookup.LookupList = AutoCode.Cposition();
                frmLookup.LoadLookupList();
            }
            break;

            case MASTERTABLESITEMS.RPOSITION:
            {
                frmLookup.LookupColNames      = new string[] { MASTERTABLESITEMS.RPOSITION };
                frmLookup.SelectedPkValue     = editgrid[MASTERTABLESITEMS.RPOSITION, lookupRow].Value;
                frmLookup.AllowNewEntry       = true;
                frmLookup.AllowEmptySelection = true;

                frmLookup.LookupList = AutoCode.Rposition();
                frmLookup.LoadLookupList();
            }
            break;

            case MASTERTABLESITEMS.ALIGNTO:
            {
                frmLookup.LookupColNames      = new string[] { MASTERTABLESITEMS.ALIGNTO };
                frmLookup.SelectedPkValue     = editgrid[MASTERTABLESITEMS.ALIGNTO, lookupRow].Value;
                frmLookup.AllowNewEntry       = true;
                frmLookup.AllowEmptySelection = true;

                frmLookup.LookupList = AutoCode.Alignto();

                frmLookup.LoadLookupList();
            }
            break;

            case MASTERTABLESITEMS.VALIDATE:
            {
                frmLookup.LookupColNames      = new string[] { MASTERTABLESITEMS.VALIDATE };
                frmLookup.SelectedPkValue     = editgrid[MASTERTABLESITEMS.VALIDATE, lookupRow].Value;
                frmLookup.AllowNewEntry       = true;
                frmLookup.AllowEmptySelection = true;

                frmLookup.LookupList = AutoCode.Validate();
                frmLookup.LoadLookupList();
            }
            break;

            case MASTERTABLESITEMS.ISDEFAULT:
            {
                frmLookup.LookupColNames      = new string[] { MASTERTABLESITEMS.ISDEFAULT };
                frmLookup.SelectedPkValue     = editgrid[MASTERTABLESITEMS.ISDEFAULT, lookupRow].Value;
                frmLookup.AllowNewEntry       = true;
                frmLookup.AllowEmptySelection = true;
                //
                frmLookup.LookupList = AutoCode.IsDefault();
                frmLookup.LoadLookupList();
            }
            break;

            case MASTERTABLESITEMS.PLACEMENT:
            {
                frmLookup.LookupColNames      = new string[] { MASTERTABLESITEMS.PLACEMENT };
                frmLookup.SelectedPkValue     = editgrid[MASTERTABLESITEMS.PLACEMENT, lookupRow].Value;
                frmLookup.AllowNewEntry       = true;
                frmLookup.AllowEmptySelection = true;
                //
                frmLookup.LookupList = AutoCode.Placement();
                frmLookup.LoadLookupList();
            }
            break;

            default:
                throw new System.Exception("'" + lookupColName + "' Not Found");
            }

            frmLookup.LookupSelected += new EventHandler(FrmLookup_LookupSelected);
            frmLookup.AfterSelection += new EventHandler(FrmLookup_AfterSelection);
            frmLookup.LookupHide     += new EventHandler(FrmLookup_LookupHide);
            frmLookup.Owner           = this.FindForm();
            ////////////
            frmLookup.Show();
            ////////////
            int vWidth     = frmLookup.GetAutoWidth();
            int vCellWidth = editgrid.Columns[lookupColName].Width;

            if (vWidth < vCellWidth)
            {
                vWidth = vCellWidth;
            }
            frmLookup.AutoFillLastColumn();
            //
            int vHeight = frmLookup.GetAutoHeight();
            //
            Rectangle screenRect = Global.GetScreenRect(editgrid);

            frmLookup.Bounds = Global.GetSnapRect(screenRect, vWidth, vHeight);
        }
Esempio n. 2
0
        public void ShowLookupForm_2()
        {
            FrmLookup_2_LookupHide(null, null);

            frmLookup = new LookupForm();

            switch (lookupColName)
            {
            case SFIELDS.DATATYPE:
            {
                frmLookup.LookupColNames      = new string[] { SFIELDS.DATATYPE };
                frmLookup.SelectedPkValue     = editgrid_2[SFIELDS.DATATYPE, lookupRow].Value;
                frmLookup.AllowNewEntry       = true;
                frmLookup.AllowEmptySelection = true;

                frmLookup.LookupList = Datatypes.Lookups();
                frmLookup.LoadLookupList();
            }
            break;

            //case SFIELDS.PKEYS:
            //    {
            //        frmLookup.LookupColNames = new string[] { SFIELDS.PKEYS };
            //        frmLookup.SelectedPkValue = editgrid_2[SFIELDS.PKEYS, lookupRow].Value;
            //        frmLookup.AllowNewEntry = true;
            //        frmLookup.AllowEmptySelection = true;

            //        frmLookup.LookupList = AutoCode.Pkeys();
            //        frmLookup.LoadLookupList();
            //    }
            //    break;

            //case SFIELDS.IFNULL:
            //    {
            //        frmLookup.LookupColNames = new string[] { SFIELDS.IFNULL };
            //        frmLookup.SelectedPkValue = editgrid_2[SFIELDS.IFNULL, lookupRow].Value;
            //        frmLookup.AllowNewEntry = true;
            //        frmLookup.AllowEmptySelection = true;

            //        frmLookup.LookupList = AutoCode.Ifnull();
            //        frmLookup.LoadLookupList();
            //    }
            //    break;

            //case SFIELDS.REFEREDTBL:
            //    {
            //        frmLookup.LookupColNames = new string[] { STABLES.STABLES_NAME, STABLES.STABLES_ID };
            //        frmLookup.SelectedPkValue = editgrid_2[SFIELDS.REFEREDTBL, lookupRow].Value;
            //        frmLookup.AllowNewEntry = true;
            //        frmLookup.AllowEmptySelection = true;

            //        frmLookup.LookupList = CStables_exten.GetforLookup(new SQLITE_DAL());

            //        frmLookup.LoadLookupList();
            //    }
            //    break;

            case SFIELDS.INPUTTYPE:
            {
                frmLookup.LookupColNames      = new string[] { SFIELDS.INPUTTYPE };
                frmLookup.SelectedPkValue     = editgrid_2[SFIELDS.INPUTTYPE, lookupRow].Value;
                frmLookup.AllowNewEntry       = true;
                frmLookup.AllowEmptySelection = true;

                frmLookup.LookupList = AutoCode.InputType();
                frmLookup.LoadLookupList();
            }
            break;

            case SFIELDS.WIDTH:
            {
                frmLookup.LookupColNames      = new string[] { SFIELDS.WIDTH };
                frmLookup.SelectedPkValue     = editgrid_2[SFIELDS.WIDTH, lookupRow].Value;
                frmLookup.AllowNewEntry       = true;
                frmLookup.AllowEmptySelection = true;

                frmLookup.LookupList = AutoCode.Width();
                frmLookup.LoadLookupList();
            }
            break;

            case SFIELDS.HEIGHT:
            {
                frmLookup.LookupColNames      = new string[] { SFIELDS.HEIGHT };
                frmLookup.SelectedPkValue     = editgrid_2[SFIELDS.HEIGHT, lookupRow].Value;
                frmLookup.AllowNewEntry       = true;
                frmLookup.AllowEmptySelection = true;

                frmLookup.LookupList = AutoCode.Height();
                frmLookup.LoadLookupList();
            }
            break;

            case SFIELDS.ALIGNTO:
            {
                frmLookup.LookupColNames      = new string[] { SFIELDS.ALIGNTO };
                frmLookup.SelectedPkValue     = editgrid_2[SFIELDS.ALIGNTO, lookupRow].Value;
                frmLookup.AllowNewEntry       = true;
                frmLookup.AllowEmptySelection = true;

                frmLookup.LookupList = AutoCode.Alignto();
                frmLookup.LoadLookupList();
            }
            break;

            case SFIELDS.VALIDATE:
            {
                frmLookup.LookupColNames      = new string[] { SFIELDS.VALIDATE };
                frmLookup.SelectedPkValue     = editgrid_2[SFIELDS.VALIDATE, lookupRow].Value;
                frmLookup.AllowNewEntry       = true;
                frmLookup.AllowEmptySelection = true;

                frmLookup.LookupList = AutoCode.Validate();
                frmLookup.LoadLookupList();
            }
            break;

            case SFIELDS.ISDEFAULT:
            {
                frmLookup.LookupColNames      = new string[] { SFIELDS.ISDEFAULT };
                frmLookup.SelectedPkValue     = editgrid_2[SFIELDS.ISDEFAULT, lookupRow].Value;
                frmLookup.AllowNewEntry       = true;
                frmLookup.AllowEmptySelection = true;
                //
                frmLookup.LookupList = AutoCode.IsDefault();
                frmLookup.LoadLookupList();
            }
            break;

            case SFIELDS.PLACEMENT:
            {
                frmLookup.LookupColNames      = new string[] { SFIELDS.PLACEMENT };
                frmLookup.SelectedPkValue     = editgrid_2[SFIELDS.PLACEMENT, lookupRow].Value;
                frmLookup.AllowNewEntry       = true;
                frmLookup.AllowEmptySelection = true;
                //
                frmLookup.LookupList = AutoCode.Placement();
                frmLookup.LoadLookupList();
            }
            break;

            default:
                throw new System.Exception("'" + lookupColName + "' Not Found");
            }

            frmLookup.LookupSelected += new EventHandler(FrmLookup_2_LookupSelected);
            frmLookup.AfterSelection += new EventHandler(FrmLookup_2_AfterSelection);
            frmLookup.LookupHide     += new EventHandler(FrmLookup_2_LookupHide);
            frmLookup.Owner           = this.FindForm();
            ////////////
            frmLookup.Show();
            ////////////
            int vWidth     = frmLookup.GetAutoWidth();
            int vCellWidth = editgrid_2.Columns[lookupColName].Width;

            if (vWidth < vCellWidth)
            {
                vWidth = vCellWidth;
            }
            frmLookup.AutoFillLastColumn();
            //
            int vHeight = frmLookup.GetAutoHeight();
            //
            Rectangle screenRect = Global.GetScreenRect(editgrid_2);

            frmLookup.Bounds = Global.GetSnapRect(screenRect, vWidth, vHeight);
        }