public void NewGroup(ic.church_groupC obj) { var _row = fGrid.Rows.Add(); _row.Font = new Font("verdana", 10, FontStyle.Bold); _row.Cells["gp_name"].Col.Width = 220; _row.Cells["mem_cnt"].Col.Width = 100; _row.Cells["gp_name"].Value = obj.cg_name; _row.Cells["gp_name"].TextAlign = iGContentAlignment.BottomRight; _row.Cells["mem_cnt"].ValueType = typeof(int); _row.Key = obj.cg_id.ToStringNullable(); _row.AutoHeight(); _row.Cells["type_id"].Value = obj.cg_type_id; _row.Cells["mem_cnt"].Value = obj.MemberCount; _row.Tag = obj; fGrid.SortObject.Add("type_id"); fGrid.Sort(); fGrid.GroupObject.Add("type_id"); fGrid.Group(); fGrid.PerformAction(iGActions.CollapseAll); var _rw = GetGroupRow(_row, obj.cg_type_id); if (_rw != null) { _rw.Expanded = true; } fGrid.SetCurCell(obj.cg_id.ToString(), 0); fGrid.Cols.AutoWidth(); fGrid.AutoResizeCols = false; fGrid.EndUpdate(); }
private void fGrid_AfterAutoGroupRowCreated(object sender, iGAfterAutoGroupRowCreatedEventArgs e) { iGrid _grid = sender as iGrid; iGCell myGroupRowCell = _grid.RowTextCol.Cells[e.AutoGroupRowIndex]; myGroupRowCell.Row.AutoHeight(); ic.church_groupC _gp = _grid.Rows[e.GroupedRowIndex].Tag as ic.church_groupC; string _disp_str = string.Empty; if (_gp != null) { _disp_str = datam.DATA_CG_TYPES[_gp.cg_type_id].cg_type_name; } myGroupRowCell.Value = _disp_str; myGroupRowCell.AuxValue = _gp.cg_type_id; }
private void fGrid_AfterAutoGroupRowCreated(object sender, iGAfterAutoGroupRowCreatedEventArgs e) { iGrid _grid = sender as iGrid; iGCell myGroupRowCell = _grid.RowTextCol.Cells[e.AutoGroupRowIndex]; myGroupRowCell.Row.AutoHeight(); ic.church_groupC _gp = _grid.Rows[e.GroupedRowIndex].Tag as ic.church_groupC; string _disp_str = null; var _cg_type = datam.DATA_CG_TYPES[_gp.cg_type_id]; if (_gp != null) { _disp_str = _cg_type.cg_type_name; } myGroupRowCell.Value = _cg_type.is_default ? string.Format("{0} (Default)", _disp_str) : _disp_str; myGroupRowCell.AuxValue = _gp.cg_type_id; myGroupRowCell.Row.Tag = _cg_type; myGroupRowCell.Row.Key = string.Format("gp-{0}", _cg_type.cg_type_id); }
private void fGrid_CurRowChanged(object sender, EventArgs e) { //check if pastor is selected if (fGrid.CurCell == null || fGrid.CurCell.Row.Type == iGRowType.AutoGroupRow) { label1.Text = string.Empty; fGrid2.Rows.Clear(); m_cgroup = null; buttonX1.Visible = false; buttonX2.Visible = false; buttonR.Visible = false; return; } label1.Text = fGrid.CurRow.Cells[0].Value.ToStringNullable(); m_cgroup = fGrid.CurRow.Tag as ic.church_groupC; buttonX1.Visible = false; buttonX2.Visible = false; buttonR.Visible = false; LoadMainGrid2(m_cgroup); }
private void UpdateRoles(ic.church_groupC _gp) { if (_gp == null) { return; } var nlist = from k in m_LDATA[_gp.cg_id].Items.Cast <fnn.iGComboItemEX>() where k.Visible select k; ic.RoleC _role = null; List <int> _ids = new List <int>(); foreach (var k in nlist) { _role = k.Tag as ic.RoleC; if (datam.DATA_ROLES.Keys.IndexOf(_role.role_id) == -1) { k.Visible = false; continue; } k.Value = _role.role_name; k.Visible = true; _ids.Add(_role.role_id); } var new_list = from k in datam.DATA_ROLES.Values where k.gp_type == em.role_gp_typeS.church_group & k.gp_id == _gp.cg_id & _ids.IndexOf(k.role_id) == -1 select k; foreach (var r in new_list) { m_LDATA[_gp.cg_id].Items.Add(new fnn.iGComboItemEX() { Tag = r, Value = r.role_name, }); } }
public static void fill_church_groups(xing xd) { string _str = string.Empty; string _table_name = "church_group_tb"; if (DATA_CHURCH_GROUPS == null) { datam.DATA_CHURCH_GROUPS = new SortedList <int, ic.church_groupC>(); } if (wdata.TABLE_STAMP == null) { wdata.TABLE_STAMP = new SortedList <string, long>(); } if (wdata.TABLE_STAMP.IndexOfKey(_table_name) == -1) { wdata.TABLE_STAMP.Add(_table_name, 0); } bool is_new = false; bool load_all = false; var _stamp = xd.GetTimeStamp(_table_name); if (DATA_CHURCH_GROUPS.Keys.Count == 0) { _str = "select * from " + _table_name; load_all = true; } else { if (wdata.TABLE_STAMP[_table_name] == _stamp) { return; } _str = string.Format("select * from " + _table_name + " where fs_time_stamp > {0}", wdata.TABLE_STAMP[_table_name]); } wdata.TABLE_STAMP[_table_name] = _stamp; ic.church_groupC _obj = null; try { using (var _dr = xd.SelectCommand(_str)) { while (_dr.Read()) { _obj = null; if (load_all) { _obj = new ic.church_groupC(); is_new = true; } else { try { _obj = datam.DATA_CHURCH_GROUPS[_dr["cg_id"].ToInt32()]; is_new = false; } catch (Exception ex) { if (_obj == null) { _obj = new ic.church_groupC(); is_new = true; } } } if (is_new) { _obj.cg_type_id = _dr["cg_type_id"].ToInt32(); _obj.cg_id = _dr["cg_id"].ToInt32(); _obj.cg_type_id = _dr["cg_type_id"].ToInt16(); datam.DATA_CHURCH_GROUPS.Add(_obj.cg_id, _obj); } _obj.cg_name = _dr["cg_name"].ToStringNullable(); _obj.sys_account_id = _dr["sys_account_id"].ToInt32(); } _dr.Close(); _dr.Dispose(); } if (load_all) { _str = "select * from church_group_members_tb where mem_status=1"; using (var _dr = xd.SelectCommand(_str)) { while (_dr.Read()) { try { datam.DATA_MEMBER[_dr["mem_id"].ToInt32()].ChurchGroupCollection.Add(datam.DATA_CHURCH_GROUPS[_dr["cg_id"].ToInt32()]); } catch (Exception) { continue; } } _dr.Close(); _dr.Dispose(); } } } catch (VistaDB.Diagnostic.VistaDBException ex) { MessageBox.Show(ex.Message); throw new Exception("Data Loading Failed"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void LoadMainGrid2(ic.church_groupC _gp) { if (m_LDATA.Keys.IndexOf(_gp.cg_id) == -1) { m_LDATA.Add(_gp.cg_id, new iGDropDownList()); m_LDATA[_gp.cg_id] = fnn.CreateCombo(); m_LDATA[_gp.cg_id].MaxVisibleRowCount = 5; var nlist = from k in datam.DATA_ROLES.Values where k.gp_type == em.role_gp_typeS.church_group & k.gp_id == _gp.cg_id select k; foreach (var n in nlist) { m_LDATA[_gp.cg_id].Items.Add(new fnn.iGComboItemEX() { Text = n.role_name, Value = n.role_name, Tag = n }); } } m_prev_role = null; fGrid2.Cols["_pic"].Width = 20; fGrid2.Rows.Clear(); buttonX1.Visible = false; buttonX2.Visible = false; buttonR.Visible = false; if (_gp == null) { return; } iGRow _row = null; _row = CreateNewRow2(); _row.Key = "othersxxx"; _row.ForeColor = Color.Blue; _row.Cells["mem"].Value = "Member Names"; _row.Cells["mem"].TextAlign = iGContentAlignment.MiddleCenter; _row.BackColor = Color.Lavender; _row.ReadOnly = iGBool.False; _row.Selectable = false; _row.Cells["type"].Value = null; _row.Cells["type"].TextAlign = iGContentAlignment.MiddleRight; // _row.Cells["desig"].Value = "Member Role(s)"; _row.Cells["desig"].TextAlign = iGContentAlignment.MiddleCenter; // fGrid2.Rows["othersxxx"].Cells["_pic"].TypeFlags = iGCellTypeFlags.HasEllipsisButton; buttonX1.Visible = true; buttonX2.Visible = true; buttonR.Visible = true; if (_gp == null) { fGrid2.EndUpdate(); return; } int _cnt = 0; ic.RoleC _role = null; if (_gp.MemberCount > 0) { foreach (var r in _gp.MemberEnumerable.OrderBy(l => l.mem_name)) { _cnt++; _row = fGrid2.Rows.Add(); _row.ReadOnly = iGBool.True; _row.Font = new Font("verdana", 10, FontStyle.Bold); _row.Cells["type"].Col.Width = 30; _row.Cells["type"].Value = _cnt; _row.Cells["type"].TextAlign = iGContentAlignment.MiddleCenter; _row.Cells["mem"].ValueType = typeof(string); _row.Tag = r.mem_id.ToStringNullable(); _row.Cells["mem"].Value = r.mem_name; _row.Cells["_pic"].TypeFlags = iGCellTypeFlags.HasEllipsisButton; _row.Cells["_pic"].ReadOnly = iGBool.False; // _role = r.RolesCollection.Where(k => k.Is_valid & k.objRole.gp_type == em.role_gp_typeS.church_group & k.objRole.gp_id == _gp.cg_id).Select(k => k.objRole).FirstOrDefault(); _row.Cells["desig"].DropDownControl = m_LDATA[_gp.cg_id]; _row.Cells["desig"].Value = null; if (_role != null) { _row.Cells["desig"].Value = _role.role_name; } // _row.Cells["desig"].ReadOnly = iGBool.False; _row.Cells["desig"].TypeFlags = iGCellTypeFlags.HideComboButton; _row.Key = r.mem_id.ToStringNullable(); _row.AutoHeight(); } } fGrid2.Cols.AutoWidth(); fGrid2.AutoResizeCols = false; fGrid2.EndUpdate(); position_button_controller(); }