public void jsonFormatTable(IUimDataContext dataContext, ArrayList prelistTable) { ArrayList listRow = new ArrayList(); foreach (object table in prelistTable) { //MessageBox.Show("START FOR LOOP TABLE"); IUimTableSectionContext tablecontext = dataContext.FindTableSection(table.ToString()); // MessageBox.Show("TABLE NAME:" +table.ToString()); // MessageBox.Show("Count Row:" +tablecontext.RowCount.ToString()); string[] column = tablecontext.GetFieldNames(); foreach (string c in column) { //MessageBox.Show("START FOR COLUMN"); //MessageBox.Show("TABLE:"+table.ToString()+ "COLUMN :"+c); for (int i = 0; i < tablecontext.RowCount; i++) { IUimFieldDataContext datafield = tablecontext.GetFieldAt(i, c); string value = datafield.ValueAsString; listRow.Add(value); } string jsonformat = JsonConvert.SerializeObject(listRow); listRow.Clear(); string hname = c.Substring(2); hiddenfield = dataContext.FindFieldDataContext(hname); hiddenfield.SetValue(jsonformat); //MessageBox.Show("TABLE NAME =" +table.ToString()); //MessageBox.Show("Set Field Hidden =" + hname); //MessageBox.Show("VALUE =" +jsonformat); } } }
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()); } }
public void InsertRow(IUimTableSectionContext tableContext, int rowIndex) { string fname = tableContext.GetFieldNames()[0]; //MessageBox.Show("START Insert row fname = "+fname ); IUimFieldDataContext x = tableContext.GetFieldAt(rowIndex, fname); x.SetValue(wform.fundName); wform.fundName = string.Empty; }
/// <summary> /// /// </summary> /// <param name="tableContext"></param> /// <param name="rowIndex"></param> public void InsertRow(IUimTableSectionContext tableContext, int rowIndex) { try { string fname = tableContext.GetFieldNames()[0]; //MessageBox.Show("START Insert row fname = "+fname ); IUimFieldDataContext x = tableContext.GetFieldAt(rowIndex, fname); x.SetValue(wform.fundName); wform.fundName = string.Empty; } catch (Exception e) { string error = e.StackTrace.ToString(); } }