public static void SaveGridFormat(UltraGridBand ug, string sModuleCode, string sEmplNo) { ADOSys_PD_GridFormat InstGrid = new ADOSys_PD_GridFormat(); Sys_PD_GridFormat formater = new Sys_PD_GridFormat(); InstGrid.DeleteFormatter(sModuleCode, sEmplNo); foreach (UltraGridColumn aCol in ug.Columns) { if (aCol.Hidden == true) { } else { formater.ColFor_Code = sModuleCode; formater.Empl_NO = sEmplNo; formater.ColFor_ColName = aCol.Key; formater.ColFor_ColOrder = aCol.Header.VisiblePosition; formater.ColFor_ColWidth = aCol.Width.ToString(); InstGrid.Add(formater); } } }
public static void RetrieveSetGridFormat(UltraGrid ugrid, UltraGridBand ug, string sModule, string sEmplNo) { ugrid.EventManager.AllEventsEnabled = false; string ssql = string.Format(" select colfor_colname, colfor_colorder, colfor_colwidth from colformat where empl_no = '{0}' and colfor_code = '{1}' ", sEmplNo, sModule); ADOSys_PD_GridFormat InstGrid = new ADOSys_PD_GridFormat(); List<Sys_PD_GridFormat> fList = new List<Sys_PD_GridFormat>(); fList = InstGrid.GetListByWhere(string.Format(" and empl_no = '{0}' and colfor_code = '{1}' ", sEmplNo, sModule)); foreach (Sys_PD_GridFormat f in fList) { string sCol = f.ColFor_ColName; if (ug.Columns.Exists(sCol)) { ug.Columns[sCol].Header.VisiblePosition = f.ColFor_ColOrder; ug.Columns[sCol].Width = int.Parse(f.ColFor_ColWidth); } } ugrid.EventManager.AllEventsEnabled = true; }