Example #1
0
        public void ButtonClick(IUimFormControlContext controlContext)
        {
            try
            {
                /// connection DB
                ScriptMain      m           = new ScriptMain();
                IUimDataContext datacontext = controlContext.ParentForm.UimDataContext;
                //set fund name

                m.restFundName(datacontext);
                //dt_grid = m.setTEST();

                wform.ShowDialog();
                btnname = controlContext.ControlName.Remove(0, 4);
                IUimTableSectionContext table = controlContext.ParentForm.UimDataContext.FindTableSection(btnname);
                int row = table.RowCount;

                // Check click ok or cancel
                if (wform.flag_btn)
                {
                    if (row == 0)
                    {
                        // MessageBox.Show("STAGE 1");
                        table.InsertNewRow(0);
                        InsertRow(table, row);
                    }
                    else
                    {
                        if (flag_rowSelect)
                        {
                            // MessageBox.Show("STAGE 2");

                            if (row == rowSelect)
                            {
                                // MessageBox.Show("STAGE 2.1");
                                table.InsertNewRow(row);
                            }
                            InsertRow(table, rowSelect);
                        }
                        else
                        {
                            // MessageBox.Show("STAGE 3");
                            table.InsertNewRow(row);
                            InsertRow(table, row);
                        }
                    }
                }

                wform.fundName = string.Empty;
                flag_rowSelect = false;
            }
            catch (Exception e)
            {
                string error = e.StackTrace;
                MessageBox.Show(e.ToString());
            }
        }