protected void Button2_Click(object sender, EventArgs e) { applist = new GroupBLL().GetGroupElemsByGroupID(_Id); if (applist.Count > 0) { DataTable dt = BaseCommon.ToDataTable <GroupElemsEntity>(applist); string fileName = string.Format("Special_AppInfo_{0}.xls", DateTime.Now.ToString("yyyyMMddHHmmss")); string path = Server.MapPath(ServerMapPath() + fileName); WriteAppInfoExcel(dt, path, fileName); DownloadFile(path); } }
protected void Button1_Click(object sender, EventArgs e) { DataSet dataset = new DataSet(); DataTable datatable = new DataTable(); dataset = new GroupElemsBLL().QueryDataSetByGroupID2(GroupID); datatable = GetGroupInfo(GroupID); DataTable dt = dataset.Tables[0]; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { for (int j = 0; j < dt.Columns.Count; j++) { if (dt.Columns[j].ColumnName.ToString() == "PosID") { int posid = int.Parse(dt.Rows[i][j].ToString()); int id = int.Parse(dt.Rows[i][4].ToString()); AppInfoEntity entity = new AppInfoBLL().GetSingle(id); int a = 0; for (int k = 0; k < datatable.Rows.Count; k++) { if (int.Parse(datatable.Rows[k][datatable.Columns.Count - 1].ToString()) == id) { a = k; } } if (a > 0) { datatable.Rows.RemoveAt(a); } DataRow drr = datatable.NewRow(); if (entity != null) { drr["ID"] = entity.AppID; drr["游戏名"] = entity.ShowName; drr["包名"] = entity.PackName; drr["版本"] = entity.MainVerName; AppTypeEntity type = new AppTypeBLL().GetSingle(entity.AppType); if (type != null) { drr["游戏分类"] = type.AppTypeName; } drr["合作类型"] = entity.CoopType; drr["开发者"] = entity.DevName; drr["状态"] = entity.Status; PackInfoEntity info = new PackInfoBLL().GetSingle(entity.MainPackID); if (info != null) { drr["调用权限"] = info.permission; } } //datatable.Rows.RemoveAt(posid-1); datatable.Rows.InsertAt(drr, posid - 1); } } } } string fileName = string.Format("GroupInfo_{0}.xls", DateTime.Now.ToString("yyyyMMddHHmmss")); string path = Server.MapPath(ServerMapPath() + fileName); new AppInfoListNew().WriteExcel2(BaseCommon.DtSelectTop(500, datatable), path, fileName); DownloadFile(path); }