protected void btnExcel_Click(object sender, EventArgs e) { if (listRes.Count == 0) { PageFunc.AjaxAlert(this.Page, "数据为空,请先统计查询!"); } else { DateTime dtStart = DateTime.Parse(txtDateStart.Text); DateTime dtEnd = DateTime.Parse(txtDateEnd.Text); string fileName = string.Format("{0}-{1}_{2}_{3}_{4}.xls", dtStart.ToString("yyyy-MM-dd"), dtEnd.ToString("yyyy-MM-dd"), string.IsNullOrEmpty(ddlAccount.SelectedValue)?"全部帐号":ddlAccount.SelectedValue, string.IsNullOrEmpty(ddlAccount.SelectedValue) ? "全部推广位" : ddlAppKeyID.SelectedItem.Text, DateTime.Now.ToString("yyyy-MM-dd")); ExcelHelp <Model.TljStatXls> excelH = new ExcelHelp <Model.TljStatXls>(); Hashtable ht = new Hashtable(); ht.Add("dotime", "日期"); ht.Add("yj", "预估佣金"); ht.Add("yjds", "预估到手佣金"); ht.Add("use_amount", "淘礼金支出"); ht.Add("md_amount", "免单金额"); ht.Add("ykresult", "盈亏情况"); ht.Add("md_count", "免单数量"); excelH.getExcel(listRes, ht, fileName); } }
protected void BtnUpdate_Click(object sender, EventArgs e) { if (Request.QueryString["id"] != null) { int id = int.Parse(Request.QueryString["id"]); string username = txtUserName.Text.Trim(); var model = bllAdmin.GetModel(p => p.ID != id && p.UserName.Equals(username)); if (model != null) { PageFunc.AjaxAlert(this.Page, "用户名已存在!"); return; } modelAdmin = bllAdmin.GetModel(int.Parse(Request.QueryString["id"])); modelAdmin.UserName = username; if (txtPwd.Text != "重新设置密码") { modelAdmin.UserPwd = PageFunc.Encrypt(txtPwd.Text, 1); } modelAdmin.Enabled = chbIsEnabled.Checked; modelAdmin.UserType = ddlUserType.SelectedValue; modelAdmin.Remark = txtRemark.Text.Trim(); modelAdmin.TbAccount = ddlAccount.SelectedValue; bllAdmin.Update(modelAdmin); Response.Write(PageFunc.ShowMsgJumpE("更新成功!", "AdminList.aspx")); } }
private void add() { string planLink = txtplan_link.Text.Trim(); string camId = ""; Regex reg = new Regex("campaignId=(.+)&?"); Match match = reg.Match(planLink); camId = match.Groups[1].Value; var model = bllplans.GetModel(p => p.planlink.ToLower() == planLink || p.campaignId == camId); if (model != null) { PageFunc.AjaxAlert(this.Page, "计划链接已存在!"); return; } modelplans = new Model.plans(); modelplans.item_id = txtitem_id.Text.Trim(); modelplans.goodsname = txtgoodsname.Text.Trim(); modelplans.pic = txtitem_pic.Value.Trim(); modelplans.planname = txtplan_name.Text.Trim(); modelplans.campaignId = txtcampaignId.Text.Trim(); modelplans.planlink = txtplan_link.Text.Trim(); modelplans.coupon_url = txtquan_link.Text.Trim(); modelplans.commission_dx = txtcommission_dx.Text.Trim(); modelplans.commission_MKT = txtcommission_MKT.Text.Trim(); modelplans.ifok = "正常"; modelplans.zctime = DateTime.Now; decimal paymoney = 0m; decimal.TryParse(txtPayMoney.Text.Trim(), out paymoney); modelplans.PayMoney = paymoney; bllplans.Add(modelplans); Response.Write(PageFunc.ShowMsgJumpE("添加成功!", "plansList.aspx")); }
protected void BtnLogin_Click(object sender, EventArgs e) { BLL.Admin bllAdmin = new BLL.Admin(); if (Session["SSVC"] != null) { if (this.txtCode.Text.Trim().ToLower() != Session["SSVC"].ToString().ToLower()) { PageFunc.AjaxAlert(this.Page, "错误的验证码,请重新输入!"); this.txtCode.Text = ""; } else { var uModel = bllAdmin.AdminLogin(this.txtUserName.Text.Trim(), PageFunc.Encrypt(this.txtPassWd.Text, 1)); if (uModel != null) { if (!uModel.Enabled) { PageFunc.AjaxAlert(this.Page, "该帐号已被停用!"); this.txtCode.Text = ""; } else { AdminPage basePage = new AdminPage(); Session[basePage.sessionAdminModel] = uModel; Response.Redirect("TljList.aspx"); } } else { PageFunc.AjaxAlert(this.Page, "用户名或密码有误!"); this.txtCode.Text = ""; } } } else { PageFunc.AjaxAlert(this.Page, "验证码无效,请重新刷新!"); this.txtCode.Text = ""; } }
protected void BtnSubmit_Click(object sender, EventArgs e) { string username = txtUserName.Text.Trim(); var model = bllAdmin.GetModel(p => p.UserName.Equals(username)); if (model != null) { PageFunc.AjaxAlert(this.Page, "用户名已存在!"); return; } modelAdmin.UserName = username; modelAdmin.UserPwd = PageFunc.Encrypt(txtPwd.Text, 1); modelAdmin.AddTime = DateTime.Now; modelAdmin.Enabled = chbIsEnabled.Checked; modelAdmin.UserType = ddlUserType.SelectedValue; modelAdmin.Remark = txtRemark.Text.Trim(); modelAdmin.TbAccount = ddlAccount.SelectedValue; bllAdmin.Add(modelAdmin); Response.Write(PageFunc.ShowMsgJumpE("添加成功!", "AdminList.aspx")); }