protected void BtnUpdate_Click(object sender, EventArgs e) { if (Request.QueryString["id"] != null) { int id = int.Parse(Request.QueryString["id"]); modelTljInfo = bllTljInfo.GetModel(id); DateTime dtCreate = DateTime.Parse(txtcreatetime.Text.Trim()); modelTljInfo.AppKeyID = int.Parse(ddlAppKeyID.SelectedValue); modelTljInfo.item_id = txtitem_id.Text.Trim(); modelTljInfo.goodsname = txtgoodsname.Text.Trim(); modelTljInfo.quan_link = txtquan_link.Text.Trim(); modelTljInfo.name = ddlname.SelectedValue; modelTljInfo.batch = int.Parse(txtbatch.Text.Trim()); modelTljInfo.total_num = int.Parse(txttotal_num.Text.Trim()); modelTljInfo.per_face = decimal.Parse(txtper_face.Text.Trim()); modelTljInfo.user_total_win_num_limit = int.Parse(txtuser_total_win_num_limit.Text.Trim()); modelTljInfo.send_start_time = DateTime.Parse(txtsend_start_time.Text.Trim()); modelTljInfo.send_end_time = DateTime.Parse(txtsend_end_time.Text.Trim()); modelTljInfo.use_end_time = int.Parse(txtuse_end_time.Text.Trim()); modelTljInfo.createtime = dtCreate; modelTljInfo.iftop = int.Parse(ddliftop.SelectedValue); modelTljInfo.campaigntype = ddlCampaignType.SelectedValue; modelTljInfo.PayMoney = decimal.Parse(txtpagePrice.Text.Trim()); bllTljInfo.Update(modelTljInfo); Response.Write(PageFunc.ShowMsgJumpE("更新成功!", "TljList.aspx")); } }
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); } }
public static Pageable <T> CreateEnumerable <T>(Func <int?, Page <T> > firstPageFunc, Func <string?, int?, Page <T> >?nextPageFunc, int?pageSize = default) where T : notnull { PageFunc <T> first = (continuationToken, pageSizeHint) => firstPageFunc(pageSizeHint); PageFunc <T>?next = nextPageFunc != null ? new PageFunc <T>(nextPageFunc) : null; return(new FuncPageable <T>(first, next, pageSize)); }
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 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")); } }
protected void BtnSubmit_Click(object sender, EventArgs e) { var loginModel = Session[sessionAdminModel] as Model.AdminInfo; modelAdmin = bllAdmin.GetModel(loginModel.ID); modelAdmin.UserPwd = PageFunc.Encrypt(txtPwd.Text, 1); bllAdmin.Update(modelAdmin); Response.Write(PageFunc.ShowMsgJumpE("更新成功!", "ChangePwd.aspx")); }
protected void BtnSubmit_Click(object sender, EventArgs e) { modelappkey.AppKey = txtAppKey.Text.Trim(); modelappkey.AppSecret = txtAppSecret.Text.Trim(); modelappkey.AppName = txtAppName.Text.Trim(); modelappkey.TbAccount = txtTbAccount.Text.Trim(); modelappkey.IsDefault = chbIsDefault.Checked; bllappkey.Add(modelappkey); Response.Write(PageFunc.ShowMsgJumpE("添加成功!", "appkeyList.aspx")); }
private void add() { DateTime dtCreate = DateTime.Parse(txtcreatetime.Text.Trim()); int batch = int.Parse(txtbatch.Text.Trim()); for (int i = 0; i < batch; i++) { modelTljInfo = new Model.TljInfo(); modelTljInfo.AppKeyID = int.Parse(ddlAppKeyID.SelectedValue); modelTljInfo.ActiveCode = txtActiveCode.Text.Trim(); modelTljInfo.item_id = txtitem_id.Text.Trim(); modelTljInfo.goodsname = txtgoodsname.Text.Trim(); modelTljInfo.quan_link = txtquan_link.Text.Trim(); modelTljInfo.name = ddlname.SelectedValue; modelTljInfo.batch = int.Parse(txtbatch.Text.Trim()); modelTljInfo.total_num = int.Parse(txttotal_num.Text.Trim()); modelTljInfo.per_face = decimal.Parse(txtper_face.Text.Trim()); modelTljInfo.user_total_win_num_limit = int.Parse(txtuser_total_win_num_limit.Text.Trim()); modelTljInfo.send_start_time = DateTime.Parse(txtsend_start_time.Text.Trim()); modelTljInfo.send_end_time = DateTime.Parse(txtsend_end_time.Text.Trim()); modelTljInfo.use_end_time = int.Parse(txtuse_end_time.Text.Trim()); modelTljInfo.createtime = dtCreate; modelTljInfo.ifok = "未创建"; modelTljInfo.ifget = false; modelTljInfo.item_pic = txtitem_pic.Value; modelTljInfo.commission_bili = decimal.Parse(txtcommission_bili.Text.Trim()); modelTljInfo.quanPrice = decimal.Parse(txtquanPrice.Text.Trim()); modelTljInfo.zctime = DateTime.Now; modelTljInfo.remark = txtRemark.Text.Trim(); modelTljInfo.iftop = int.Parse(ddliftop.SelectedValue); modelTljInfo.campaigntype = ddlCampaignType.SelectedValue; modelTljInfo.PayMoney = decimal.Parse(txtpagePrice.Text.Trim()); decimal pagePrice = decimal.Parse(txtpagePrice.Text.Trim()); if ((pagePrice - modelTljInfo.per_face) == 0) { modelTljInfo.goodstype = "免单"; } if (pagePrice - modelTljInfo.per_face < 0) { modelTljInfo.goodstype = "负"; } modelTljInfo.AID = CurrentLoginAdmin.ID; bllTljInfo.Add(modelTljInfo); } Response.Cookies["zhanghaoid"].Value = modelTljInfo.AppKeyID.ToString(); //增加对账号的选择后 cookies的记录 Response.Cookies["zhanghaoid"].Expires = DateTime.Now.AddDays(100); Response.Write(PageFunc.ShowMsgJumpE("添加成功!", "TljList.aspx")); }
public override IEnumerable <Page <T> > AsPages(string?continuationToken = default, int?pageSizeHint = default) { PageFunc <T> pageFunc = _firstPageFunc; int? pageSize = pageSizeHint ?? _defaultPageSize; do { Page <T> pageResponse = pageFunc(continuationToken, pageSize); yield return(pageResponse); continuationToken = pageResponse.ContinuationToken; pageFunc = _nextPageFunc; } while (continuationToken != null); }
protected override void OnInit(EventArgs e) { //BLL.Admin bllAdmin = new BLL.Admin(); //var u = bllAdmin.GetModel(1); //Model.AdminInfo uModel = new Model.AdminInfo //{ // ID = u.ID, // UserName = u.UserName, // UserType = Codes.AdminRole.管理员, // TbAccount = "S1" //}; //Session[sessionAdminModel] = uModel; if (Request.QueryString["zhanghaoid"] != null) { Response.Cookies["zhanghaoid"].Value = Request.QueryString["zhanghaoid"].ToString(); } string urls = "tljlist.aspx|tljdo.aspx|change.aspx|appkeylist.aspx|appkeydo.aspx|changepwd.aspx|collectgoodslist.aspx|orderslist.aspx|plansdo.aspx|planslist.aspx|productstat.aspx|tljstat.aspx"; string currentPage = System.IO.Path.GetFileName(Request.PhysicalPath).ToLower(); if (Session[sessionAdminModel] == null && urls.IndexOf(currentPage) != -1) { if (Request.QueryString["zhanghao"] != null && Request.QueryString["mima"] != null) { string username = Request.QueryString["zhanghao"]; string userpwd = Request.QueryString["mima"]; BLL.Admin bllAdmin = new BLL.Admin(); var uModel = bllAdmin.AdminLogin(username, PageFunc.Encrypt(userpwd, 1)); if (uModel != null) { Session[sessionAdminModel] = uModel; Response.Redirect(Request.Url.ToString()); } else { Response.Write("<script language='Javascript'>alert('帐号无效!');window.parent.location='login.aspx';</script>"); Response.End(); } } } if (Session[sessionAdminModel] == null) { Response.Write("<script language='Javascript'>alert('登录超时!');window.parent.location='login.aspx';</script>"); Response.End(); } }
protected void BtnUpdate_Click(object sender, EventArgs e) { if (Request.QueryString["id"] != null) { int id = int.Parse(Request.QueryString["id"]); modelappkey = bllappkey.GetModel(id); modelappkey.AppKey = txtAppKey.Text.Trim(); modelappkey.AppSecret = txtAppSecret.Text.Trim(); modelappkey.AppName = txtAppName.Text.Trim(); modelappkey.TbAccount = txtTbAccount.Text.Trim(); modelappkey.IsDefault = chbIsDefault.Checked; bllappkey.Update(modelappkey); Response.Write(PageFunc.ShowMsgJumpE("更新成功!", "appkeyList.aspx")); } }
public override IEnumerable <Page <T> > AsPages(string?continuationToken = default, int?pageSizeHint = default) { PageFunc <T>?pageFunc = string.IsNullOrEmpty(continuationToken) ? _firstPageFunc : _nextPageFunc; if (pageFunc == null) { yield break; } int?pageSize = pageSizeHint ?? _defaultPageSize; do { Page <T> pageResponse = pageFunc(continuationToken, pageSize); yield return(pageResponse); continuationToken = pageResponse.ContinuationToken; pageFunc = _nextPageFunc; } while (!string.IsNullOrEmpty(continuationToken) && pageFunc != null); }
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")); }
public FuncPageable(PageFunc <T> firstPageFunc, PageFunc <T> nextPageFunc, int?defaultPageSize = default) { _firstPageFunc = firstPageFunc; _nextPageFunc = nextPageFunc; _defaultPageSize = defaultPageSize; }
private ApiResult DealLink(dynamic json) { ApiResult res = new ApiResult(); try { BLL.plans bllPlans = new BLL.plans(); rootDto <Model.Api.message> dto = JsonConvert.DeserializeObject <rootDto <Model.Api.message> >(json.ToString()); DateTime dtNow = DateTime.Now; DateTime dtToDay = DateTime.Parse(dtNow.ToString("yyyy-MM-dd")); string strMsg = dto.Data.msg; string[] strArr = strMsg.Split(new string[] { "http" }, StringSplitOptions.None); List <string> aLink = new List <string>(); for (int i = 0; i < strArr.Length; i++) { if (i == 0 && string.IsNullOrEmpty(strArr[0])) { continue; } string strItem = strArr[i]; int index = PageFunc.getIndex(strItem); string strLink = string.Format("http{0}", strItem.Substring(0, index)); if (strLink.IndexOf("uland.taobao.com") != -1) { } else if (strLink.IndexOf("detail.tmall.com") != -1) { string itemId = PageFunc.GetQueryString("id", strLink); string strContent = HttpHelper.HttpGet("http://g5.vipdamai.net/hcapi.ashx?gid=" + itemId); hcRoot hc = JsonConvert.DeserializeObject <hcRoot>(strContent); if (hc.error == "0") { if (hc.data != null) { int total = 0; var list = bllPlans.GetList(1, int.MaxValue, ref total, p => p.userNumberId == hc.data.seller_id && EntityFunctions.CreateDateTime(p.zctime.Value.Year, p.zctime.Value.Month, p.zctime.Value.Day, 0, 0, 0) == dtToDay, p => p.id); if (total > 0) { foreach (var item in list) { item.item_id = hc.data.num_iid; item.goodsname = hc.data.title; item.shopname = hc.data.shop_title; if (!string.IsNullOrEmpty(hc.data.coupon_info)) { string couponPrice = hc.data.coupon_info.Substring(hc.data.coupon_info.IndexOf("减") + 1).Replace("元", ""); item.coupon_price = couponPrice; item.PayMoney = decimal.Parse(hc.data.zk_final_price) - decimal.Parse(couponPrice); } else { item.PayMoney = decimal.Parse(hc.data.zk_final_price); } bllPlans.Update(item); } } else { var item = new Model.plans(); item.item_id = itemId; item.goodsname = hc.data.title; item.shopname = hc.data.shop_title; item.pic = hc.data.pict_url; item.zctime = dtNow; //item.coupon_url = hc.data.coupon_click_url; item.userNumberId = hc.data.seller_id; item.ifok = "待补充"; bllPlans.Add(item); } } } } else if (strLink.IndexOf("pub.alimama.com") != -1) { string userNumberId = PageFunc.GetQueryString("userNumberId", strLink); var model = bllPlans.GetModel(p => p.userNumberId == userNumberId && EntityFunctions.CreateDateTime(p.zctime.Value.Year, p.zctime.Value.Month, p.zctime.Value.Day, 0, 0, 0) == dtToDay); if (model != null) { model.planname = "默认计划名"; model.planlink = strLink; model.ifok = "正常"; bllPlans.Update(model); } else { model = new Model.plans(); model.planname = "默认计划名"; model.userNumberId = userNumberId; model.planlink = strLink; model.zctime = dtNow; model.ifok = "正常"; bllPlans.Add(model); } } } res.message = ""; res.success = true; } catch (Exception e) { res.success = false; res.message = "请求失败" + e.Message; LogHelper.Error(res.message, e); } return(res); }