/// <summary> /// ExportExcel File /// </summary> /// <returns></returns> public string ExportExcel(string searchprm = "") { RBVHSearchFilter SearchKey = BindSearchHRDB(searchprm); RBVHEmployeeCollection collection = RBVHEmployeeManager.Search(SearchKey); DataTable dt = collection.ToDataTable <RBVHEmployee>(); string fileName = "RBVHEmployee_" + SystemConfig.CurrentDate.ToString("MM-dd-yyyy"); //string[] RemoveColumn = { "CompanyID" , "TargetDisplayID", "ReturnDisplay","TotalRecord", "CreatedUser","CreatedDate"}; //for (int i = 0; i < RemoveColumn.Length; i++) //{ // if (dt.Columns.Contains(RemoveColumn[i])) // { // dt.Columns.Remove(RemoveColumn[i]); // } //} HeaderItemCollection RemoveColumn = CommonHelper.HideColumn <RBVHEmployee>(CurrentUser, "RBVHEmployee"); for (int i = 0; i < RemoveColumn.Count; i++) { if (dt.Columns.Contains(RemoveColumn[i].name)) { dt.Columns.Remove(RemoveColumn[i].name); } } FileInputHelper.ExportExcel(dt, fileName, "RBVHEmployee List", false); return(fileName); }
public static HeaderItemCollection HideColumn <T>(DNHUsers objUser, string Page) { HeaderItemCollection ColumnName = new HeaderItemCollection(); if (objUser == null) { return(ColumnName); } //check the UserFile has exist or not string FileName = IOHelper.GetDirectory(myConfig.UserDataFolder + objUser.CompanyID + "\\Header\\" + objUser.UserName + "\\" + Page) + "\\Hideheader.bin"; if (IOHelper.hasFile(FileName)) { //get form the file ColumnName = IOHelper.ReadFromBinaryFile <HeaderItemCollection>(FileName); } else { //var nopConfig = ColumnName = CommonHelper.JsonHideHeaderList <T>(objUser); IOHelper.WriteToBinaryFile <HeaderItemCollection>(FileName, ColumnName); } return(ColumnName); }
/// <summary> /// ExportExcel File /// </summary> /// <returns></returns> /// public ActionResult headerLink() { //string ColumnName = CommonHelper.JsonColumnType<T_CMS_Master_Contract>(); HeaderItemCollection ColumnName = CommonHelper.UserConfigPageFolder <T_CMS_Master_Contract>(CurrentUser, screenID); return(Content(JsonConvert.SerializeObject(ColumnName), "application/json")); }
public ActionResult headerLink() { HeaderItemCollection ColumnName = CommonHelper.UserConfigPageFolder <DNHSiteMap>(CurrentUser, screenID); return(Content(JsonConvert.SerializeObject(ColumnName), "application/json")); //string ColumnName = CommonHelper.JsonColumnType<DNHSiteMap>(); //return this.Content(ColumnName, "application/json"); }
public static HeaderItemCollection JsonHideHeaderList <T>(DNHUsers ObjUser) { HeaderItemCollection myCols = new HeaderItemCollection(); Type t = typeof(T); PropertyInfo[] pia = t.GetProperties(); PropertyInfo propertyInfo; ColumnAttribute myCustom; HeaderItem item; bool isHide = false; for (int i = 0; i < pia.Length; i++) { item = new HeaderItem(); propertyInfo = pia[i]; if (propertyInfo == null) { continue; } item.name = propertyInfo.Name; item.value = L(propertyInfo.Name); item.type = JsonTypes(propertyInfo); isHide = false; int CustomLength = propertyInfo.CustomAttributes.Count <CustomAttributeData>(); if (CustomLength > 0) { var attributes = propertyInfo.GetCustomAttributes(false); foreach (var attribute in attributes) { //check if the object has attribute and set the data if (attribute.GetType() == typeof(ColumnAttribute)) { myCustom = (ColumnAttribute)attribute; isHide = myCustom.Hide; if (!myCustom.Hide) { item.alink = myCustom.ActionLink; item.type = myCustom.DataType.ToLower(); // coumnvalue = "{\"name\":\"" + propertyInfo.Name + "\",\"type\":\"" + myCustom.DataType + "\",\"value\":\"" + L(propertyInfo.Name) + "\",\"alink\":\"" + myCustom.ActionLink + "\"}"; } } } } if (i >= pia.Length - 5 || isHide) { myCols.Add(item); } } return(myCols); }