private void sys_channel_validate(HttpContext context) { string channelname = DTRequest.GetFormString("channelname"); string oldname = DTRequest.GetFormString("oldname"); if (string.IsNullOrEmpty(channelname)) { context.Response.Write("false"); return; } //检查是否与站点根目录下的目录同名 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING)); DirectoryInfo dirInfo = new DirectoryInfo(Utils.GetMapPath(siteConfig.webpath)); foreach (DirectoryInfo dir in dirInfo.GetDirectories()) { if (channelname.ToLower() == dir.Name) { context.Response.Write("false"); return; } } //检查是否修改操作 if (channelname == oldname) { context.Response.Write("true"); return; } //检查Key是否与已存在 BLL.sys_channel bll = new BLL.sys_channel(); if (bll.Exists(channelname)) { context.Response.Write("false"); return; } context.Response.Write("true"); return; }
private void validate_username(HttpContext context) { string username = DTRequest.GetFormString("username"); string oldusername = DTRequest.GetFormString("oldusername"); //如果为Null,退出 if (string.IsNullOrEmpty(username)) { context.Response.Write("false"); return; } Model.userconfig userConfig = new BLL.userconfig().loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_USER_XML_CONFING)); //过滤注册用户名字符 string[] strArray = userConfig.regkeywords.Split(','); foreach (string s in strArray) { if (s.ToLower() == username.ToLower()) { context.Response.Write("false"); return; } } //检查是否修改操作 if (username == oldusername) { context.Response.Write("true"); return; } BLL.users bll = new BLL.users(); //查询数据库 if (bll.Exists(username.Trim())) { context.Response.Write("false"); return; } context.Response.Write("true"); return; }
private void edit(HttpContext context) { //检查用户是否登录 CMS.Model.users umodel = new CMS.Web.UI.BasePage().GetUserInfo(); if (umodel == null) { context.Response.Write("{\"status\":0, \"msg\":\"请登录后再提交!\"}"); return; } BLL.forum_posts bll = new BLL.forum_posts(); string _title = DTRequest.GetFormString("txtTitle"); string _content = DTRequest.GetFormString("txtContent"); int post_id = DTRequest.GetFormInt("txtPostID"); if (post_id == 0) { context.Response.Write("{\"status\":0, \"msg\":\"参数不正确!\"}"); return; } Model.forum_posts model = bll.GetModel(post_id); //判断权限 if (IsModerator(model.board_id, umodel.id) && model.user_id != umodel.id) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,你无权编辑此帖!\"}"); return; } model.title = Utils.DropHTML(_title); model.content = _content; if (bll.Update(model)) { context.Response.Write("{\"status\": 1, \"msg\": \"编辑帖子成功!\"}"); return; } context.Response.Write("{\"status\": 0, \"msg\": \"对不起,保存过程中发生错误!\"}"); return; }
//查询 protected void btnSearch_Click(object sender, EventArgs e) { this.isSearch = true; _check = DTRequest.GetFormString("check"); _check1 = DTRequest.GetFormString("ddlcheck1"); _check2 = DTRequest.GetFormString("ddlcheck2"); _check3 = DTRequest.GetFormString("ddlcheck3"); _payStatus = DTRequest.GetFormString("ddlConfirm"); _sforedate = DTRequest.GetFormString("txtsforedate"); _eforedate = DTRequest.GetFormString("txteforedate"); _sdate = DTRequest.GetFormString("txtsdate"); _edate = DTRequest.GetFormString("txtedate"); _area = DTRequest.GetFormString("ddlarea"); _type = DTRequest.GetFormString("ddltype"); _function = DTRequest.GetFormString("txtfunction"); _owner = DTRequest.GetFormString("txtOwner"); _self = DTRequest.GetFormString("self");//self=1表示个人页面 _method = DTRequest.GetFormString("ddlPayMethod1"); _sign = DTRequest.GetFormString("ddlsign"); _money = DTRequest.GetFormString("txtMoney"); _bankName = DTRequest.GetFormString("txtBankName"); RptBind("uba_id>0" + CombSqlTxt(), orderby); }
//关健字查询 protected void btnSearch_Click(object sender, EventArgs e) { this.isSearch = true; _cusName = DTRequest.GetFormString("txtCusName"); _cid = DTRequest.GetFormString("hCusId"); _check1 = DTRequest.GetFormString("ddlcheck1"); _check2 = DTRequest.GetFormString("ddlcheck2"); _check3 = DTRequest.GetFormString("ddlcheck3"); _isconfirm = DTRequest.GetFormString("ddlisConfirm"); _oid = DTRequest.GetFormString("txtOid"); _sign = DTRequest.GetFormString("ddlsign"); _money = DTRequest.GetFormString("txtMoney"); _sdate = DTRequest.GetFormString("txtsDate"); _edate = DTRequest.GetFormString("txteDate"); _farea = DTRequest.GetFormString("ddlfarea"); _darea = DTRequest.GetFormString("ddldarea"); _invType = DTRequest.GetFormString("ddlinvType"); _name = DTRequest.GetFormString("txtName"); _unit = DTRequest.GetFormString("txtUnit"); _purchaserName = DTRequest.GetFormString("txtpurchaserName"); _self = DTRequest.GetFormString("self");//self=1表示个人页面 RptBind("inv_id>0" + CombSqlTxt(), orderby); }
//关健字查询 protected void btnSearch_Click(object sender, EventArgs e) { this.isSearch = true; _cusName = DTRequest.GetString("txtCusName"); _cid = DTRequest.GetString("hCusId"); _method = DTRequest.GetFormString("ddlmethod"); _check = DTRequest.GetFormString("ddlcheck"); _check2 = DTRequest.GetFormString("ddlcheck2"); _isconfirm = DTRequest.GetFormString("ddlisConfirm"); _sforedate = DTRequest.GetFormString("txtsforedate"); _eforedate = DTRequest.GetFormString("txteforedate"); _sdate = DTRequest.GetFormString("txtsdate"); _edate = DTRequest.GetFormString("txtedate"); _num = DTRequest.GetFormString("txtNum"); _chk = DTRequest.GetFormString("txtChk"); _numdate = DTRequest.GetFormString("txtNumDate"); _sign = DTRequest.GetFormString("ddlsign"); _money = DTRequest.GetFormString("txtMoney"); _moneyType = DTRequest.GetFormString("ddlmoneyType"); _type = DTRequest.GetFormString("ddlType"); _addperson = DTRequest.GetFormString("txtAddPerson"); RptBind("rp_type=0 " + CombSqlTxt(), orderby); }
private bool DoAdd() { bool result = false; string standard_values = DTRequest.GetFormString("ck_standard_value"); if (string.IsNullOrEmpty(standard_values)) { JscriptMsg("保存过程中发生错误!", "", "Error"); return(false); } BLL.standard bll = new BLL.standard(); Model.standard model = new Model.standard(); model.title = txt_standard_title.Text.Trim(); model.category_id = Convert.ToInt32(ddlCategoryId.SelectedValue); model.add_time = DateTime.Now; List <Model.standard_value> lst = new List <Model.standard_value>(); string[] standard_value_arr = standard_values.Split(','); Model.standard_value model_value; foreach (string str in standard_value_arr) { model_value = new Model.standard_value(); model_value.value = str.Split('|')[1]; model_value.add_time = DateTime.Now; lst.Add(model_value); } model.standard_values = lst; if (bll.Add(model) > 0) { //AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加用户:" + model.user_name); //记录日志 result = true; } return(result); }
private void add(HttpContext context) { //检查用户是否登录 DTcms.Model.users umodel = new DTcms.Web.UI.BasePage().GetUserInfo(); if (umodel == null) { context.Response.Write("{\"status\":0, \"msg\":\"请登录后再提交!\"}"); return; } BLL.forum_posts bll = new BLL.forum_posts(); Model.forum_posts model = new Model.forum_posts(); string _title = DTRequest.GetFormString("txtTitle"); string _content = DTRequest.GetFormString("txtContent"); int board_id = DTRequest.GetFormInt("txtBoardID"); int post_id = DTRequest.GetFormInt("txtPostID"); int _userid = umodel.id; string _userip = System.Web.HttpContext.Current.Request.UserHostAddress; model.class_layer = 1; model.title = Utils.DropHTML(_title); model.content = _content; model.user_id = _userid; model.user_ip = _userip; model.board_id = board_id; model.parent_post_id = post_id; model.post_type = 1;//主题帖 model.reply_time = DateTime.Now; if (bll.Add(model) > 0) { context.Response.Write("{\"status\": 1, \"msg\": \"恭喜您,发帖成功!\"}"); return; } context.Response.Write("{\"status\": 0, \"msg\": \"对不起,保存过程中发生错误!\"}"); return; }
/** * 卡前置模式 额外需要的参数 */ private SortedDictionary <string, string> getParamDict(int _user_id) { SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>(); //查询会员信息 //var user = new BLL.users().GetModel(_user_id); //if (user != null) //{ sParaTemp.Add("id_type", "0"); //证件类型 sParaTemp.Add("id_no", DTRequest.GetFormString("id_card_no")); //身份证 sParaTemp.Add("acct_name", DTRequest.GetFormString("card_username")); sParaTemp.Add("flag_modify", "1"); sParaTemp.Add("back_url", PartnerConfig.URL_BACK); string no_agree = ""; if (!YinTongUtil.isnull(Request["no_agree"])) { no_agree = Request["no_agree"].Trim(); } if (!YinTongUtil.isnull(no_agree)) { sParaTemp.Add("pay_type", "D"); sParaTemp.Add("no_agree", no_agree); } else { string card_no = Request["card_no"].Trim(); sParaTemp.Add("card_no", card_no); } //} //else // throw new InvalidOperationException("找不到会员信息!会员id为:" + _user_id); return(sParaTemp); }
private void del(HttpContext context) { //检查用户是否登录 CMS.Model.users umodel = new CMS.Web.UI.BasePage().GetUserInfo(); if (umodel == null) { context.Response.Write("{\"status\":0, \"msg\":\"请登录后再提交!\"}"); return; } BLL.forum_posts bll = new BLL.forum_posts(); Model.forum_posts model = new Model.forum_posts(); int post_id = DTRequest.GetFormInt("postid"); string optip = DTRequest.GetFormString("optip"); string opremark = DTRequest.GetFormString("opremark"); model = bll.GetModel(post_id); //检查是否是版主 if (!IsModerator(model.board_id, umodel.id)) { context.Response.Write("{\"status\":0, \"msg\":\"当前用户无权执行此操作!\"}"); return; } if (bll.Delete(post_id)) { //发送短信息 string postusername = new CMS.BLL.users().GetModel(model.user_id).user_name; new CMS.BLL.user_message().Add(1, string.Empty, postusername, "您发布的帖子被管理员进行操作", "您的帖子被管理员进行 " + optip + " 操作,原因:" + opremark); context.Response.Write("{\"status\": 1, \"msg\": \"恭喜您,删除帖子成功!\"}"); return; } context.Response.Write("{\"status\": 0, \"msg\": \"对不起,保存过程中发生错误!\"}"); return; }
//查询 protected void btnSearch_Click(object sender, EventArgs e) { this.isSearch = true; _cusName = DTRequest.GetString("txtCusName"); _cid = DTRequest.GetString("hCusId"); _check1 = DTRequest.GetFormString("ddlcheck1"); _check2 = DTRequest.GetFormString("ddlcheck2"); _check3 = DTRequest.GetFormString("ddlcheck3"); _foresdate = DTRequest.GetFormString("txtforesdate"); _foreedate = DTRequest.GetFormString("txtforeedate"); _collect = DTRequest.GetFormString("ddlcollect"); _self = DTRequest.GetFormString("self"); _person = DTRequest.GetFormString("txtPerson"); _sign = DTRequest.GetFormString("ddlsign"); _money = DTRequest.GetFormString("txtMoney"); _oID = DTRequest.GetFormString("txtorderid"); _area = DTRequest.GetFormString("ddlarea"); _person1 = DTRequest.GetFormString("txtPerson1"); _sdate = DTRequest.GetFormString("txtsdate"); _edate = DTRequest.GetFormString("txtedate"); _num = DTRequest.GetFormString("txtnum"); _method1 = DTRequest.GetFormString("ddlmethod1"); RptBind("rpd_type=0" + CombSqlTxt(), orderby); }
protected void Page_Load(object sender, EventArgs e) { //读取站点配置信息 Model.sysconfig sysConfig = new BLL.sysconfig().loadConfig(); string order_no = DTRequest.GetFormString("pay_order_no").ToUpper(); BLL.orders objorders = new BLL.orders(); Model.orders modelorders = objorders.GetModel(order_no); if (modelorders == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,订单详情获取出错,请重试!"))); return; } decimal order_amount = modelorders.order_amount; string subject = DTRequest.GetFormString("pay_subject"); if (order_no == "" || order_amount == 0) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您提交的参数有误!"))); return; } //检查是否已登录 Model.users userModel = new Web.UI.BasePage().GetUserInfo(); if (userModel == null) { Response.Redirect(new Web.UI.BasePage().linkurl("payment", "?action=login")); //尚未登录 return; } if (userModel.amount < order_amount) { Response.Redirect(new Web.UI.BasePage().linkurl("payment", "?action=recharge")); //账户的余额不足 return; } if (order_no.StartsWith("B")) //B开头为商品订单 { BLL.orders bll = new BLL.orders(); Model.orders model = bll.GetModel(order_no); if (model == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,商品订单号不存在!"))); return; } if (model.payment_status == 1) { //执行扣取账户金额 int result = new BLL.user_amount_log().Add(userModel.id, userModel.user_name, -1 * order_amount, subject); if (result > 0) { //更改订单状态 bool result1 = bll.UpdateField(order_no, "status=2,payment_status=2,payment_time='" + DateTime.Now + "'"); if (!result1) { Response.Redirect(new Web.UI.BasePage().linkurl("payment", "?action=error")); return; } //扣除积分 if (model.point < 0) { new BLL.user_point_log().Add(model.user_id, model.user_name, model.point, "换购扣除积分,订单号:" + model.order_no, false); } } else { Response.Redirect(new Web.UI.BasePage().linkurl("payment", "?action=error")); return; } } //支付成功 Response.Redirect(new Web.UI.BasePage().linkurl("payment", "?action=succeed&order_no=" + order_no)); return; } Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,找不到需要支付的订单类型!"))); return; }
protected void btnExcel_Click(object sender, EventArgs e) { _sdate = DTRequest.GetFormString("txtsDate"); _edate = DTRequest.GetFormString("txteDate"); _sdate1 = DTRequest.GetFormString("txtsDate1"); _edate1 = DTRequest.GetFormString("txteDate1"); _status = DTRequest.GetFormString("ddlstatus"); _sign = DTRequest.GetFormString("ddlsign"); _money1 = DTRequest.GetFormString("txtMoney1"); _lockstatus = DTRequest.GetFormString("ddllock"); _area = DTRequest.GetFormString("ddlarea"); _person1 = DTRequest.GetFormString("txtPerson1").ToUpper(); BLL.finance bll = new BLL.finance(); DataTable dt = bll.getUnReceiveDetailListByUser(this.pageSize, this.page, _sdate, _edate, _sdate1, _edate1, _status, _sign, _money1, _lockstatus, _area, _person1, "op_name asc", out this.totalCount, out money1, out money2, out money3).Tables[0]; string filename = "员工未收款统计.xlsx"; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + filename + ""); //HttpUtility.UrlEncode(fileName)); HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"; HSSFWorkbook hssfworkbook = new HSSFWorkbook(); ISheet sheet = hssfworkbook.CreateSheet("明细"); IFont font = hssfworkbook.CreateFont(); font.Boldweight = short.MaxValue; font.FontHeightInPoints = 11; #region 表格样式 //设置单元格的样式:水平垂直对齐居中 ICellStyle cellStyle = hssfworkbook.CreateCellStyle(); cellStyle.Alignment = HorizontalAlignment.Center; cellStyle.VerticalAlignment = VerticalAlignment.Center; cellStyle.BorderBottom = BorderStyle.Thin; cellStyle.BorderLeft = BorderStyle.Thin; cellStyle.BorderRight = BorderStyle.Thin; cellStyle.BorderTop = BorderStyle.Thin; cellStyle.BottomBorderColor = HSSFColor.Black.Index; cellStyle.LeftBorderColor = HSSFColor.Black.Index; cellStyle.RightBorderColor = HSSFColor.Black.Index; cellStyle.TopBorderColor = HSSFColor.Black.Index; cellStyle.WrapText = true;//自动换行 //设置表头的样式:水平垂直对齐居中,加粗 ICellStyle titleCellStyle = hssfworkbook.CreateCellStyle(); titleCellStyle.Alignment = HorizontalAlignment.Center; titleCellStyle.VerticalAlignment = VerticalAlignment.Center; titleCellStyle.FillForegroundColor = HSSFColor.Grey25Percent.Index; //图案颜色 titleCellStyle.FillPattern = FillPattern.SparseDots; //图案样式 titleCellStyle.FillBackgroundColor = HSSFColor.Grey25Percent.Index; //背景颜色 //设置边框 titleCellStyle.BorderBottom = BorderStyle.Thin; titleCellStyle.BorderLeft = BorderStyle.Thin; titleCellStyle.BorderRight = BorderStyle.Thin; titleCellStyle.BorderTop = BorderStyle.Thin; titleCellStyle.BottomBorderColor = HSSFColor.Black.Index; titleCellStyle.LeftBorderColor = HSSFColor.Black.Index; titleCellStyle.RightBorderColor = HSSFColor.Black.Index; titleCellStyle.TopBorderColor = HSSFColor.Black.Index; //设置字体 titleCellStyle.SetFont(font); #endregion //表头 IRow headRow = sheet.CreateRow(0); headRow.HeightInPoints = 25; headRow.CreateCell(0).SetCellValue("业务员"); headRow.CreateCell(1).SetCellValue("收付类别"); headRow.CreateCell(2).SetCellValue("应收付款"); headRow.CreateCell(3).SetCellValue("订单已收付款"); headRow.CreateCell(4).SetCellValue("未收付款"); headRow.GetCell(0).CellStyle = titleCellStyle; headRow.GetCell(1).CellStyle = titleCellStyle; headRow.GetCell(2).CellStyle = titleCellStyle; headRow.GetCell(3).CellStyle = titleCellStyle; headRow.GetCell(4).CellStyle = titleCellStyle; sheet.SetColumnWidth(0, 15 * 256); sheet.SetColumnWidth(1, 20 * 256); sheet.SetColumnWidth(2, 20 * 256); sheet.SetColumnWidth(3, 20 * 256); sheet.SetColumnWidth(4, 20 * 256); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { IRow row = sheet.CreateRow(i + 1); row.HeightInPoints = 22; row.CreateCell(0).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["op_number"] + "(" + dt.Rows[i]["op_name"] + ")")); row.CreateCell(1).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["fin_type"]) == "True" ? "收" : "付"); row.CreateCell(2).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["orderFinMoney"])); row.CreateCell(3).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["orderRpdMoney"])); row.CreateCell(4).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["orderUnMoney"])); row.GetCell(0).CellStyle = cellStyle; row.GetCell(1).CellStyle = cellStyle; row.GetCell(2).CellStyle = cellStyle; row.GetCell(3).CellStyle = cellStyle; row.GetCell(4).CellStyle = cellStyle; } } MemoryStream file = new MemoryStream(); hssfworkbook.Write(file); HttpContext.Current.Response.BinaryWrite(file.GetBuffer()); HttpContext.Current.Response.End(); }
protected void Page_Load(object sender, EventArgs e) { //读取站点配置信息 Model.sysconfig sysConfig = new BLL.sysconfig().loadConfig(); int site_payment_id = 0; //订单支付方式 //=============================获得订单信息================================ string order_no = DTRequest.GetFormString("pay_order_no").ToUpper(); decimal order_amount = DTRequest.GetFormDecimal("pay_order_amount", 0); string user_name = DTRequest.GetFormString("pay_user_name"); string subject = DTRequest.GetFormString("pay_subject"); //检查参数是否正确 if (string.IsNullOrEmpty(order_no) || order_amount == 0) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您提交的参数有误!"))); return; } if (order_no.StartsWith("R")) //R开头为在线充值订单 { Model.user_recharge model = new BLL.user_recharge().GetModel(order_no); if (model == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您充值的订单号不存在或已删除!"))); return; } if (model.amount != order_amount) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您充值的订单金额与实际金额不一致!"))); return; } site_payment_id = model.payment_id; //站点支付方式ID } else //B开头为商品订单 { Model.orders model = new BLL.orders().GetModel(order_no); if (model == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您支付的订单号不存在或已删除!"))); return; } if (model.order_amount != order_amount) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您支付的订单金额与实际金额不一致!"))); return; } site_payment_id = model.payment_id; //站点支付方式ID } if (user_name != "") { user_name = "支付会员:" + user_name; } else { user_name = "匿名用户"; } //===============================请求参数================================== //把请求参数打包成数组 SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>(); sParaTemp.Add("payment_type", "1"); //收款类型1商品购买 sParaTemp.Add("show_url", sysConfig.weburl); //商品展示地址 sParaTemp.Add("out_trade_no", order_no); //网站订单号 sParaTemp.Add("subject", sysConfig.webname + "-" + subject); //订单名称 sParaTemp.Add("body", user_name); //订单描述 sParaTemp.Add("total_fee", order_amount.ToString()); //订单总金额 sParaTemp.Add("paymethod", ""); //默认支付方式 sParaTemp.Add("defaultbank", ""); //默认网银代号 sParaTemp.Add("anti_phishing_key", ""); //防钓鱼时间戳 sParaTemp.Add("exter_invoke_ip", DTRequest.GetIP()); ////获取客户端的IP地址 sParaTemp.Add("buyer_email", ""); //默认买家支付宝账号 sParaTemp.Add("royalty_type", ""); sParaTemp.Add("royalty_parameters", ""); //构造即时到帐接口表单提交HTML数据,无需修改 Service ali = new Service(site_payment_id); string sHtmlText = ali.Create_direct_pay_by_user(sParaTemp); Response.Write(sHtmlText); }
protected void btnExcel_Click(object sender, EventArgs e) { _cusName = DTRequest.GetString("txtCusName"); _cid = DTRequest.GetString("hCusId"); _oID = DTRequest.GetFormString("txtorderid"); _area = DTRequest.GetFormString("ddlarea"); _sforedate = DTRequest.GetFormString("txtsforedate"); _eforedate = DTRequest.GetFormString("txteforedate"); _method = DTRequest.GetFormString("ddlmethod"); _person1 = DTRequest.GetFormString("txtPerson1"); _sdate = DTRequest.GetFormString("txtsdate"); _edate = DTRequest.GetFormString("txtedate"); _addperson = DTRequest.GetFormString("txtAddPerson"); _num = DTRequest.GetFormString("txtnum"); BLL.ReceiptPayDetail bll = new BLL.ReceiptPayDetail(); DataTable dt = bll.GetList(this.pageSize, this.page, "rpd_type=1" + CombSqlTxt(), "rpd_adddate desc,rpd_id desc", manager, out this.totalCount, out decimal _tmoney, false, false).Tables[0]; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=收款明细列表.xlsx"); //HttpUtility.UrlEncode(fileName)); HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"; HSSFWorkbook hssfworkbook = new HSSFWorkbook(); ISheet sheet = hssfworkbook.CreateSheet("明细"); IFont font = hssfworkbook.CreateFont(); font.Boldweight = short.MaxValue; font.FontHeightInPoints = 11; #region 表格样式 //设置单元格的样式:水平垂直对齐居中 ICellStyle cellStyle = hssfworkbook.CreateCellStyle(); cellStyle.Alignment = HorizontalAlignment.Center; cellStyle.VerticalAlignment = VerticalAlignment.Center; cellStyle.BorderBottom = BorderStyle.Thin; cellStyle.BorderLeft = BorderStyle.Thin; cellStyle.BorderRight = BorderStyle.Thin; cellStyle.BorderTop = BorderStyle.Thin; cellStyle.BottomBorderColor = HSSFColor.Black.Index; cellStyle.LeftBorderColor = HSSFColor.Black.Index; cellStyle.RightBorderColor = HSSFColor.Black.Index; cellStyle.TopBorderColor = HSSFColor.Black.Index; cellStyle.WrapText = true;//自动换行 //设置表头的样式:水平垂直对齐居中,加粗 ICellStyle titleCellStyle = hssfworkbook.CreateCellStyle(); titleCellStyle.Alignment = HorizontalAlignment.Center; titleCellStyle.VerticalAlignment = VerticalAlignment.Center; titleCellStyle.FillForegroundColor = HSSFColor.Grey25Percent.Index; //图案颜色 titleCellStyle.FillPattern = FillPattern.SparseDots; //图案样式 titleCellStyle.FillBackgroundColor = HSSFColor.Grey25Percent.Index; //背景颜色 //设置边框 titleCellStyle.BorderBottom = BorderStyle.Thin; titleCellStyle.BorderLeft = BorderStyle.Thin; titleCellStyle.BorderRight = BorderStyle.Thin; titleCellStyle.BorderTop = BorderStyle.Thin; titleCellStyle.BottomBorderColor = HSSFColor.Black.Index; titleCellStyle.LeftBorderColor = HSSFColor.Black.Index; titleCellStyle.RightBorderColor = HSSFColor.Black.Index; titleCellStyle.TopBorderColor = HSSFColor.Black.Index; //设置字体 titleCellStyle.SetFont(font); #endregion //表头 IRow headRow = sheet.CreateRow(0); headRow.HeightInPoints = 25; headRow.CreateCell(0).SetCellValue("订单号"); headRow.CreateCell(1).SetCellValue("收款对象"); headRow.CreateCell(2).SetCellValue("收款内容"); headRow.CreateCell(3).SetCellValue("收款金额"); headRow.CreateCell(4).SetCellValue("预收日期"); headRow.CreateCell(5).SetCellValue("收款方式"); headRow.CreateCell(6).SetCellValue("申请人"); headRow.CreateCell(7).SetCellValue("状态"); headRow.CreateCell(8).SetCellValue("收款人"); headRow.CreateCell(9).SetCellValue("实收日期"); headRow.CreateCell(10).SetCellValue("对账标识"); headRow.GetCell(0).CellStyle = titleCellStyle; headRow.GetCell(1).CellStyle = titleCellStyle; headRow.GetCell(2).CellStyle = titleCellStyle; headRow.GetCell(3).CellStyle = titleCellStyle; headRow.GetCell(4).CellStyle = titleCellStyle; headRow.GetCell(5).CellStyle = titleCellStyle; headRow.GetCell(6).CellStyle = titleCellStyle; headRow.GetCell(7).CellStyle = titleCellStyle; headRow.GetCell(8).CellStyle = titleCellStyle; headRow.GetCell(9).CellStyle = titleCellStyle; headRow.GetCell(10).CellStyle = titleCellStyle; sheet.SetColumnWidth(0, 15 * 256); sheet.SetColumnWidth(1, 20 * 256); sheet.SetColumnWidth(2, 20 * 256); sheet.SetColumnWidth(3, 20 * 256); sheet.SetColumnWidth(4, 20 * 256); sheet.SetColumnWidth(5, 15 * 256); sheet.SetColumnWidth(6, 20 * 256); sheet.SetColumnWidth(7, 20 * 256); sheet.SetColumnWidth(8, 20 * 256); sheet.SetColumnWidth(9, 20 * 256); sheet.SetColumnWidth(10, 20 * 256); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { IRow row = sheet.CreateRow(i + 1); row.HeightInPoints = 22; row.CreateCell(0).SetCellValue(dt.Rows[i]["rpd_oid"].ToString()); row.CreateCell(1).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["c_name"])); row.CreateCell(2).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["rpd_content"])); row.CreateCell(3).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["rpd_money"])); row.CreateCell(4).SetCellValue(ConvertHelper.toDate(dt.Rows[i]["rpd_foredate"]).Value.ToString("yyyy-MM-dd")); row.CreateCell(5).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["pm_name"])); row.CreateCell(6).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["rpd_personNum"]) + "-" + Utils.ObjectToStr(dt.Rows[i]["rpd_personName"])); row.CreateCell(7).SetCellValue(BusinessDict.checkStatus()[Utils.ObjToByte(dt.Rows[i]["rpd_flag1"])]); row.CreateCell(8).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["rp_confirmerName"])); row.CreateCell(9).SetCellValue(ConvertHelper.toDate(dt.Rows[i]["rp_date"]) == null?"":ConvertHelper.toDate(dt.Rows[i]["rp_date"]).Value.ToString("yyyy-MM-dd")); row.CreateCell(10).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["rpd_num"])); row.GetCell(0).CellStyle = cellStyle; row.GetCell(1).CellStyle = cellStyle; row.GetCell(2).CellStyle = cellStyle; row.GetCell(3).CellStyle = cellStyle; row.GetCell(4).CellStyle = cellStyle; row.GetCell(5).CellStyle = cellStyle; row.GetCell(6).CellStyle = cellStyle; row.GetCell(7).CellStyle = cellStyle; row.GetCell(8).CellStyle = cellStyle; row.GetCell(9).CellStyle = cellStyle; row.GetCell(10).CellStyle = cellStyle; } } MemoryStream file = new MemoryStream(); hssfworkbook.Write(file); HttpContext.Current.Response.BinaryWrite(file.GetBuffer()); HttpContext.Current.Response.End(); }
protected void btnExcel_Click(object sender, EventArgs e) { _cusName = DTRequest.GetFormString("txtCusName"); _cid = DTRequest.GetFormString("hCusId"); _check1 = DTRequest.GetFormString("ddlcheck1"); _type = DTRequest.GetFormString("ddltype"); _isUse = DTRequest.GetFormString("ddlisUse"); BLL.Customer bll = new BLL.Customer(); DataTable dt = bll.GetList(this.pageSize, this.page, "c_id>0" + CombSqlTxt(), "c_isUse desc,c_addDate desc,c_id desc", manager, out this.totalCount, false).Tables[0]; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=客户列表.xlsx"); //HttpUtility.UrlEncode(fileName)); HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"; HSSFWorkbook hssfworkbook = new HSSFWorkbook(); ISheet sheet = hssfworkbook.CreateSheet("明细"); IFont font = hssfworkbook.CreateFont(); font.Boldweight = short.MaxValue; font.FontHeightInPoints = 11; #region 表格样式 //设置单元格的样式:水平垂直对齐居中 ICellStyle cellStyle = hssfworkbook.CreateCellStyle(); cellStyle.Alignment = HorizontalAlignment.Center; cellStyle.VerticalAlignment = VerticalAlignment.Center; cellStyle.BorderBottom = BorderStyle.Thin; cellStyle.BorderLeft = BorderStyle.Thin; cellStyle.BorderRight = BorderStyle.Thin; cellStyle.BorderTop = BorderStyle.Thin; cellStyle.BottomBorderColor = HSSFColor.Black.Index; cellStyle.LeftBorderColor = HSSFColor.Black.Index; cellStyle.RightBorderColor = HSSFColor.Black.Index; cellStyle.TopBorderColor = HSSFColor.Black.Index; cellStyle.WrapText = true;//自动换行 //设置表头的样式:水平垂直对齐居中,加粗 ICellStyle titleCellStyle = hssfworkbook.CreateCellStyle(); titleCellStyle.Alignment = HorizontalAlignment.Center; titleCellStyle.VerticalAlignment = VerticalAlignment.Center; titleCellStyle.FillForegroundColor = HSSFColor.Grey25Percent.Index; //图案颜色 titleCellStyle.FillPattern = FillPattern.SparseDots; //图案样式 titleCellStyle.FillBackgroundColor = HSSFColor.Grey25Percent.Index; //背景颜色 //设置边框 titleCellStyle.BorderBottom = BorderStyle.Thin; titleCellStyle.BorderLeft = BorderStyle.Thin; titleCellStyle.BorderRight = BorderStyle.Thin; titleCellStyle.BorderTop = BorderStyle.Thin; titleCellStyle.BottomBorderColor = HSSFColor.Black.Index; titleCellStyle.LeftBorderColor = HSSFColor.Black.Index; titleCellStyle.RightBorderColor = HSSFColor.Black.Index; titleCellStyle.TopBorderColor = HSSFColor.Black.Index; //设置字体 titleCellStyle.SetFont(font); #endregion //表头 IRow headRow = sheet.CreateRow(0); headRow.HeightInPoints = 25; headRow.CreateCell(0).SetCellValue("客户ID"); headRow.CreateCell(1).SetCellValue("客户名称"); headRow.CreateCell(2).SetCellValue("客户类别"); headRow.CreateCell(3).SetCellValue("业务范围"); headRow.CreateCell(4).SetCellValue("信用代码(税号)"); headRow.CreateCell(5).SetCellValue("所属人"); headRow.CreateCell(6).SetCellValue("联系人"); headRow.CreateCell(7).SetCellValue("审批状态"); headRow.CreateCell(8).SetCellValue("启用状态"); headRow.GetCell(0).CellStyle = titleCellStyle; headRow.GetCell(1).CellStyle = titleCellStyle; headRow.GetCell(2).CellStyle = titleCellStyle; headRow.GetCell(3).CellStyle = titleCellStyle; headRow.GetCell(4).CellStyle = titleCellStyle; headRow.GetCell(5).CellStyle = titleCellStyle; headRow.GetCell(6).CellStyle = titleCellStyle; headRow.GetCell(7).CellStyle = titleCellStyle; headRow.GetCell(8).CellStyle = titleCellStyle; sheet.SetColumnWidth(0, 15 * 256); sheet.SetColumnWidth(1, 20 * 256); sheet.SetColumnWidth(2, 20 * 256); sheet.SetColumnWidth(3, 30 * 256); sheet.SetColumnWidth(4, 20 * 256); sheet.SetColumnWidth(5, 20 * 256); sheet.SetColumnWidth(6, 15 * 256); sheet.SetColumnWidth(7, 20 * 256); sheet.SetColumnWidth(8, 20 * 256); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { IRow row = sheet.CreateRow(i + 1); row.HeightInPoints = 22; row.CreateCell(0).SetCellValue(dt.Rows[i]["c_id"].ToString()); row.CreateCell(1).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["c_name"])); row.CreateCell(2).SetCellValue(BusinessDict.customerType()[Utils.ObjToByte(dt.Rows[i]["c_type"])]); row.CreateCell(3).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["c_business"])); row.CreateCell(4).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["c_num"])); row.CreateCell(5).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["c_ownerName"])); row.CreateCell(6).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["co_name"])); row.CreateCell(7).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["c_flag"]) == "0"?"待审批": Utils.ObjectToStr(dt.Rows[i]["c_flag"]) == "1"?"审批未通过":"审批通过"); row.CreateCell(8).SetCellValue(BusinessDict.isUseStatus(1)[Convert.ToBoolean(dt.Rows[i]["c_isUse"])]); row.GetCell(0).CellStyle = cellStyle; row.GetCell(1).CellStyle = cellStyle; row.GetCell(2).CellStyle = cellStyle; row.GetCell(3).CellStyle = cellStyle; row.GetCell(4).CellStyle = cellStyle; row.GetCell(5).CellStyle = cellStyle; row.GetCell(6).CellStyle = cellStyle; row.GetCell(7).CellStyle = cellStyle; row.GetCell(8).CellStyle = cellStyle; } } MemoryStream file = new MemoryStream(); hssfworkbook.Write(file); HttpContext.Current.Response.BinaryWrite(file.GetBuffer()); HttpContext.Current.Response.End(); }
private void link_add(HttpContext context) { StringBuilder strTxt = new StringBuilder(); BLL.link bll = new BLL.link(); Model.link model = new Model.link(); string _site_path = DTRequest.GetQueryString("site"); string _code = DTRequest.GetFormString("txtCode"); string _title = DTRequest.GetFormString("txtTitle"); string _user_name = DTRequest.GetFormString("txtUserName"); string _user_tel = DTRequest.GetFormString("txtUserTel"); string _email = DTRequest.GetFormString("txtEmail"); string _site_url = DTRequest.GetFormString("txtSiteUrl"); string _img_url = DTRequest.GetFormString("txtImgUrl"); //检查站点目录 if (string.IsNullOrEmpty(_site_path)) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,网站传输参数有误!\"}"); return; } //校检验证码 if (string.IsNullOrEmpty(_code)) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,请输入验证码!\"}"); return; } if (context.Session[DTKeys.SESSION_CODE] == null) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,系验证码已过期!\"}"); return; } if (_code.ToLower() != (context.Session[DTKeys.SESSION_CODE].ToString()).ToLower()) { context.Response.Write("{\"status\":0, \"msg\":\"验证码与系统的不一致!\"}"); return; } if (string.IsNullOrEmpty(_title)) { context.Response.Write("{\"status\": 0, \"msg\": \"对不起,请输入网站标题!\"}"); return; } if (string.IsNullOrEmpty(_site_url)) { context.Response.Write("{\"status\": 0, \"msg\": \"对不起,请输入网站网址!\"}"); return; } model.site_path = Utils.DropHTML(_site_path); model.title = Utils.DropHTML(_title); model.is_lock = 1; model.is_red = 0; model.user_name = Utils.DropHTML(_user_name); model.user_tel = Utils.DropHTML(_user_tel); model.email = Utils.DropHTML(_email); model.site_url = Utils.DropHTML(_site_url); model.img_url = Utils.DropHTML(_img_url); model.is_image = 1; if (string.IsNullOrEmpty(model.img_url)) { model.is_image = 0; } if (bll.Add(model) > 0) { context.Response.Write("{\"status\": 1, \"msg\": \"恭喜您,提交成功!\"}"); return; } context.Response.Write("{\"status\": 0, \"msg\": \"对不起,保存过程中发生错误!\"}"); return; }
public void ProcessRequest(HttpContext context) { string action = DTRequest.GetFormString("action"); switch (action) { #region news related case "get_channel_article_news": OutPut(context, HospicalAPI.get_channel_article_news()); break; case "get_channel_article_news_detail": OutPut(context, HospicalAPI.get_channel_article_news_detail( DTRequest.GetFormIntValue("id"))); break; case "get_channel_article_goods": OutPut(context, HospicalAPI.get_channel_article_goods()); break; case "get_channel_article_goods_detail": OutPut(context, HospicalAPI.get_channel_article_goods_detail( DTRequest.GetFormIntValue("id"))); break; #endregion #region content related case "get_channel_article_content": OutPut(context, HospicalAPI.get_channel_article_content()); break; case "get_channel_article_content_detail": OutPut(context, HospicalAPI.get_channel_article_content_detail(DTRequest.GetFormIntValue("id"))); break; #endregion #region others case "getOpenId": OutPut(context, HospicalAPI.getOpenId( DTRequest.GetFormString("code"), DTRequest.GetFormString("source")));//不填source参数默认为罗托鲁瓦 kkl表示凯库拉 break; case "add_or_update_user": OutPut(context, HospicalAPI.add_or_update_user( DTRequest.GetFormString("openid"), DTRequest.GetFormString("unionid"), DTRequest.GetFormString("photo"), DTRequest.GetFormIntValue("sex"), DTRequest.GetFormString("nickname"), DTRequest.GetFormIntValue("age"), DTRequest.GetFormString("phone"), DTRequest.GetFormString("interest"), DTRequest.GetFormFloat("latitude", -1), DTRequest.GetFormFloat("longitude", -1), DTRequest.GetFormFloat("accuracy", -1))); break; case "getUnionId": OutPut(context, HospicalAPI.getUnionId( DTRequest.GetFormString("session_key"), DTRequest.GetFormString("iv"), DTRequest.GetFormString("encryptedData"))); break; #endregion default: OutPut(context, "not implement action : " + action); break; } }
protected void Page_Load(object sender, EventArgs e) { //读取站点配置信息 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(DTKeys.FILE_SITE_XML_CONFING); //获得订单信息 string order_type = DTRequest.GetFormString("pay_order_type"); //订单类型 string order_no = DTRequest.GetFormString("pay_order_no"); decimal order_amount = DTRequest.GetFormDecimal("pay_order_amount", 0); string user_name = DTRequest.GetFormString("pay_user_name"); string subject = DTRequest.GetFormString("pay_subject"); if (order_type == "" || order_no == "" || order_amount == 0 || user_name == "") { Response.Redirect(siteConfig.webpath + "error.aspx?msg=" + Utils.UrlEncode("对不起,您提交的参数有误!")); return; } ////////////////////////////////////////////请求参数//////////////////////////////////////////// //必填参数// //请与贵网站订单系统中的唯一订单号匹配 string out_trade_no = order_no; //订单名称,显示在支付宝收银台里的“商品名称”里,显示在支付宝的交易管理的“商品名称”的列表里。 string _subject = siteConfig.webname + "-" + subject; //订单描述、订单详细、订单备注,显示在支付宝收银台里的“商品描述”里 string body = "支付会员:" + user_name; //订单总金额,显示在支付宝收银台里的“应付总额”里 string total_fee = order_amount.ToString(); //扩展功能参数——默认支付方式// //默认支付方式,代码见“即时到帐接口”技术文档 string paymethod = ""; //默认网银代号,代号列表见“即时到帐接口”技术文档“附录”→“银行列表” string defaultbank = ""; //扩展功能参数——防钓鱼// //防钓鱼时间戳 string anti_phishing_key = ""; //获取客户端的IP地址,建议:编写获取客户端IP地址的程序 string exter_invoke_ip = ""; //扩展功能参数——其他// //商品展示地址,要用http:// 格式的完整路径,不允许加?id=123这类自定义参数 string show_url = siteConfig.weburl; //自定义参数,可存放任何内容(除=、&等特殊字符外),不会显示在页面上 string extra_common_param = order_type; //默认买家支付宝账号 string buyer_email = ""; string royalty_type = ""; string royalty_parameters = ""; //////////////////////////////////////////////////////////////////////////////////////////////// //把请求参数打包成数组 SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>(); sParaTemp.Add("payment_type", "1"); sParaTemp.Add("show_url", show_url); sParaTemp.Add("out_trade_no", out_trade_no); sParaTemp.Add("subject", _subject); sParaTemp.Add("body", body); sParaTemp.Add("total_fee", total_fee); sParaTemp.Add("paymethod", paymethod); sParaTemp.Add("defaultbank", defaultbank); sParaTemp.Add("anti_phishing_key", anti_phishing_key); sParaTemp.Add("exter_invoke_ip", exter_invoke_ip); sParaTemp.Add("extra_common_param", extra_common_param); sParaTemp.Add("buyer_email", buyer_email); sParaTemp.Add("royalty_type", royalty_type); sParaTemp.Add("royalty_parameters", royalty_parameters); //构造即时到帐接口表单提交HTML数据,无需修改 Service ali = new Service(); string sHtmlText = ali.Create_direct_pay_by_user(sParaTemp); Response.Write(sHtmlText); }
protected void Page_Load(object sender, EventArgs e) { //读取站点配置信息 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); //=============================获得订单信息================================ string order_no = DTRequest.GetFormString("pay_order_no").ToUpper(); decimal order_amount = DTRequest.GetFormDecimal("pay_order_amount", 0); string user_name = DTRequest.GetFormString("pay_user_name"); string subject = DTRequest.GetFormString("pay_subject"); //检查参数是否正确 if (string.IsNullOrEmpty(order_no) || order_amount == 0) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您提交的参数有误!"))); return; } //===============================判断订单================================== if (order_no.StartsWith("R")) //R开头为在线充值订单 { Model.user_recharge model = new BLL.user_recharge().GetModel(order_no); if (model == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您充值的订单号不存在或已删除!"))); return; } if (model.amount != order_amount) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您充值的订单金额与实际金额不一致!"))); return; } } else //B开头为商品订单 { Model.orders model = new BLL.orders().GetModel(order_no); if (model == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您支付的订单号不存在或已删除!"))); return; } if (model.order_amount != order_amount) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您支付的订单金额与实际金额不一致!"))); return; } } if (user_name != "") { user_name = "支付会员:" + user_name; } else { user_name = "匿名用户"; } //===============================建立请求================================== string GATEWAY_NEW = "http://wappaygw.alipay.com/service/rest.htm?"; //支付宝网关地址 string format = "xml"; //返回格式,必填,不需要修改 string v = "2.0"; //必填,不需要修改 string req_id = DateTime.Now.ToString("yyyyMMddHHmmss"); //必填,须保证每次请求都是唯一 //请求业务参数详细,必填 string req_dataToken = "<direct_trade_create_req><notify_url>" + Config.Notify_url + "</notify_url><call_back_url>" + Config.Return_url + "</call_back_url><seller_account_name>" + Config.Seller_email + "</seller_account_name><out_trade_no>" + order_no + "</out_trade_no><subject>" + siteConfig.webname + "-" + subject + "</subject><total_fee>" + order_amount.ToString() + "</total_fee><merchant_url></merchant_url></direct_trade_create_req>"; //把请求参数打包成数组 Dictionary <string, string> sParaTempToken = new Dictionary <string, string>(); sParaTempToken.Add("partner", Config.Partner); sParaTempToken.Add("_input_charset", Config.Input_charset.ToLower()); sParaTempToken.Add("sec_id", Config.Sign_type.ToUpper()); sParaTempToken.Add("service", "alipay.wap.trade.create.direct"); sParaTempToken.Add("format", format); sParaTempToken.Add("v", v); sParaTempToken.Add("req_id", req_id); sParaTempToken.Add("req_data", req_dataToken); //建立请求 string sHtmlTextToken = Submit.BuildRequest(GATEWAY_NEW, sParaTempToken); //URLDECODE返回的信息 System.Text.Encoding code = System.Text.Encoding.GetEncoding(Config.Input_charset); sHtmlTextToken = HttpUtility.UrlDecode(sHtmlTextToken, code); //解析远程模拟提交后返回的信息 Dictionary <string, string> dicHtmlTextToken = Submit.ParseResponse(sHtmlTextToken); //获取token string request_token = dicHtmlTextToken["request_token"]; //业务详细,必填 string req_data = "<auth_and_execute_req><request_token>" + request_token + "</request_token></auth_and_execute_req>"; //把请求参数打包成数组 Dictionary <string, string> sParaTemp = new Dictionary <string, string>(); sParaTemp.Add("partner", Config.Partner); sParaTemp.Add("_input_charset", Config.Input_charset.ToLower()); sParaTemp.Add("sec_id", Config.Sign_type.ToUpper()); sParaTemp.Add("service", "alipay.wap.auth.authAndExecute"); sParaTemp.Add("format", format); sParaTemp.Add("v", v); sParaTemp.Add("req_data", req_data); //建立请求 string sHtmlText = Submit.BuildRequest(GATEWAY_NEW, sParaTemp, "get", "确认"); Response.Write(sHtmlText); }
private void apply_add(HttpContext context) { if (job_id == 0) { context.Response.Write("{\"status\": 0, \"msg\": \"对不起,您应聘的职位不存在或已被管理员删除!\"}"); return; } StringBuilder strTxt = new StringBuilder(); BLL.job_apply bll = new BLL.job_apply(); Model.job_apply model = new Model.job_apply(); string RealName = DTRequest.GetFormString("txtRealName"); string Sex = DTRequest.GetFormString("txtSex"); string Birth = DTRequest.GetFormString("txtBirth"); string Marital = DTRequest.GetFormString("txtMarital"); string Origin = DTRequest.GetFormString("txtOrigin"); string Hobby = DTRequest.GetFormString("txtHobby"); string School = DTRequest.GetFormString("txtSchool"); string Degree = DTRequest.GetFormString("Degree"); string Profess = DTRequest.GetFormString("txtProfess"); string IDNum = DTRequest.GetFormString("txtIDNum"); string Address = DTRequest.GetFormString("txtAddress"); string Tel = DTRequest.GetFormString("txtTel"); string Email = DTRequest.GetFormString("txtEmail"); string Salary = DTRequest.GetFormString("txtSalary"); string EducationExperience = DTRequest.GetFormString("txtEducationExperience"); string WorkExperience = DTRequest.GetFormString("txtWorkExperience"); string SelfContent = Utils.ToHtml(DTRequest.GetFormString("txtSelfContent")); if (string.IsNullOrEmpty(Degree)) { context.Response.Write("{\"status\": 0, \"msg\": \"对不起,学历不能为空!\"}"); return; } if (string.IsNullOrEmpty(RealName)) { context.Response.Write("{\"status\": 0, \"msg\": \"对不起,姓名不能为空!\"}"); return; } if (string.IsNullOrEmpty(Sex)) { context.Response.Write("{\"status\": 0, \"msg\": \"对不起,性别姓名不能为空!\"}"); return; } if (string.IsNullOrEmpty(Tel)) { context.Response.Write("{\"status\": 0, \"msg\": \"对不起,电话是必须要填的!\"}"); return; } // 检查其他项 if (string.IsNullOrEmpty(Birth)) { Birth = ""; } if (string.IsNullOrEmpty(Marital)) { Marital = ""; } if (string.IsNullOrEmpty(Origin)) { Origin = ""; } if (string.IsNullOrEmpty(Hobby)) { Hobby = ""; } if (string.IsNullOrEmpty(School)) { School = ""; } if (string.IsNullOrEmpty(Degree)) { Degree = ""; } if (string.IsNullOrEmpty(Profess)) { Profess = ""; } if (string.IsNullOrEmpty(IDNum)) { IDNum = ""; } if (string.IsNullOrEmpty(Address)) { Address = ""; } if (string.IsNullOrEmpty(Email)) { Email = ""; } if (string.IsNullOrEmpty(Salary)) { Salary = ""; } if (string.IsNullOrEmpty(EducationExperience)) { EducationExperience = ""; } if (string.IsNullOrEmpty(WorkExperience)) { WorkExperience = ""; } if (string.IsNullOrEmpty(SelfContent)) { SelfContent = ""; } model.job_id = job_id; model.RealName = RealName; model.Sex = Sex; model.Birth = Birth; model.Marital = Marital; model.Origin = Origin; model.Hobby = Hobby; model.School = School; model.Degree = Degree; model.Profess = Profess; model.IDNum = IDNum; model.Address = Address; model.Tel = Tel; model.Email = Email; model.Salary = Salary; model.EducationExperience = EducationExperience; model.WorkExperience = WorkExperience; model.SelfContent = SelfContent; model.is_see = 0; model.sort_id = 1; model.add_time = DateTime.Now; if (bll.Add(model)) { context.Response.Write("{\"status\": 1, \"msg\": \"恭喜您,简历提交成功啦!我们会尽快和您取得联系。\"}"); return; } context.Response.Write("{\"status\": 0, \"msg\": \"对不起,保存过程中发生错误!\"}"); return; }
protected void btnExcel_Click(object sender, EventArgs e) { _cusName = DTRequest.GetString("txtCusName"); _cid = DTRequest.GetString("hCusId"); _method = DTRequest.GetFormString("ddlmethod"); _check = DTRequest.GetFormString("ddlcheck"); _check2 = DTRequest.GetFormString("ddlcheck2"); _isconfirm = DTRequest.GetFormString("ddlisConfirm"); _sforedate = DTRequest.GetFormString("txtsforedate"); _eforedate = DTRequest.GetFormString("txteforedate"); _sdate = DTRequest.GetFormString("txtsdate"); _edate = DTRequest.GetFormString("txtedate"); _num = DTRequest.GetFormString("txtNum"); _chk = DTRequest.GetFormString("txtChk"); _numdate = DTRequest.GetFormString("txtNumDate"); _sign = DTRequest.GetFormString("ddlsign"); _money = DTRequest.GetFormString("txtMoney"); _moneyType = DTRequest.GetFormString("ddlmoneyType"); _type = DTRequest.GetFormString("ddlType"); _addperson = DTRequest.GetFormString("txtAddPerson"); BLL.ReceiptPay bll = new BLL.ReceiptPay(); DataTable dt = bll.GetList(this.pageSize, this.page, "rp_type=0 " + CombSqlTxt(), "isnull(rp_date,'3000-01-01') desc,isnull(pm_sort,-1) asc,rp_id desc", out this.totalCount, out _tmoney, out _tunmoney, false).Tables[0]; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=付款通知列表.xlsx"); //HttpUtility.UrlEncode(fileName)); HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"; HSSFWorkbook hssfworkbook = new HSSFWorkbook(); ISheet sheet = hssfworkbook.CreateSheet("明细"); IFont font = hssfworkbook.CreateFont(); font.Boldweight = short.MaxValue; font.FontHeightInPoints = 11; #region 表格样式 //设置单元格的样式:水平垂直对齐居中 ICellStyle cellStyle = hssfworkbook.CreateCellStyle(); cellStyle.Alignment = HorizontalAlignment.Center; cellStyle.VerticalAlignment = VerticalAlignment.Center; cellStyle.BorderBottom = BorderStyle.Thin; cellStyle.BorderLeft = BorderStyle.Thin; cellStyle.BorderRight = BorderStyle.Thin; cellStyle.BorderTop = BorderStyle.Thin; cellStyle.BottomBorderColor = HSSFColor.Black.Index; cellStyle.LeftBorderColor = HSSFColor.Black.Index; cellStyle.RightBorderColor = HSSFColor.Black.Index; cellStyle.TopBorderColor = HSSFColor.Black.Index; cellStyle.WrapText = true;//自动换行 //设置表头的样式:水平垂直对齐居中,加粗 ICellStyle titleCellStyle = hssfworkbook.CreateCellStyle(); titleCellStyle.Alignment = HorizontalAlignment.Center; titleCellStyle.VerticalAlignment = VerticalAlignment.Center; titleCellStyle.FillForegroundColor = HSSFColor.Grey25Percent.Index; //图案颜色 titleCellStyle.FillPattern = FillPattern.SparseDots; //图案样式 titleCellStyle.FillBackgroundColor = HSSFColor.Grey25Percent.Index; //背景颜色 //设置边框 titleCellStyle.BorderBottom = BorderStyle.Thin; titleCellStyle.BorderLeft = BorderStyle.Thin; titleCellStyle.BorderRight = BorderStyle.Thin; titleCellStyle.BorderTop = BorderStyle.Thin; titleCellStyle.BottomBorderColor = HSSFColor.Black.Index; titleCellStyle.LeftBorderColor = HSSFColor.Black.Index; titleCellStyle.RightBorderColor = HSSFColor.Black.Index; titleCellStyle.TopBorderColor = HSSFColor.Black.Index; //设置字体 titleCellStyle.SetFont(font); #endregion //表头 IRow headRow = sheet.CreateRow(0); headRow.HeightInPoints = 25; headRow.CreateCell(0).SetCellValue("付款对象"); headRow.CreateCell(1).SetCellValue("凭证"); headRow.CreateCell(2).SetCellValue("付款内容"); headRow.CreateCell(3).SetCellValue("客户银行账号"); headRow.CreateCell(4).SetCellValue("付款金额"); headRow.CreateCell(5).SetCellValue("未分配金额"); headRow.CreateCell(6).SetCellValue("预付日期"); headRow.CreateCell(7).SetCellValue("付款方式"); headRow.CreateCell(8).SetCellValue("实付日期"); headRow.CreateCell(9).SetCellValue("申请人"); headRow.CreateCell(10).SetCellValue("财务审批"); headRow.CreateCell(11).SetCellValue("总经理审批"); headRow.CreateCell(12).SetCellValue("确认收款"); headRow.GetCell(0).CellStyle = titleCellStyle; headRow.GetCell(1).CellStyle = titleCellStyle; headRow.GetCell(2).CellStyle = titleCellStyle; headRow.GetCell(3).CellStyle = titleCellStyle; headRow.GetCell(4).CellStyle = titleCellStyle; headRow.GetCell(5).CellStyle = titleCellStyle; headRow.GetCell(6).CellStyle = titleCellStyle; headRow.GetCell(7).CellStyle = titleCellStyle; headRow.GetCell(8).CellStyle = titleCellStyle; headRow.GetCell(9).CellStyle = titleCellStyle; headRow.GetCell(10).CellStyle = titleCellStyle; headRow.GetCell(11).CellStyle = titleCellStyle; headRow.GetCell(12).CellStyle = titleCellStyle; sheet.SetColumnWidth(0, 15 * 256); sheet.SetColumnWidth(1, 20 * 256); sheet.SetColumnWidth(2, 20 * 256); sheet.SetColumnWidth(3, 20 * 256); sheet.SetColumnWidth(4, 20 * 256); sheet.SetColumnWidth(5, 15 * 256); sheet.SetColumnWidth(6, 20 * 256); sheet.SetColumnWidth(7, 20 * 256); sheet.SetColumnWidth(8, 20 * 256); sheet.SetColumnWidth(9, 20 * 256); sheet.SetColumnWidth(10, 20 * 256); sheet.SetColumnWidth(11, 20 * 256); sheet.SetColumnWidth(12, 20 * 256); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { IRow row = sheet.CreateRow(i + 1); row.HeightInPoints = 22; row.CreateCell(0).SetCellValue(dt.Rows[i]["c_name"].ToString() + (Utils.StrToBool(Utils.ObjectToStr(dt.Rows[i]["rp_isExpect"]), false) ? "[预]" : "")); row.CreateCell(1).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["ce_num"])); row.CreateCell(2).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["rp_content"])); row.CreateCell(3).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["cb_bankName"]) + "\r\n" + Utils.ObjectToStr(dt.Rows[i]["cb_bankNum"]) + "\r\n" + Utils.ObjectToStr(dt.Rows[i]["cb_bank"])); row.CreateCell(4).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["rp_money"])); row.CreateCell(5).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["undistribute"])); row.CreateCell(6).SetCellValue(ConvertHelper.toDate(dt.Rows[i]["rp_foredate"]).Value.ToString("yyyy-MM-dd")); row.CreateCell(7).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["pm_name"])); row.CreateCell(8).SetCellValue(ConvertHelper.toDate(dt.Rows[i]["rp_date"]) == null ? "" : ConvertHelper.toDate(dt.Rows[i]["rp_date"]).Value.ToString("yyyy-MM-dd")); row.CreateCell(9).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["rp_personName"])); row.CreateCell(10).SetCellValue(dt.Rows[i]["rp_flag"].ToString() == "0" ? "待审批" : dt.Rows[i]["rp_flag"].ToString() == "1" ? "审批未通过" : "审批通过"); row.CreateCell(11).SetCellValue(dt.Rows[i]["rp_flag1"].ToString() == "0" ? "待审批" : dt.Rows[i]["rp_flag1"].ToString() == "1" ? "审批未通过" : "审批通过"); row.CreateCell(12).SetCellValue(Utils.StrToBool(Utils.ObjectToStr(dt.Rows[i]["rp_isConfirm"]), false) ? "已收款" : "待收款"); row.GetCell(0).CellStyle = cellStyle; row.GetCell(1).CellStyle = cellStyle; row.GetCell(2).CellStyle = cellStyle; row.GetCell(3).CellStyle = cellStyle; row.GetCell(4).CellStyle = cellStyle; row.GetCell(5).CellStyle = cellStyle; row.GetCell(6).CellStyle = cellStyle; row.GetCell(7).CellStyle = cellStyle; row.GetCell(8).CellStyle = cellStyle; row.GetCell(9).CellStyle = cellStyle; row.GetCell(10).CellStyle = cellStyle; row.GetCell(11).CellStyle = cellStyle; row.GetCell(12).CellStyle = cellStyle; } } MemoryStream file = new MemoryStream(); hssfworkbook.Write(file); HttpContext.Current.Response.BinaryWrite(file.GetBuffer()); HttpContext.Current.Response.End(); }
protected void btnExcel_Click(object sender, EventArgs e) { _ordernum = DTRequest.GetFormString("txtOrder"); _cusname = DTRequest.GetFormString("txtCusName"); _cusid = DTRequest.GetFormString("hCusId"); _status = DTRequest.GetFormString("ddlcheck"); _type = DTRequest.GetFormString("ddltype"); _smonth = DTRequest.GetString("txtsDate"); _emonth = DTRequest.GetString("txteDate"); BLL.finance bll = new BLL.finance(); DataTable dt = bll.GetList1(this.pageSize, this.page, CombSqlTxt(), "fin_adddate desc,fin_id desc", out this.totalCount, false).Tables[0]; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=审批未通过应收付.xlsx"); //HttpUtility.UrlEncode(fileName)); HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"; HSSFWorkbook hssfworkbook = new HSSFWorkbook(); ISheet sheet = hssfworkbook.CreateSheet("明细"); IFont font = hssfworkbook.CreateFont(); font.Boldweight = short.MaxValue; font.FontHeightInPoints = 11; #region 表格样式 //设置单元格的样式:水平垂直对齐居中 ICellStyle cellStyle = hssfworkbook.CreateCellStyle(); cellStyle.Alignment = HorizontalAlignment.Center; cellStyle.VerticalAlignment = VerticalAlignment.Center; cellStyle.BorderBottom = BorderStyle.Thin; cellStyle.BorderLeft = BorderStyle.Thin; cellStyle.BorderRight = BorderStyle.Thin; cellStyle.BorderTop = BorderStyle.Thin; cellStyle.BottomBorderColor = HSSFColor.Black.Index; cellStyle.LeftBorderColor = HSSFColor.Black.Index; cellStyle.RightBorderColor = HSSFColor.Black.Index; cellStyle.TopBorderColor = HSSFColor.Black.Index; cellStyle.WrapText = true;//自动换行 //设置表头的样式:水平垂直对齐居中,加粗 ICellStyle titleCellStyle = hssfworkbook.CreateCellStyle(); titleCellStyle.Alignment = HorizontalAlignment.Center; titleCellStyle.VerticalAlignment = VerticalAlignment.Center; titleCellStyle.FillForegroundColor = HSSFColor.Grey25Percent.Index; //图案颜色 titleCellStyle.FillPattern = FillPattern.SparseDots; //图案样式 titleCellStyle.FillBackgroundColor = HSSFColor.Grey25Percent.Index; //背景颜色 //设置边框 titleCellStyle.BorderBottom = BorderStyle.Thin; titleCellStyle.BorderLeft = BorderStyle.Thin; titleCellStyle.BorderRight = BorderStyle.Thin; titleCellStyle.BorderTop = BorderStyle.Thin; titleCellStyle.BottomBorderColor = HSSFColor.Black.Index; titleCellStyle.LeftBorderColor = HSSFColor.Black.Index; titleCellStyle.RightBorderColor = HSSFColor.Black.Index; titleCellStyle.TopBorderColor = HSSFColor.Black.Index; //设置字体 titleCellStyle.SetFont(font); #endregion //表头 IRow headRow = sheet.CreateRow(0); headRow.HeightInPoints = 25; headRow.CreateCell(0).SetCellValue("订单号"); headRow.CreateCell(1).SetCellValue("收付性质"); headRow.CreateCell(2).SetCellValue("应收付对象"); headRow.CreateCell(3).SetCellValue("对账凭证"); headRow.CreateCell(4).SetCellValue("业务性质/明细"); headRow.CreateCell(5).SetCellValue("业务日期"); headRow.CreateCell(6).SetCellValue("业务说明"); headRow.CreateCell(7).SetCellValue("金额表达式"); headRow.CreateCell(8).SetCellValue("金额"); headRow.CreateCell(9).SetCellValue("区域"); headRow.CreateCell(10).SetCellValue("结账月份"); headRow.CreateCell(11).SetCellValue("审批状态"); headRow.CreateCell(12).SetCellValue("添加人"); headRow.GetCell(0).CellStyle = titleCellStyle; headRow.GetCell(1).CellStyle = titleCellStyle; headRow.GetCell(2).CellStyle = titleCellStyle; headRow.GetCell(3).CellStyle = titleCellStyle; headRow.GetCell(4).CellStyle = titleCellStyle; headRow.GetCell(5).CellStyle = titleCellStyle; headRow.GetCell(6).CellStyle = titleCellStyle; headRow.GetCell(7).CellStyle = titleCellStyle; headRow.GetCell(8).CellStyle = titleCellStyle; headRow.GetCell(9).CellStyle = titleCellStyle; headRow.GetCell(10).CellStyle = titleCellStyle; headRow.GetCell(11).CellStyle = titleCellStyle; headRow.GetCell(12).CellStyle = titleCellStyle; sheet.SetColumnWidth(0, 15 * 256); sheet.SetColumnWidth(1, 20 * 256); sheet.SetColumnWidth(2, 20 * 256); sheet.SetColumnWidth(3, 20 * 256); sheet.SetColumnWidth(4, 20 * 256); sheet.SetColumnWidth(5, 15 * 256); sheet.SetColumnWidth(6, 20 * 256); sheet.SetColumnWidth(7, 20 * 256); sheet.SetColumnWidth(8, 20 * 256); sheet.SetColumnWidth(9, 20 * 256); sheet.SetColumnWidth(10, 20 * 256); sheet.SetColumnWidth(11, 15 * 256); sheet.SetColumnWidth(12, 15 * 256); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { IRow row = sheet.CreateRow(i + 1); row.HeightInPoints = 22; row.CreateCell(0).SetCellValue(dt.Rows[i]["fin_oid"].ToString()); row.CreateCell(1).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["fin_type"]) == "True"?"应收":"应付"); row.CreateCell(2).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["c_name"])); row.CreateCell(3).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["chk"])); row.CreateCell(4).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["na_name"]) + "/" + Utils.ObjectToStr(dt.Rows[i]["fin_detail"])); row.CreateCell(5).SetCellValue(ConvertHelper.toDate(dt.Rows[i]["fin_sdate"]).Value.ToString("yyyy-MM-dd") + "-" + ConvertHelper.toDate(dt.Rows[i]["fin_edate"]).Value.ToString("yyyy-MM-dd")); row.CreateCell(6).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["fin_illustration"])); row.CreateCell(7).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["fin_expression"])); row.CreateCell(8).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["fin_money"])); row.CreateCell(9).SetCellValue(dt.Rows[i]["fin_area"].ToString()); row.CreateCell(10).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["fin_month"])); row.CreateCell(11).SetCellValue(dt.Rows[i]["fin_flag"].ToString() == "0" ? "待审批" : dt.Rows[i]["fin_flag"].ToString() == "1" ? "审批未通过" : "审批通过"); row.CreateCell(12).SetCellValue(dt.Rows[i]["fin_personName"].ToString()); row.GetCell(0).CellStyle = cellStyle; row.GetCell(1).CellStyle = cellStyle; row.GetCell(2).CellStyle = cellStyle; row.GetCell(3).CellStyle = cellStyle; row.GetCell(4).CellStyle = cellStyle; row.GetCell(5).CellStyle = cellStyle; row.GetCell(6).CellStyle = cellStyle; row.GetCell(7).CellStyle = cellStyle; row.GetCell(8).CellStyle = cellStyle; row.GetCell(9).CellStyle = cellStyle; row.GetCell(10).CellStyle = cellStyle; row.GetCell(11).CellStyle = cellStyle; row.GetCell(12).CellStyle = cellStyle; } } MemoryStream file = new MemoryStream(); hssfworkbook.Write(file); HttpContext.Current.Response.BinaryWrite(file.GetBuffer()); HttpContext.Current.Response.End(); }
private bool DoEdit(int _id) { bool result = true; BLL.article bll = new BLL.article(); Model.article_goods model = bll.GetGoodsModel(_id); model.channel_id = this.channel_id; model.title = txtTitle.Text.Trim(); model.category_id = Utils.StringToNum(ddlCategoryId.SelectedValue); model.goods_no = txtY.Text; //model.stock_quantity = Utils.StringToNum(txtStockQuantity.Text); model.sell_price = decimal.Parse(txtMarketPrice.Text); model.market_price = decimal.Parse(txtPrice.Text); // 租金 //model.sell_price = decimal.Parse(txtSellPrice.Text); model.point = Utils.StringToNum(ddlArea.SelectedValue); //使用分區 model.single_price = decimal.Parse(txtSinglePrice.Text); // 单价 //model.link_url = txtLinkUrl.Text.Trim(); model.img_url = DTRequest.GetFormString("focus_photo"); model.content = txtContent.Value; model.seo_title = txtSeoTitle.Text.Trim(); model.seo_keywords = txtSeoKeywords.Text.Trim(); model.seo_description = txtSeoDescription.Text.Trim(); //model.sort_id = Utils.StringToNum(txtSortId.Text.Trim()); //model.click = Utils.StringToNum(txtClick.Text.Trim()); // model.digg_good = Utils.StringToNum(txtDiggGood.Text.Trim()); //model.digg_bad = Utils.StringToNum(txtDiggBad.Text.Trim()); model.add_time = Utils.StrToDateTime(txtTime.Text.ToString(), DateTime.Now); model.is_msg = 0; model.is_top = 0; model.is_red = 0; model.is_hot = 0; model.is_slide = 0; model.is_lock = 0; model.lianxiren = txtuser.Text; //model.shangpinType = txtshangpintype.Text; //if (cblItem.Items[0].Selected == true) //{ // model.is_msg = 1; //} //if (cblItem.Items[1].Selected == true) //{ // model.is_top = 1; //} //if (cblItem.Items[2].Selected == true) //{ // model.is_red = 1; //} //if (cblItem.Items[3].Selected == true) //{ // model.is_hot = 1; //} //if (cblItem.Items[4].Selected == true) //{ // model.is_slide = 1; //} //if (cblItem.Items[5].Selected == true) //{ // model.is_lock = 1; //} //用戶組價格 //List<Model.goods_group_price> priceList = new List<Model.goods_group_price>(); //for (int i = 0; i < rptPrice.Items.Count; i++) //{ // int hidPriceId = 0; // if (!string.IsNullOrEmpty(((HiddenField)rptPrice.Items[i].FindControl("hidePriceId")).Value)) // { // hidPriceId = Convert.ToInt32(((HiddenField)rptPrice.Items[i].FindControl("hidePriceId")).Value); // } // int hidGroupId = Convert.ToInt32(((HiddenField)rptPrice.Items[i].FindControl("hideGroupId")).Value); // decimal _price = Convert.ToDecimal(((TextBox)rptPrice.Items[i].FindControl("txtGroupPrice")).Text.Trim()); // priceList.Add(new Model.goods_group_price { id = hidPriceId, article_id = _id, group_id = hidGroupId, price = _price }); //} //model.goods_group_prices = priceList; //儲存相冊 if (model.albums != null) { model.albums.Clear(); } string[] albumArr = Request.Form.GetValues("hide_photo_name"); string[] remarkArr = Request.Form.GetValues("hide_photo_remark"); if (albumArr != null) { List <Model.article_albums> ls = new List <Model.article_albums>(); for (int i = 0; i < albumArr.Length; i++) { string[] imgArr = albumArr[i].Split('|'); int img_id = Utils.StringToNum(imgArr[0]); if (imgArr.Length == 3) { if (!string.IsNullOrEmpty(remarkArr[i])) { ls.Add(new Model.article_albums { id = img_id, article_id = _id, big_img = imgArr[1], small_img = imgArr[2], remark = remarkArr[i] }); } else { ls.Add(new Model.article_albums { id = img_id, article_id = _id, big_img = imgArr[1], small_img = imgArr[2] }); } } } model.albums = ls; } //擴展屬性 BLL.attributes bll2 = new BLL.attributes(); DataSet ds2 = bll2.GetList("channel_id=" + this.channel_id); List <Model.attribute_value> attrls = new List <Model.attribute_value>(); foreach (DataRow dr in ds2.Tables[0].Rows) { int attr_id = Utils.StringToNum(dr["id"].ToString()); string attr_title = dr["title"].ToString(); string attr_value_id = Request.Form["value_" + attr_id]; string attr_value_content = Request.Form["content_" + attr_id]; if (!string.IsNullOrEmpty(attr_value_id) && !string.IsNullOrEmpty(attr_value_content)) { attrls.Add(new Model.attribute_value { id = Convert.ToInt32(attr_value_id), article_id = _id, attribute_id = attr_id, title = attr_title, content = attr_value_content }); } } model.attribute_values = attrls; model.Postid = CheckBoxList1.SelectedValue; model.Type = Utils.StringToNum(cblItem.SelectedValue); //if (!string.IsNullOrEmpty(ddlquyu.SelectedValue)) //{ // model.quyu = Convert.ToInt32(ddlquyu.SelectedValue); //} //if (!string.IsNullOrEmpty(ddljiaqian.SelectedValue)) //{ // model.jiaqianQJ = Convert.ToInt32(ddljiaqian.SelectedValue); //} model.mianji = Utils.StringToNum(txtMianJi.Text); //if (!string.IsNullOrEmpty(ddlhuxing.SelectedValue)) //{ // model.huxing = Convert.ToInt32(ddlhuxing.SelectedValue); //} //if (!string.IsNullOrEmpty(ddlfangshi.SelectedValue)) //{ // model.fangshi = Convert.ToInt32(ddlfangshi.SelectedValue); //} if (!string.IsNullOrEmpty(ddlditie.SelectedValue)) { model.xianlu = Convert.ToInt32(ddlditie.SelectedValue); } model.yajin = string.IsNullOrEmpty(txtyajin.Text) ? 0 : Convert.ToInt32(txtyajin.Text); //model.zuoxiang = txtzuoxiang.Text; //model.louceng = txtlouceng.Text; //model.xingneng = txtxingneng.Text; model.yongtu = txtyongtu.Text; model.chewei = chkPort.Checked == true ? "有" : "無"; model.shequ = txtNo.Text.Trim(); model.dizhi = txtdizhi.Text; model.gongsi = txtgongsi.Text; //model.fuwuxiangju = txtfuwxiangmu.Text; model.dianhua = txtdianhua.Text; model.Areaid = Convert.ToInt32(ddlAreaid.SelectedValue); model.Status = 1; model.xiajialiyou = xiajiatext.Value; #region 土地參數 model.link_url = txtDImu.Text.Trim(); //地目 model.fuwuxiangju = txtChiFen.Text.Trim(); //尺寸 model.jiaqianQJ = Utils.StringToNum(txtRongyiLv.Text.Trim()); //容積率 model.shangpinType = txtNowPrice.Text.Trim(); //公告現值 model.quyu = Utils.StringToNum(txtJianBiLv.Text.Trim()); //建蔽率 model.stock_quantity = chkDiShangWu.Checked == true ? 1 : 0; //投螢幕; //model.fangshi = Utils.StringToNum(ddlForm.SelectedValue); //形式 model.xingneng = txtUserTo.Text; //現況用途 model.huxing = Utils.StringToNum(txtRoadsWidth.Text.Trim()); #endregion if (!bll.Update(model)) { result = false; } return(result); }
protected void Page_Load(object sender, EventArgs e) { //读取站点配置信息 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); //=============================获得订单信息================================ string order_no = DTRequest.GetFormString("pay_order_no").ToUpper(); //订单号 decimal order_amount = DTRequest.GetFormDecimal("pay_order_amount", 0); //订单金额 string user_name = DTRequest.GetFormString("pay_user_name"); //支付用户名 string subject = DTRequest.GetFormString("pay_subject"); //备注说明 string trans_type = string.Empty; //交易类型1实物2虚拟 if (order_no == "" || order_amount == 0) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您提交的参数有误!"))); return; } if (order_no.StartsWith("R")) //R开头为在线充值订单 { Model.user_amount_log model = new BLL.user_amount_log().GetModel(order_no); if (model == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您充值的订单号不存在或已删除!"))); return; } if (model.value != order_amount) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您充值的订单金额与实际金额不一致!"))); return; } trans_type = "2"; } else //B开头为商品订单 { Model.orders model = new BLL.orders().GetModel(order_no); if (model == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您支付的订单号不存在或已删除!"))); return; } if (model.order_amount != order_amount) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您支付的订单金额与实际金额不一致!"))); return; } trans_type = "1"; } //检查会员还是匿名 if (user_name != "") { user_name = "支付会员:" + user_name; } else { user_name = "匿名用户"; } //===============================请求参数================================== //创建RequestHandler实例 RequestHandler reqHandler = new RequestHandler(Context); //初始化 reqHandler.init(); //设置密钥 reqHandler.setKey(TenpayUtil.key); reqHandler.setGateUrl("https://gw.tenpay.com/gateway/pay.htm"); //----------------------------- //设置支付参数 //----------------------------- reqHandler.setParameter("partner", TenpayUtil.partner); //商户号 reqHandler.setParameter("out_trade_no", order_no); //商家订单号 reqHandler.setParameter("total_fee", (Convert.ToDouble(order_amount) * 100).ToString()); //商品金额,以分为单位 reqHandler.setParameter("return_url", TenpayUtil.return_url); //交易完成后跳转的URL reqHandler.setParameter("notify_url", TenpayUtil.notify_url); //接收财付通通知的URL reqHandler.setParameter("body", user_name); //商品描述 reqHandler.setParameter("bank_type", "DEFAULT"); //银行类型(中介担保时此参数无效) reqHandler.setParameter("spbill_create_ip", Page.Request.UserHostAddress); //用户的公网ip,不是商户服务器IP reqHandler.setParameter("fee_type", "1"); //币种,1人民币 reqHandler.setParameter("subject", siteConfig.webname + "-" + subject); //商品名称(中介交易时必填) //系统可选参数 reqHandler.setParameter("sign_type", "MD5"); reqHandler.setParameter("service_version", "1.0"); reqHandler.setParameter("input_charset", "UTF-8"); reqHandler.setParameter("sign_key_index", "1"); //业务可选参数 reqHandler.setParameter("product_fee", "0"); //商品费用,必须保证transport_fee + product_fee=total_fee reqHandler.setParameter("transport_fee", "0"); //物流费用,必须保证transport_fee + product_fee=total_fee reqHandler.setParameter("time_start", DateTime.Now.ToString("yyyyMMddHHmmss")); //订单生成时间,格式为yyyymmddhhmmss reqHandler.setParameter("time_expire", ""); //订单失效时间,格式为yyyymmddhhmmss reqHandler.setParameter("buyer_id", ""); //买方财付通账号 reqHandler.setParameter("goods_tag", ""); //商品标记 reqHandler.setParameter("trade_mode", TenpayUtil.type); //交易模式,1即时到账(默认),2中介担保,3后台选择(买家进支付中心列表选择) reqHandler.setParameter("transport_desc", ""); //物流说明 reqHandler.setParameter("trans_type", "1"); //交易类型,1实物交易,2虚拟交易 reqHandler.setParameter("agentid", ""); //平台ID reqHandler.setParameter("agent_type", ""); //代理模式,0无代理(默认),1表示卡易售模式,2表示网店模式 reqHandler.setParameter("seller_id", ""); //卖家商户号,为空则等同于partner //获取请求带参数的url string requestUrl = reqHandler.getRequestURL(); //实现自动跳转=============================== StringBuilder sbHtml = new StringBuilder(); sbHtml.Append("<form id='tenpaysubmit' name='tenpaysubmit' action='" + reqHandler.getGateUrl() + "' method='get'>"); Hashtable ht = reqHandler.getAllParameters(); foreach (DictionaryEntry de in ht) { sbHtml.Append("<input type=\"hidden\" name=\"" + de.Key + "\" value=\"" + de.Value + "\" >\n"); } //submit按钮控件请不要含有name属性 sbHtml.Append("<input type='submit' value='确认' style='display:none;'></form>"); sbHtml.Append("<script>document.forms['tenpaysubmit'].submit();</script>"); Response.Write(sbHtml.ToString()); }
public void ProcessRequest(HttpContext context) { string action = DTRequest.GetFormString("action"); LogHelper.WriteInfo("LINE19:" + action); switch (action) { case "get_holidays": OutPut(context, TourAPI.get_holidays()); break; case "get_channel_article_news": OutPut(context, TourAPI.get_channel_article_news(1000)); break; case "get_channel_article_news_top5": OutPut(context, TourAPI.get_channel_article_news(5)); break; case "get_channel_article_news_detail": OutPut(context, TourAPI.get_channel_article_news_detail( DTRequest.GetFormIntValue("id"))); break; case "get_channel_article_goods": OutPut(context, TourAPI.get_channel_article_goods()); break; case "get_channel_article_goods_detail": OutPut(context, TourAPI.get_channel_article_goods_detail(DTRequest.GetFormIntValue("id"))); break; case "get_channel_article_content": OutPut(context, TourAPI.get_channel_article_content()); break; case "get_channel_article_content_detail": OutPut(context, TourAPI.get_channel_article_content_detail(DTRequest.GetFormIntValue("id"))); break; case "get_channel_article_food": OutPut(context, TourAPI.get_channel_article_food()); break; case "get_channel_article_food_detail": OutPut(context, TourAPI.get_channel_article_food_detail(DTRequest.GetFormIntValue("id"))); break; case "get_channel_article_guidance": OutPut(context, TourAPI.get_channel_article_guidance()); break; case "get_channel_article_guidance_detail": OutPut(context, TourAPI.get_channel_article_guidance_detail( DTRequest.GetFormIntValue("id"))); break; case "getOpenId": OutPut(context, TourAPI.getOpenId( DTRequest.GetFormString("code"))); break; case "add_or_update_user": OutPut(context, TourAPI.add_or_update_user( DTRequest.GetFormString("openid"), DTRequest.GetFormString("unionid"), DTRequest.GetFormString("photo"), DTRequest.GetFormIntValue("sex"), DTRequest.GetFormString("nickname"), DTRequest.GetFormIntValue("age"), DTRequest.GetFormString("phone"), DTRequest.GetFormString("interest"), DTRequest.GetFormFloat("latitude", -1), DTRequest.GetFormFloat("longitude", -1), DTRequest.GetFormFloat("accuracy", -1))); break; case "get_brand_list": OutPut(context, TourAPI.get_brand_list()); break; case "get_brand_detail": OutPut(context, TourAPI.get_brand_detail( DTRequest.GetFormIntValue("id"))); break; case "getAppCard": OutPut(context, TourAPI.getAppCard( DTRequest.GetFormString("card_id"))); break; case "coupon_query_store": OutPut(context, TourAPI.coupon_query_store()); break; case "coupon_query_coupon": OutPut(context, TourAPI.coupon_query_coupon( DTRequest.GetFormString("poi_id"))); break; case "coupon_query_user": OutPut(context, TourAPI.coupon_query_user( DTRequest.GetFormString("unionid"))); break; case "getUnionId": OutPut(context, TourAPI.getUnionId( DTRequest.GetFormString("session_key"), DTRequest.GetFormString("iv"), DTRequest.GetFormString("encryptedData"))); break; default: OutPut(context, "not implement action : " + action); break; } }
protected void Page_Load(object sender, EventArgs e) { //读取站点配置信息 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); //=============================获得订单信息================================ string order_no = DTRequest.GetFormString("pay_order_no").ToUpper(); decimal order_amount = DTRequest.GetFormDecimal("pay_order_amount", 0); string user_name = DTRequest.GetFormString("pay_user_name"); string subject = DTRequest.GetFormString("pay_subject"); //以下收货人信息 string receive_name = string.Empty; //收货人姓名 string receive_address = string.Empty; //收货人地址 string receive_zip = string.Empty; //收货人邮编 string receive_phone = string.Empty; //收货人电话 string receive_mobile = string.Empty; //收货人手机 //检查参数是否正确 if (string.IsNullOrEmpty(order_no) || order_amount == 0) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您提交的参数有误!"))); return; } if (order_no.StartsWith("R")) //R开头为在线充值订单 { Model.user_recharge model = new BLL.user_recharge().GetModel(order_no); if (model == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您充值的订单号不存在或已删除!"))); return; } if (model.amount != order_amount) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您充值的订单金额与实际金额不一致!"))); return; } //取得用户信息 Model.users userModel = new BLL.users().GetModel(model.user_id); if (userModel == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,用户账户不存在或已删除!"))); return; } receive_name = userModel.nick_name; receive_address = userModel.address; receive_phone = userModel.telphone; receive_mobile = userModel.mobile; } else //B开头为商品订单 { Model.orders model = new BLL.orders().GetModel(order_no); if (model == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您支付的订单号不存在或已删除!"))); return; } if (model.order_amount != order_amount) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您支付的订单金额与实际金额不一致!"))); return; } receive_name = model.accept_name; receive_address = model.address; receive_zip = model.post_code; receive_phone = model.telphone; receive_mobile = model.mobile; } if (user_name != "") { user_name = "支付会员:" + user_name; } else { user_name = "匿名用户"; } //===============================请求参数================================== //判断担保或是即时到帐接口 if (Config.Type == "1") //即时到帐 { //把请求参数打包成数组 SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>(); sParaTemp.Add("payment_type", "1"); //收款类型1商品购买 sParaTemp.Add("show_url", siteConfig.weburl); //商品展示地址 sParaTemp.Add("out_trade_no", order_no); //网站订单号 sParaTemp.Add("subject", siteConfig.webname + "-" + subject); //订单名称 sParaTemp.Add("body", user_name); //订单描述 sParaTemp.Add("total_fee", order_amount.ToString()); //订单总金额 sParaTemp.Add("paymethod", ""); //默认支付方式 sParaTemp.Add("defaultbank", ""); //默认网银代号 sParaTemp.Add("anti_phishing_key", ""); //防钓鱼时间戳 sParaTemp.Add("exter_invoke_ip", DTRequest.GetIP()); ////获取客户端的IP地址 sParaTemp.Add("buyer_email", ""); //默认买家支付宝账号 sParaTemp.Add("royalty_type", ""); sParaTemp.Add("royalty_parameters", ""); //构造即时到帐接口表单提交HTML数据,无需修改 Service ali = new Service(); string sHtmlText = ali.Create_direct_pay_by_user(sParaTemp); Response.Write(sHtmlText); } else //担保交易 { //把请求参数打包成数组 SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>(); sParaTemp.Add("payment_type", "1"); //收款类型1商品购买 sParaTemp.Add("out_trade_no", order_no); //网站订单号 sParaTemp.Add("subject", siteConfig.webname + "-" + subject); //订单名称 sParaTemp.Add("price", order_amount.ToString()); //付款金额 sParaTemp.Add("quantity", "1"); //建议默认为1,不改变值,把一次交易看成是一次下订单而非购买一件商品 sParaTemp.Add("logistics_fee", "0.00"); //物流费用 sParaTemp.Add("logistics_type", "EXPRESS"); //物流类型,EXPRESS(快递)、POST(平邮)、EMS(EMS) sParaTemp.Add("logistics_payment", "SELLER_PAY"); //物流支付方式,SELLER_PAY(卖家承担运费)、BUYER_PAY(买家承担运费) sParaTemp.Add("body", user_name); //订单描述 sParaTemp.Add("show_url", siteConfig.weburl); //商品展示地址 sParaTemp.Add("receive_name", receive_name); //收货人姓名 sParaTemp.Add("receive_address", receive_address); //收货人地址 sParaTemp.Add("receive_zip", receive_zip); //收货人邮编 sParaTemp.Add("receive_phone", receive_phone); //收货人电话号码 sParaTemp.Add("receive_mobile", receive_mobile); //收货人手机号码 //构造即时到帐接口表单提交HTML数据,无需修改 Service ali = new Service(); string sHtmlText = ali.Create_partner_trade_by_buyer(sParaTemp); Response.Write(sHtmlText); } }
protected void btnExcel_Click(object sender, EventArgs e) { _smonth = DTRequest.GetFormString("txtsDate"); _emonth = DTRequest.GetFormString("txteDate"); _type = DTRequest.GetFormString("ddltype"); _area = DTRequest.GetFormString("ddlarea"); DataTable dt = bll.getFinancialCustomer(this.pageSize, this.page, CombSqlTxt(), "fin_type desc,c_name asc", out this.totalCount, out _tmoney1, out _tmoney2, false).Tables[0]; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=已结账应收付明细账.xlsx"); //HttpUtility.UrlEncode(fileName)); HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"; HSSFWorkbook hssfworkbook = new HSSFWorkbook(); ISheet sheet = hssfworkbook.CreateSheet("明细"); IFont font = hssfworkbook.CreateFont(); font.Boldweight = short.MaxValue; font.FontHeightInPoints = 11; #region 表格样式 //设置单元格的样式:水平垂直对齐居中 ICellStyle cellStyle = hssfworkbook.CreateCellStyle(); cellStyle.Alignment = HorizontalAlignment.Center; cellStyle.VerticalAlignment = VerticalAlignment.Center; cellStyle.BorderBottom = BorderStyle.Thin; cellStyle.BorderLeft = BorderStyle.Thin; cellStyle.BorderRight = BorderStyle.Thin; cellStyle.BorderTop = BorderStyle.Thin; cellStyle.BottomBorderColor = HSSFColor.Black.Index; cellStyle.LeftBorderColor = HSSFColor.Black.Index; cellStyle.RightBorderColor = HSSFColor.Black.Index; cellStyle.TopBorderColor = HSSFColor.Black.Index; cellStyle.WrapText = true;//自动换行 //设置表头的样式:水平垂直对齐居中,加粗 ICellStyle titleCellStyle = hssfworkbook.CreateCellStyle(); titleCellStyle.Alignment = HorizontalAlignment.Center; titleCellStyle.VerticalAlignment = VerticalAlignment.Center; titleCellStyle.FillForegroundColor = HSSFColor.Grey25Percent.Index; //图案颜色 titleCellStyle.FillPattern = FillPattern.SparseDots; //图案样式 titleCellStyle.FillBackgroundColor = HSSFColor.Grey25Percent.Index; //背景颜色 //设置边框 titleCellStyle.BorderBottom = BorderStyle.Thin; titleCellStyle.BorderLeft = BorderStyle.Thin; titleCellStyle.BorderRight = BorderStyle.Thin; titleCellStyle.BorderTop = BorderStyle.Thin; titleCellStyle.BottomBorderColor = HSSFColor.Black.Index; titleCellStyle.LeftBorderColor = HSSFColor.Black.Index; titleCellStyle.RightBorderColor = HSSFColor.Black.Index; titleCellStyle.TopBorderColor = HSSFColor.Black.Index; //设置字体 titleCellStyle.SetFont(font); #endregion //表头 IRow headRow = sheet.CreateRow(0); headRow.HeightInPoints = 25; headRow.CreateCell(0).SetCellValue("应收付客户"); headRow.CreateCell(1).SetCellValue("收付类别"); headRow.CreateCell(2).SetCellValue("开始月份"); headRow.CreateCell(3).SetCellValue("结束月份"); headRow.CreateCell(4).SetCellValue("应收付金额"); headRow.GetCell(0).CellStyle = titleCellStyle; headRow.GetCell(1).CellStyle = titleCellStyle; headRow.GetCell(2).CellStyle = titleCellStyle; headRow.GetCell(3).CellStyle = titleCellStyle; headRow.GetCell(4).CellStyle = titleCellStyle; sheet.SetColumnWidth(0, 15 * 256); sheet.SetColumnWidth(1, 20 * 256); sheet.SetColumnWidth(2, 20 * 256); sheet.SetColumnWidth(3, 20 * 256); sheet.SetColumnWidth(4, 20 * 256); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { IRow row = sheet.CreateRow(i + 1); row.HeightInPoints = 22; row.CreateCell(0).SetCellValue(dt.Rows[i]["c_name"].ToString()); row.CreateCell(1).SetCellValue(dt.Rows[i]["fin_type"].ToString() == "True"?"收":"付"); row.CreateCell(2).SetCellValue(_smonth); row.CreateCell(3).SetCellValue(_emonth); row.CreateCell(4).SetCellValue(dt.Rows[i]["fin_money"].ToString()); row.GetCell(0).CellStyle = cellStyle; row.GetCell(1).CellStyle = cellStyle; row.GetCell(2).CellStyle = cellStyle; row.GetCell(3).CellStyle = cellStyle; row.GetCell(4).CellStyle = cellStyle; } } MemoryStream file = new MemoryStream(); hssfworkbook.Write(file); HttpContext.Current.Response.BinaryWrite(file.GetBuffer()); HttpContext.Current.Response.End(); }
protected void btnExcel_Click(object sender, EventArgs e) { flag = DTRequest.GetFormString("flag"); _type = DTRequest.GetFormString("type"); _orderid = DTRequest.GetFormString("txtOrderID"); _cusName = DTRequest.GetFormString("txtCusName"); _cid = DTRequest.GetFormString("hCusId"); _contractPrice = DTRequest.GetFormString("ddlContractPrice"); _status = DTRequest.GetFormString("ddlstatus"); _dstatus = DTRequest.GetFormString("ddldstatus"); _pushstatus = DTRequest.GetFormString("ddlispush"); _flag = DTRequest.GetFormString("ddlflag"); _lockstatus = DTRequest.GetFormString("ddllock"); _content = DTRequest.GetFormString("txtContent"); _address = DTRequest.GetFormString("txtAddress"); _sign = DTRequest.GetFormString("ddlsign"); _money = DTRequest.GetFormString("txtMoney"); _person1 = DTRequest.GetFormString("txtPerson1"); _person2 = DTRequest.GetFormString("txtPerson2"); _person3 = DTRequest.GetFormString("txtPerson3"); _person4 = DTRequest.GetFormString("txtPerson4"); _person5 = DTRequest.GetFormString("txtPerson5"); _sdate = DTRequest.GetFormString("txtsDate"); _edate = DTRequest.GetFormString("txteDate"); _sdate1 = DTRequest.GetFormString("txtsDate1"); _edate1 = DTRequest.GetFormString("txteDate1"); _sdate2 = DTRequest.GetFormString("txtsDate2"); _edate2 = DTRequest.GetFormString("txteDate2"); _area = DTRequest.GetFormString("ddlarea"); _orderarea = DTRequest.GetFormString("ddlorderarea"); BLL.Order bll = new BLL.Order(); DataTable dt = bll.GetList(this.pageSize, this.page, "1=1" + CombSqlTxt(), whereOrderBy, out this.totalCount, false, "", false, orderType, currentUser).Tables[0]; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=订单列表.xlsx"); //HttpUtility.UrlEncode(fileName)); HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"; HSSFWorkbook hssfworkbook = new HSSFWorkbook(); ISheet sheet = hssfworkbook.CreateSheet("明细"); IFont font = hssfworkbook.CreateFont(); font.Boldweight = short.MaxValue; font.FontHeightInPoints = 11; #region 表格样式 //设置单元格的样式:水平垂直对齐居中 ICellStyle cellStyle = hssfworkbook.CreateCellStyle(); cellStyle.Alignment = HorizontalAlignment.Center; cellStyle.VerticalAlignment = VerticalAlignment.Center; cellStyle.BorderBottom = BorderStyle.Thin; cellStyle.BorderLeft = BorderStyle.Thin; cellStyle.BorderRight = BorderStyle.Thin; cellStyle.BorderTop = BorderStyle.Thin; cellStyle.BottomBorderColor = HSSFColor.Black.Index; cellStyle.LeftBorderColor = HSSFColor.Black.Index; cellStyle.RightBorderColor = HSSFColor.Black.Index; cellStyle.TopBorderColor = HSSFColor.Black.Index; cellStyle.WrapText = true;//自动换行 //设置表头的样式:水平垂直对齐居中,加粗 ICellStyle titleCellStyle = hssfworkbook.CreateCellStyle(); titleCellStyle.Alignment = HorizontalAlignment.Center; titleCellStyle.VerticalAlignment = VerticalAlignment.Center; titleCellStyle.FillForegroundColor = HSSFColor.Grey25Percent.Index; //图案颜色 titleCellStyle.FillPattern = FillPattern.SparseDots; //图案样式 titleCellStyle.FillBackgroundColor = HSSFColor.Grey25Percent.Index; //背景颜色 //设置边框 titleCellStyle.BorderBottom = BorderStyle.Thin; titleCellStyle.BorderLeft = BorderStyle.Thin; titleCellStyle.BorderRight = BorderStyle.Thin; titleCellStyle.BorderTop = BorderStyle.Thin; titleCellStyle.BottomBorderColor = HSSFColor.Black.Index; titleCellStyle.LeftBorderColor = HSSFColor.Black.Index; titleCellStyle.RightBorderColor = HSSFColor.Black.Index; titleCellStyle.TopBorderColor = HSSFColor.Black.Index; //设置字体 titleCellStyle.SetFont(font); #endregion //表头 IRow headRow = sheet.CreateRow(0); headRow.HeightInPoints = 25; headRow.CreateCell(0).SetCellValue("订单号"); headRow.CreateCell(1).SetCellValue("活动名称"); headRow.CreateCell(2).SetCellValue("活动地点"); headRow.CreateCell(3).SetCellValue("客户"); headRow.CreateCell(4).SetCellValue("合同造价"); headRow.CreateCell(5).SetCellValue("活动日期"); headRow.CreateCell(6).SetCellValue("归属地"); headRow.CreateCell(7).SetCellValue("订单状态"); headRow.CreateCell(8).SetCellValue("推送状态"); headRow.CreateCell(9).SetCellValue("上级审批"); headRow.CreateCell(10).SetCellValue("锁单状态"); headRow.CreateCell(11).SetCellValue("业务员"); headRow.CreateCell(12).SetCellValue("报账人员"); headRow.CreateCell(13).SetCellValue("策划人员"); headRow.CreateCell(14).SetCellValue("设计人员"); headRow.CreateCell(15).SetCellValue("应收款"); headRow.CreateCell(16).SetCellValue("未收款"); headRow.CreateCell(17).SetCellValue("业绩利润"); headRow.CreateCell(18).SetCellValue("确认时间"); headRow.GetCell(0).CellStyle = titleCellStyle; headRow.GetCell(1).CellStyle = titleCellStyle; headRow.GetCell(2).CellStyle = titleCellStyle; headRow.GetCell(3).CellStyle = titleCellStyle; headRow.GetCell(4).CellStyle = titleCellStyle; headRow.GetCell(5).CellStyle = titleCellStyle; headRow.GetCell(6).CellStyle = titleCellStyle; headRow.GetCell(7).CellStyle = titleCellStyle; headRow.GetCell(8).CellStyle = titleCellStyle; headRow.GetCell(9).CellStyle = titleCellStyle; headRow.GetCell(10).CellStyle = titleCellStyle; headRow.GetCell(11).CellStyle = titleCellStyle; headRow.GetCell(12).CellStyle = titleCellStyle; headRow.GetCell(13).CellStyle = titleCellStyle; headRow.GetCell(14).CellStyle = titleCellStyle; headRow.GetCell(15).CellStyle = titleCellStyle; headRow.GetCell(16).CellStyle = titleCellStyle; headRow.GetCell(17).CellStyle = titleCellStyle; headRow.GetCell(18).CellStyle = titleCellStyle; sheet.SetColumnWidth(0, 15 * 256); sheet.SetColumnWidth(1, 20 * 256); sheet.SetColumnWidth(2, 20 * 256); sheet.SetColumnWidth(3, 20 * 256); sheet.SetColumnWidth(4, 20 * 256); sheet.SetColumnWidth(5, 30 * 256); sheet.SetColumnWidth(6, 20 * 256); sheet.SetColumnWidth(7, 20 * 256); sheet.SetColumnWidth(8, 20 * 256); sheet.SetColumnWidth(9, 20 * 256); sheet.SetColumnWidth(10, 15 * 256); sheet.SetColumnWidth(11, 15 * 256); sheet.SetColumnWidth(12, 15 * 256); sheet.SetColumnWidth(13, 15 * 256); sheet.SetColumnWidth(14, 15 * 256); sheet.SetColumnWidth(15, 15 * 256); sheet.SetColumnWidth(16, 15 * 256); sheet.SetColumnWidth(17, 15 * 256); sheet.SetColumnWidth(18, 25 * 256); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { IRow row = sheet.CreateRow(i + 1); row.HeightInPoints = 22; row.CreateCell(0).SetCellValue(dt.Rows[i]["o_id"].ToString()); row.CreateCell(1).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["o_content"])); row.CreateCell(2).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["o_address"])); row.CreateCell(3).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["c_name"])); row.CreateCell(4).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["o_contractPrice"])); row.CreateCell(5).SetCellValue(ConvertHelper.toDate(dt.Rows[i]["o_sdate"]).Value.ToString("yyyy-MM-dd") + "/" + ConvertHelper.toDate(dt.Rows[i]["o_sdate"]).Value.ToString("yyyy-MM-dd")); row.CreateCell(6).SetCellValue(new BLL.department().getAreaText(Utils.ObjectToStr(dt.Rows[i]["o_place"]))); row.CreateCell(7).SetCellValue(BusinessDict.fStatus()[Utils.ObjToByte(dt.Rows[i]["o_status"])]); row.CreateCell(8).SetCellValue(BusinessDict.pushStatus()[Utils.StrToBool(Utils.ObjectToStr(dt.Rows[i]["o_isPush"]), false)]); row.CreateCell(9).SetCellValue(BusinessDict.checkStatus()[Utils.ObjToByte(dt.Rows[i]["o_flag"])]); row.CreateCell(10).SetCellValue(BusinessDict.lockStatus()[Utils.ObjToByte(dt.Rows[i]["o_lockStatus"])]); row.CreateCell(11).SetCellValue(dt.Rows[i]["op_name"].ToString()); row.CreateCell(12).SetCellValue(dt.Rows[i]["person2"].ToString()); row.CreateCell(13).SetCellValue(dt.Rows[i]["person3"].ToString()); row.CreateCell(14).SetCellValue(dt.Rows[i]["person4"].ToString()); row.CreateCell(15).SetCellValue(dt.Rows[i]["finMoney"].ToString()); row.CreateCell(16).SetCellValue(dt.Rows[i]["unMoney"].ToString()); row.CreateCell(17).SetCellValue(dt.Rows[i]["profit"].ToString()); row.CreateCell(18).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["o_statusTime"]) == ""?"":Utils.ObjectToDateTime(dt.Rows[i]["o_statusTime"]).ToString("yyyy-MM-dd HH:mm:ss")); row.GetCell(0).CellStyle = cellStyle; row.GetCell(1).CellStyle = cellStyle; row.GetCell(2).CellStyle = cellStyle; row.GetCell(3).CellStyle = cellStyle; row.GetCell(4).CellStyle = cellStyle; row.GetCell(5).CellStyle = cellStyle; row.GetCell(6).CellStyle = cellStyle; row.GetCell(7).CellStyle = cellStyle; row.GetCell(8).CellStyle = cellStyle; row.GetCell(9).CellStyle = cellStyle; row.GetCell(10).CellStyle = cellStyle; row.GetCell(11).CellStyle = cellStyle; row.GetCell(12).CellStyle = cellStyle; row.GetCell(13).CellStyle = cellStyle; row.GetCell(14).CellStyle = cellStyle; row.GetCell(15).CellStyle = cellStyle; row.GetCell(16).CellStyle = cellStyle; row.GetCell(17).CellStyle = cellStyle; row.GetCell(18).CellStyle = cellStyle; } } MemoryStream file = new MemoryStream(); hssfworkbook.Write(file); HttpContext.Current.Response.BinaryWrite(file.GetBuffer()); HttpContext.Current.Response.End(); }
private void feedback_add(HttpContext context) { StringBuilder strTxt = new StringBuilder(); BLL.plugin_feedback bll = new BLL.plugin_feedback(); Model.plugin_feedback model = new Model.plugin_feedback(); string _site_path = DTRequest.GetQueryString("site"); string _code = DTRequest.GetFormString("txtCode"); string _title = DTRequest.GetFormString("txtTitle"); string _content = DTRequest.GetFormString("txtContent"); string _user_name = DTRequest.GetFormString("txtUserName"); string _user_tel = DTRequest.GetFormString("txtUserTel"); string _user_qq = DTRequest.GetFormString("txtUserQQ"); string _user_email = DTRequest.GetFormString("txtUserEmail"); //检查站点目录 if (string.IsNullOrEmpty(_site_path)) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,网站传输参数有误!\"}"); return; } //校检验证码 if (string.IsNullOrEmpty(_code)) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,请输入验证码!\"}"); return; } if (context.Session[DTKeys.SESSION_CODE] == null) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,验证码已过期!\"}"); return; } if (_code.ToLower() != (context.Session[DTKeys.SESSION_CODE].ToString()).ToLower()) { context.Response.Write("{\"status\":0, \"msg\":\"验证码与系统的不一致!\"}"); return; } if (string.IsNullOrEmpty(_content)) { context.Response.Write("{\"status\": 0, \"msg\": \"对不起,请输入留言的内容!\"}"); return; } model.site_path = Utils.DropHTML(_site_path); model.title = Utils.DropHTML(_title); model.content = Utils.ToHtml(_content); model.user_name = Utils.DropHTML(_user_name); model.user_tel = Utils.DropHTML(_user_tel); model.user_qq = Utils.DropHTML(_user_qq); model.user_email = Utils.DropHTML(_user_email); model.add_time = DateTime.Now; model.is_lock = 1; //不需要审核,请改为0 if (bll.Add(model) > 0) { //是否开启通知功能 if (config.bookmsg > 0 && config.receive != "") { switch (config.bookmsg) { case 1: DTcms.Model.sms_template smsModel = new DTcms.BLL.sms_template().GetModel(config.booktemplet); //取得短信内容 if (smsModel != null) { //替换模板内容 string smstxt = smsModel.content; smstxt = smstxt.Replace("{webname}", siteConfig.webname); smstxt = smstxt.Replace("{webtel}", siteConfig.webtel); smstxt = smstxt.Replace("{weburl}", siteConfig.weburl); smstxt = smstxt.Replace("{username}", model.user_name); smstxt = smstxt.Replace("{usertel}", model.user_tel); smstxt = smstxt.Replace("{userqq}", model.user_qq); smstxt = smstxt.Replace("{useremail}", model.user_email); smstxt = smstxt.Replace("{usertitle}", model.title); smstxt = smstxt.Replace("{usercontent}", model.content); //发送短信 string tipMsg = string.Empty; bool result = new DTcms.BLL.sms_message().Send(config.receive, smstxt, 1, out tipMsg); if (!result) { LogHelper.WriteLog("手机信息发送失败!"); } } break; case 2: //获得邮件内容 DTcms.Model.mail_template mailModel = new DTcms.BLL.mail_template().GetModel(config.booktemplet); if (mailModel != null) { //替换模板内容 string titletxt = mailModel.maill_title; string bodytxt = mailModel.content; titletxt = titletxt.Replace("{webname}", siteConfig.webname); titletxt = titletxt.Replace("{username}", model.user_name); bodytxt = bodytxt.Replace("{webname}", siteConfig.webname); bodytxt = bodytxt.Replace("{webtel}", siteConfig.webtel); bodytxt = bodytxt.Replace("{weburl}", siteConfig.weburl); bodytxt = bodytxt.Replace("{username}", model.user_name); bodytxt = bodytxt.Replace("{usertel}", model.user_tel); bodytxt = bodytxt.Replace("{userqq}", model.user_qq); bodytxt = bodytxt.Replace("{useremail}", model.user_email); bodytxt = bodytxt.Replace("{usertitle}", model.title); bodytxt = bodytxt.Replace("{usercontent}", model.content); //循环发送 string[] emailArr = config.receive.Split(','); foreach (string email in emailArr) { if (DTcms.Common.Utils.IsValidEmail(email)) { //发送邮件 try { DTMail.sendMail(siteConfig.emailsmtp, siteConfig.emailssl, siteConfig.emailusername, DESEncrypt.Decrypt(siteConfig.emailpassword, siteConfig.sysencryptstring), siteConfig.emailnickname, siteConfig.emailfrom, email, titletxt, bodytxt); } catch { LogHelper.WriteLog("邮件发送失败!"); } } } } break; } } context.Response.Write("{\"status\": 1, \"msg\": \"恭喜您,留言提交成功!\"}"); return; } context.Response.Write("{\"status\": 0, \"msg\": \"对不起,保存过程中发生错误!\"}"); return; }