private bool DoAdd() { ax_ticket model = new ax_ticket(); if (model.Exists(txtticket_no.Text.Trim())) { JscriptMsg(this.Page, "您输入的礼券名称已经存在,请检查!", "", "Error"); return(false); } model.ticket_no = txtticket_no.Text.Trim(); model.ticket_pw = txtticket_pw.Text.Trim(); model.pid = int.Parse(ddlCategoryId.SelectedValue.Trim()); model.add_time = Utils.StrToDateTime(txtAddTime.Text.Trim() + " 23:59:59"); if (cbIsLock.Checked == true) { model.status = 2; } else { model.status = 1; } if (model.Add() > 0) { AddAdminLog("添加", "添加礼券:" + txtticket_no.Text); //记录日志 return(true); } return(false); }
private void RptBind(string _strWhere, string _orderby) { this.page = AXRequest.GetQueryInt("page", 1); if (this.status > 0) { this.ddlStatus.SelectedValue = this.status.ToString(); } if (this.category_id > 0) { this.ddlCategoryId.SelectedValue = this.category_id.ToString(); } txtKeywords.Text = this.keywords; txtstart_time.Value = this.start_time; txtstop_time.Value = this.stop_time; ax_ticket bll = new ax_ticket(); this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("ticket_list.aspx", "status={0}&category_id={1}&keywords={2}&start_time={3}&stop_time={4}&page={5}", this.status.ToString(), this.category_id.ToString(), this.keywords, this.txtstart_time.Value, this.txtstop_time.Value, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
// 单个删除 protected void lbtnDelCa_Click(object sender, EventArgs e) { //检查权限 if (ChkAdminLevel(this.Page, 41, "Delete")) { // 当前点击的按钮 LinkButton lb = (LinkButton)sender; int caId = int.Parse(lb.CommandArgument); ax_article bll = new ax_article(); bll.GetModel(caId); string title = bll.title; ax_ticket bllpp = new ax_ticket(); if (!bllpp.ExistsP(caId))//查找是否存在该礼品的礼券记录 { bll.Delete(caId); AddAdminLog("删除", "删除礼品:" + title + ""); //记录日志 JscriptMsg(this.Page, " 成功删除礼品:" + title + "", Utils.CombUrlTxt("product_list.aspx", "keywords={0}&page={1}", this.keywords, this.page.ToString()), "Success"); } else { JscriptMsg(this.Page, "该礼品已经发放过礼券,不能删除!", "", "Error"); return; } } }
protected void btnSearch_Click(object sender, EventArgs e) { ax_ticket model = new ax_ticket(); if (model.Existsfb(ticketno.Value.Trim(), 3)) { this.ClientScript.RegisterStartupScript(this.GetType(), "1", "<script> $.alert(\"<div class='message'>亲!您输入的提货编码提过货了!可以去查询订单查询订单信息了!</div>\").time(5000);</script>"); return; } if (!model.Exists(ticketno.Value.Trim(), ticketpw.Value.Trim())) { this.ClientScript.RegisterStartupScript(this.GetType(), "1", "<script> $.alert(\"<div class='message'>对不起!没有找到您输入信息的相关记录,请检查是否输入有误!</div>\").time(5000);</script>"); } else { model.GetModel(ticketno.Value.Trim()); if (model.add_time < DateTime.Now) { this.ClientScript.RegisterStartupScript(this.GetType(), "1", "<script> $.alert(\"<div class='message'>对不起!您查询的券已经过期了,不能在提货了,如有问题请联系客服!</div>\").time(5000);</script>"); } else { ShopCart.Add(model.GetID(ticketno.Value.Trim(), ticketpw.Value.Trim()), 1); PanelOrder.Visible = true; } } }
protected void btnSubmit_Click(object sender, EventArgs e) { ax_ticket model = new ax_ticket(); if (model.Existsfb(orderno.Value.Trim(), 2)) { model.GetModel(orderno.Value.Trim()); if (model.add_time < DateTime.Now) { this.ClientScript.RegisterStartupScript(this.GetType(), "1", "<script> $.alert(\"<div class='message'>对不起!您查询的券是真的,但已经过期了,不能在提货了,如有问题请联系客服!</div>\").time(5000);</script>"); } else { this.ClientScript.RegisterStartupScript(this.GetType(), "1", "<script> $.alert(\"<div class='message'>恭喜!您输入的提货编码是真的!可以去申请提货了,亲!</div>\").time(5000);</script>"); } } else if (model.Existsfb(orderno.Value.Trim(), 3)) { this.ClientScript.RegisterStartupScript(this.GetType(), "1", "<script> $.alert(\"<div class='message'>您输入的提货编码提过货了!可以去查询订单查询订单信息了,亲!</div>\").time(5000);</script>"); } else { this.ClientScript.RegisterStartupScript(this.GetType(), "1", "<script> $.alert(\"<div class='message'>没有查到您输入的提货编码,请确认输入是否正确!</div>\").time(5000);</script>"); } }
//导出报表 protected void btnExport_Click(object sender, EventArgs e) { //Response.Redirect(Utils.CombUrlTxt("ticket_rep.aspx", "status={0}&category_id={1}&keywords={2}", this.status.ToString(), this.category_id.ToString(), this.keywords)); ax_ticket mys = new ax_ticket(); string sqlstr = "id>0" + CombSqlTxt(this.status, this.category_id, this.keywords, this.start_time, this.stop_time) + "order by ticket_no asc"; DataSet tdSet = mys.GetList(sqlstr); CreateExcel(tdSet); }
// 单个删除 protected void lbtnDelCa_Click(object sender, EventArgs e) { //检查权限 if (ChkAdminLevel(this.Page, 21, "Delete")) { // 当前点击的按钮 LinkButton lb = (LinkButton)sender; int caId = int.Parse(lb.CommandArgument); ax_ticket bll = new ax_ticket(); bll.GetModel(caId); string title = bll.ticket_no; bll.Delete(caId); AddAdminLog("删除", "删除礼券编号:" + title + ""); //记录日志 JscriptMsg(this.Page, " 成功删除礼券编号:" + title + "", Utils.CombUrlTxt("ticket_list.aspx", "status={0}&category_id={1}&keywords={2}&start_time={3}&stop_time={4}&page={5}", this.status.ToString(), this.category_id.ToString(), this.keywords, this.txtstart_time.Value, this.txtstop_time.Value, this.page.ToString()), "Success"); } }
private void ShowInfo(int _id) { ax_ticket model = new ax_ticket(); model.GetModel(_id); ddlCategoryId.SelectedValue = model.pid.ToString(); txtticket_no.Text = model.ticket_no; txtticket_pw.Text = model.ticket_pw; txtAddTime.Text = Convert.ToDateTime(model.add_time).ToString("yyyy-MM-dd "); if (model.status == 2) { cbIsLock.Checked = true; } else { cbIsLock.Checked = false; } }
//批量修改到期时间 protected void btnDQ_Click(object sender, EventArgs e) { //检查权限 if (ChkAdminLevel(this.Page, 21, "Replace")) { ax_ticket bll = new ax_ticket(); Repeater rptList = new Repeater(); rptList = this.rptList; for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { bll.UpdateField(id, "add_time='" + Utils.StrToDateTime(txtAddTime.Text.Trim() + " 23:59:59") + "'"); } } JscriptMsg(this.Page, " 批量修改到期时间成功", Utils.CombUrlTxt("ticket_list.aspx", "status={0}&category_id={1}&keywords={2}&start_time={3}&stop_time={4}&page={5}", this.status.ToString(), this.category_id.ToString(), this.keywords, this.txtstart_time.Value, this.txtstop_time.Value, this.page.ToString()), "Success"); } }
private bool DoAdd() { string one = ddlCategoryId.SelectedValue.Trim();//礼品id ax_ticket bllpp = new ax_ticket(); if (!bllpp.ExistsP(int.Parse(one)))//查找是否存在该礼品的礼券记录 { int ws = one.Length; for (int i = 0; i < (8 - ws); i++) { one = one + "0"; } } else { one = bllpp.GetMaxNo(int.Parse(one)).ToString(); } ax_ticket model = new ax_ticket(); model.pid = int.Parse(ddlCategoryId.SelectedValue.Trim()); if (cbIsLock.Checked == true) { model.status = 2; } else { model.status = 1; } model.add_time = Utils.StrToDateTime(txtAddTime.Text.Trim() + " 23:59:59"); int[] arr = getNum(int.Parse(txtticket_num.Text.Trim()), 123456, 987654); for (int i = 0; i < int.Parse(txtticket_num.Text.Trim()); i++) { model.ticket_no = (int.Parse(one) + i + 1).ToString(); model.ticket_pw = arr[i].ToString(); model.Add(); } AddAdminLog("批量生成", "批量生成礼券规格:" + ddlCategoryId.SelectedItem.Text + "的礼券" + txtticket_num.Text.Trim() + "张"); //记录日志 return(true); }
/// <summary> /// 获得购物车列表 /// </summary> public static IList <cart_items> GetList() { IDictionary <string, int> dic = GetCart(); if (dic != null) { IList <cart_items> iList = new List <cart_items>(); foreach (var item in dic) { ax_ticket model = new ax_ticket(); model.GetModel(Convert.ToInt32(item.Key)); cart_items modelt = new cart_items(); modelt.id = model.id; modelt.ticket_no = model.ticket_no; iList.Add(modelt); } return(iList); } return(null); }
private bool DoEdit(int _id) { bool result = false; ax_ticket model = new ax_ticket(); if (model.Exists(txtticket_no.Text.Trim(), _id)) { JscriptMsg(this.Page, "您输入的礼券名称已经存在,请检查!", "", "Error"); return(false); } model.GetModel(_id); model.ticket_no = txtticket_no.Text.Trim(); model.ticket_pw = txtticket_pw.Text.Trim(); model.pid = int.Parse(ddlCategoryId.SelectedValue.Trim()); model.add_time = Utils.StrToDateTime(txtAddTime.Text.Trim() + " 23:59:59"); if (cbIsLock.Checked == true) { model.status = 2; } else { model.status = 1; } if (model.Update()) { AddAdminLog("修改", "修改礼券:" + txtticket_no.Text); //记录日志 result = true; } return(result); }
protected void btnSubmit_Click(object sender, EventArgs e) { //检查商品 IList <cart_items> iList = ShopCart.GetList(); //保存订单======================================================================= ax_orders model = new ax_orders(); model.order_no = Utils.GetOrderNumber(); //订单号 model.user_name = user_name.Value.Trim(); model.user_tel = user_tel.Value.Trim(); string province = AXRequest.GetFormString("province"); string city = AXRequest.GetFormString("city"); string area = AXRequest.GetFormString("area"); model.area = province + "," + city + "," + area; model.address = address.Value.Trim(); model.message = message.Value.Trim(); string goods_title = ""; //商品详细列表 List <ax_order_goods> gls = new List <ax_order_goods>(); foreach (cart_items item in iList) { ax_ticket myt = new ax_ticket(); myt.GetModel(item.id); goods_title = new ax_article().GetTitle(Convert.ToInt32(myt.pid)); gls.Add(new ax_order_goods { ticket_id = item.id, goods_id = myt.pid, goods_title = goods_title, ticket_no = item.ticket_no }); } model.order_goods = gls; if (model.Add() == 0) { this.ClientScript.RegisterStartupScript(this.GetType(), "1", "<script> $.alert(\"<div class='message'>订单保存过程中发生错误,请重新提交!</div>\").time(5000);</script>"); return; } #region 发送短信并入库 ax_syssetting mySysSetting = new ax_syssetting(); mySysSetting.GetModel(1); if (mySysSetting.MsgNum > 0 && mySysSetting.MsgOn == 1) { string user = mySysSetting.MsgName; string pass = FormsAuthentication.HashPasswordForStoringInConfigFile(FormsAuthentication.HashPasswordForStoringInConfigFile(mySysSetting.MsgPwd, "MD5").ToLower(), "MD5").ToLower(); string mobile = user_tel.Value.Trim(); string content = "尊敬的" + user_name.Value.Trim() + "客户,您的" + goods_title + "订单号:" + model.order_no + "提交成功!我们会尽快给您安排发货,请注意查收!发货信息将会发送到您的手机上!请您留意!【AH水产】"; string contentEncode = HttpUtility.UrlEncode(content, System.Text.Encoding.GetEncoding("utf-8")); string sms_url = " http://210.5.152.50:7100/submit?userName="******"&body={'content':'" + contentEncode + "','passWord':'******','expId':'','phones':['" + mobile + "'],'productId':'21','sendTime':''}&isEncrypt=0"; SMS mysms = new SMS(); mysms.GetHtmlFromUrl(sms_url); ax_msglist my = new ax_msglist(); my.CardNum = model.order_no; my.MemberName = user_name.Value.Trim(); my.MemberTel = mobile; my.Message = content; my.SendTime = System.DateTime.Now; my.OP = "提货短信"; my.Add(); mySysSetting.MsgNum = mySysSetting.MsgNum - 1; mySysSetting.UpdateMsgNum(); } #endregion //清空购物车 ShopCart.Clear("0"); PanelOrder.Visible = false; this.ClientScript.RegisterStartupScript(this.GetType(), "1", "<script> $.alert(\"<div class='message'>恭喜您!订单提交成功!我们会尽快给您安排发货,请注意查收!发货信息将会发送到您的手机上!请您留意!</div>\").time(5000);</script>"); }