티스토리 뷰
public ActionResult GetInventoryExcel(GetInventoryListModel getInventoryListModel)
{
// Validation
if (getInventoryListModel.SearchStartDate == DateTime.MinValue) { getInventoryListModel.SearchStartDate = DateTime.Now.AddYears(-50); }
if (getInventoryListModel.SearchEndDate == DateTime.MinValue) { getInventoryListModel.SearchEndDate = DateTime.Now; }
getInventoryListModel.CustomerNo = LoginService.GetLoginInfo.cust_no;
getInventoryListModel.PlaceCode = LoginService.GetLoginInfo.pl_cd;
if ("inventoryNo".Equals(getInventoryListModel.searchOption)) { getInventoryListModel.InventoryCode = getInventoryListModel.searchOptionDetail; }
if ("inventoryName".Equals(getInventoryListModel.searchOption)) { getInventoryListModel.InventoryName = getInventoryListModel.searchOptionDetail; }
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("content-disposition", "attachment; filename=Inventory"+DateTime.Now.ToShortDateString()+".xls");
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.Charset = "UTF-8";
System.IO.StringWriter sw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw);
this.InventoryBiz.GetGridViewForExcel(base.InventoryBiz.GetInventoryList(getInventoryListModel)).RenderControl(htw);
Response.Write(@"<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /><style> TD { mso-number-format:\@; } </style>");
Response.Output.Write(sw.ToString());
Response.Flush();
Response.End();
return new EmptyResult();
}
public GridView GetGridViewForExcel(DataTable dt)
{
var inventoryDT = new System.Data.DataTable("Inventory");
inventoryDT.Columns.Add("Inventory No ", typeof(string));
inventoryDT.Columns.Add("Inventory Name", typeof(string));
inventoryDT.Columns.Add("Inventory Total Qty", typeof(int));
inventoryDT.Columns.Add("Registration Date", typeof(System.DateTime));
if (dt != null)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
inventoryDT.Rows.Add(dt.Rows[i]["inv_code"], dt.Rows[i]["inv_name"], dt.Rows[i]["inv_qty"], dt.Rows[i]["reg_dt"]);
}
}
var gridView = new System.Web.UI.WebControls.GridView { AllowPaging = false, DataSource = inventoryDT };
gridView.DataBind();
return gridView;
}
- Total
- Today
- Yesterday
- mssql
- In App Purchase
- nl2br
- .submit()
- 앱 스토어
- async
- hyper-v
- 제품 등록
- 진수 변환
- 아이폰
- 문자 자르기
- MainActor
- trim
- Task
- system.io
- html tag
- 명령어
- System.Diagnostics
- await
- 공백제거
- 특정 문자를 기준으로 자르기
- App Store
- FileUpload
- 상품 등록
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |