private void RptBind(string _strWhere, string _orderby) { this.page = Vincent._DTcms.DTRequest.GetQueryInt("page", 1); if (this.status > 0) { this.ddlStatus.SelectedValue = this.status.ToString(); } if (this.payment_status > 0) { this.ddlPaymentStatus.SelectedValue = this.payment_status.ToString(); } if (this.express_status > 0) { this.ddlExpressStatus.SelectedValue = this.express_status.ToString(); } txtKeywords.Text = this.keywords; txtDate.Value = this.keyDate; BLL.orders bll = new BLL.orders(); BuysingooShop.Model.manager manModel = Session[Vincent._DTcms.DTKeys.SESSION_ADMIN_INFO] as Model.manager; if (manModel.brand_id != 0) { _strWhere += " and store_id=" + manModel.brand_id; } this.rptList.DataSource = bll.GetList1(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Vincent._DTcms.Utils.CombUrlTxt("order_list.aspx", "status={0}&payment_status={1}&express_status={2}&keywords={3}&keyDate={4}&page={5}", this.status.ToString(), this.payment_status.ToString(), this.express_status.ToString(), this.keywords, this.keyDate, "__id__"); PageContent.InnerHtml = Vincent._DTcms.Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
private void RptBind(string _strWhere, string _orderby) { this.page = Vincent._DTcms.DTRequest.GetQueryInt("page", 1); txtKeywords.Text = this.keywords; BLL.orders bll = new BLL.orders(); BuysingooShop.Model.manager manModel = Session[Vincent._DTcms.DTKeys.SESSION_ADMIN_INFO] as Model.manager; if (manModel.brand_id != 0) { _strWhere += " and brand_id=" + manModel.brand_id; } this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Vincent._DTcms.Utils.CombUrlTxt("order_confirm.aspx", "keywords={0}&page={1}", this.keywords, "__id__"); PageContent.InnerHtml = Vincent._DTcms.Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
//页面加载事件 protected void Page_Load(object sender, EventArgs e) { string _action = Vincent._DTcms.DTRequest.GetQueryString("action"); userInfo = new BuysingooShop.Web.UI.ManagePage().GetAdminInfo(); if (this.channel_id == 0) { JscriptMsg("频道参数不正确!", "back", "Error"); return; } this.channel_name = new BLL.channel().GetChannelName(this.channel_id); //取得频道名称 if (!string.IsNullOrEmpty(_action) && _action == Vincent._DTcms.DTEnums.ActionEnum.Edit.ToString()) { this.action = Vincent._DTcms.DTEnums.ActionEnum.Edit.ToString();//修改类型 this.id = Vincent._DTcms.DTRequest.GetQueryInt("id"); if (this.id == 0) { JscriptMsg("传输参数不正确!", "back", "Error"); return; } if (!new BLL.article().Exists(this.id)) { JscriptMsg("信息不存在或已被删除!", "back", "Error"); return; } } if (!Page.IsPostBack) { //ChkAdminLevel("designer_pro", Vincent._DTcms.DTEnums.ActionEnum.View.ToString()); //检查权限 ShowSysField(this.channel_id); //显示相应的默认控件 GroupBind(""); //绑定用户组 TreeBind(this.channel_id); //绑定类别 if (action == Vincent._DTcms.DTEnums.ActionEnum.Edit.ToString()) //修改 { ShowInfo(this.id); } } }
//导出excel protected void LinkButton1_Click(object sender, EventArgs e) { StringBuilder OutFileContent = new StringBuilder();//容器 //写头文件 OutFileContent = Exportexcel.AddHeadFile(OutFileContent); //写内容 StringBuilder sbMsg = new StringBuilder();//容器 //查询需要导出的数据 string _strWhere = "status!=1 and status!=99"; _strWhere += CombSqlTxt(this.outlet_id, this.city_id, this.keywords); this.datetime = Vincent._DTcms.DTRequest.GetQueryString("datetime"); //if (datetime != null) //{ // _strWhere += " and datediff(dd,add_time,'" + datetime + "')=0"; //} BLL.orders bll = new BLL.orders(); BuysingooShop.Model.manager manModel = Session[Vincent._DTcms.DTKeys.SESSION_ADMIN_INFO] as Model.manager; if (manModel.brand_id != 0) { _strWhere += " and store_id=" + manModel.brand_id; } DataSet ds = bll.GetOrderAmount(0, _strWhere, " id"); OutFileContent.Append(Exportexcel.AddContentFile(sbMsg, ds)); //写尾文件 OutFileContent = Exportexcel.AddEndFile(OutFileContent); //保存到xls string strRandomFileName = "简单生活订单报表"; //strRandomFileName = strRandomFileName + DateTime.Now.ToString("yyyy-MM-dd"); //strRandomFileName=strRandomFileName+"-"+DateTime.Now.Minute.ToString(); //strRandomFileName = strRandomFileName+"-" + DateTime.Now.Second.ToString(); string strPath = Server.MapPath(Context.Request.ApplicationPath); string strExcelFile = strPath + strRandomFileName + ".xls"; try { //生成excel FileStream OutFile = new FileStream(strExcelFile, FileMode.Create, FileAccess.Write); byte[] btArray = new byte[OutFileContent.Length]; btArray = Encoding.UTF8.GetBytes(OutFileContent.ToString()); OutFile.Write(btArray, 0, btArray.Length); OutFile.Flush(); OutFile.Close(); //下载文件 FileStream fs = new FileStream(strExcelFile, FileMode.Open); byte[] bytes = new byte[(int)fs.Length]; fs.Read(bytes, 0, bytes.Length); fs.Close(); Response.ContentType = "application/ms-word"; //通知浏览器下载文件而不是打开 Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(strExcelFile, System.Text.Encoding.UTF8)); Response.BinaryWrite(bytes); Response.Flush(); Response.End(); } catch (Exception ex) { JscriptMsg("请稍后再试!" + ex.Message, Vincent._DTcms.Utils.CombUrlTxt("areareport.aspx", "keywords={0}", this.keywords), "Success"); } JscriptMsg("导出成功!", Vincent._DTcms.Utils.CombUrlTxt("areareport.aspx", "keywords={0}", this.keywords), "Success"); }