62,041
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;
using Common;
using System.Configuration;
using System.Web.Services;
using System.IO;
namespace PublicSys.CouponPayment
{
public partial class CouponPaymentEidt : AdminPage
{
public string Member = "";
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
bindData();
GetCardType();
if (Request["id"] != null && Request["id"].ToString() != "")
{
string strId = Request["id"].ToString();
//getActivity(strId);
}
}
}
private void bindData()
{
bindFD();
//bindCardType();
bindHomeClass();
}
private void bindFD()
{
cbl_fd.DataSource = Common.PublicClass.GetSubs();
cbl_fd.DataTextField = "bname";
cbl_fd.DataValueField = "substoreid";
cbl_fd.DataBind();
}
private void bindHomeClass()
{
cbl_homeclass.DataSource = Common.PublicClass.GetHomeClass();
cbl_homeclass.DataTextField = "id";
cbl_homeclass.DataValueField = "id";
cbl_homeclass.DataBind();
}
private void GetCardType()
{
StringBuilder sb = new StringBuilder();
DataTable dt = Common.PublicClass.GetCardTypes();
for (int i = 0; i < dt.Rows.Count; i++)
{
sb.Append("<tr>");
sb.Append("<td>");
sb.Append(dt.Rows[i]["name"].ToString() + ":");
sb.Append("<input id='ChkAll_cbl_fd" + i + "' type='checkbox' name='MemberType' />");
sb.Append("</td>");
sb.Append("<td colspan='3'>");
sb.Append("优惠券金额:<input type='text' id='txt_CMoney" + i + "' style='width:60px' /> ");
sb.Append("优惠券数量:<input type='text' id='txt_CNum" + i + "' style='width:60px' /> <br/>");
sb.Append("消费金额:<input type='text' id='txt_CTotal" + i + "' style='width:60px' /> ");
sb.Append("开始时间:<input type='text' id='txt_starDtime" + i + "' class='Wdate' onfocus='WdatePicker()' style='width:100px' /> ");
sb.Append("结束时间:<input type='text' id='txt_endDtime" + i + "' class='Wdate' onfocus='WdatePicker()' style='width:100px' /> <br/>");
sb.Append("起始年龄:<input type='text' id='txt_starAge" + i + "' style='width:60px;' /> ");
sb.Append("截止年龄:<input type='text' id='txt_endAge" + i + "' style='width:60px;' /> ");
sb.Append("性别:<select id='sel_Gender" + i + "'><option value='请选择'>--请选择--</option><option value='1'>男</option><option value='2'>女</option></select>");
sb.Append("</td>");
sb.Append("</tr>");
}
Member = sb.ToString();
}
string loadFileName = "";
public void DownExcel()
{
string Attachment = string.Empty;
if (!string.IsNullOrEmpty(Request.Files["filedata"].FileName))
{
//HttpContext.ApplicationInstance.
HttpPostedFile file = Context.Request.Files["filedata"];
string extension = Path.GetExtension(file.FileName);
string allowExtension = ".xls|.xlsx";
if (string.IsNullOrEmpty(extension) || !allowExtension.Contains(extension.ToLower()))
{
Response.Write("[{\"status\":\"error\",\"message\":\"请选择文件,支持的格式有.xls|.xlsx\"}]");
return;
}
string fileName = Guid.NewGuid().ToString() + extension;
loadFileName = fileName;
string cerPath = System.Configuration.ConfigurationManager.AppSettings["filepathExcel"].ToString();
string path = cerPath + fileName;
//判断:存在则不新建文件夹
if (System.IO.File.Exists(cerPath))
{
}
else
{
Directory.CreateDirectory(cerPath);
}
if (extension.ToLower() == ".jpg" || extension.ToLower() == ".png" || extension.ToLower() == ".gif")
{
file.SaveAs(path);
}
}
Response.Write("{\"statu\":\"success\",\"path\":\"" + loadFileName + "\"}");
}
protected void btn_Sav_Click(object sender, EventArgs e)
{
if (Request["id"] != null)
{
//setAct();
}
else
{
//addAct();
}
}
}
}