public string RecordOrderInfo(int shopid, int userid, string orderno, string comsumer, string itemno, int siteid, double price, double amount, double total, string itemurl) { wgiAdUnionSystem.Model.wgi_orders model = new wgiAdUnionSystem.Model.wgi_orders(); model.cash = Convert.ToDecimal(total); model.companyid = shopid; model.consumer = comsumer; model.ischeck = 0; model.itemamount = Convert.ToDecimal(amount); model.itemno = itemno; model.itemprice = Convert.ToDecimal(price); //model.orderid = orderid; model.orderno = orderno; model.reason = ""; model.siteid = siteid; model.time = DateTime.Now;//或传入 model.userid = userid; //计算佣金 model.pay = Convert.ToDecimal(22); //添加订单记录 new wgiAdUnionSystem.BLL.wgi_orders().Add(model); //把佣金计入广告主 wgiAdUnionSystem.BLL.wgi_sitehost bll = new wgiAdUnionSystem.BLL.wgi_sitehost(); wgiAdUnionSystem.Model.wgi_sitehost host= bll.GetModel(userid); decimal newBlance= Convert.ToDecimal(host.balance) + Convert.ToDecimal(model.pay); bll.UpdateBlance(userid, newBlance); return newBlance.ToString(); }
private void checkSitehostUsername() { Response.ContentType = "txt/html"; Response.Clear(); wgiAdUnionSystem.BLL.wgi_sitehost bll = new wgiAdUnionSystem.BLL.wgi_sitehost(); string name = Request["username"]; if (bll.GetListByUsername(name).Tables[0].Rows.Count > 0) Response.Write("0"); else Response.Write("1"); Response.End(); }
protected string getUserName(string objid, string objtype) { string name = ""; if (objtype == "0") { name = new wgiAdUnionSystem.BLL.wgi_sitehost().GetModel(int.Parse(objid)).username; } else if (objtype == "1") { name = new wgiAdUnionSystem.BLL.wgi_adhost().GetModel(int.Parse(objid)).username; } return name; }
private void checkpwd() { Response.ContentType = "txt/html"; Response.Clear(); wgiAdUnionSystem.BLL.wgi_sitehost bll = new wgiAdUnionSystem.BLL.wgi_sitehost(); int userid = Convert.ToInt32(Request["userid"]); string pwd = Request["pwd"]; string orignal = bll.GetModel(userid).password; if (orignal == pwd) Response.Write("1"); else Response.Write("0"); Response.End(); }
public void btnUpdate_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtaccountname.Text == "") { strErr += "accountname不能为空!\\n"; } if (this.txtaccountno.Text == "") { strErr += "accountno不能为空!\\n"; } if (this.txtbank.Text == "") { strErr += "bank不能为空!\\n"; } if (this.txtbranch.Text == "") { strErr += "branch不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } string accountname = this.txtaccountname.Text; string accountno = this.txtaccountno.Text; string bank = this.txtbank.Text; string branch = this.txtbranch.Text; wgiAdUnionSystem.BLL.wgi_sitehost bll = new wgiAdUnionSystem.BLL.wgi_sitehost(); wgiAdUnionSystem.Model.wgi_sitehost model = bll.GetModel(userid); model.accountname = accountname; model.accountno = accountno; model.bank = bank; model.branch = branch; ScriptManager.RegisterClientScriptBlock(this, GetType(), DateTime.Now.ToString(), "alert('资料修改成功');", true); bll.Update(model); }
protected void submit_click(object sender, EventArgs e) { wgiAdUnionSystem.BLL.wgi_sitehost bll = new wgiAdUnionSystem.BLL.wgi_sitehost(); string oldpwd = this.txtold.Text; string newpwd = this.txtnew.Text; if (oldpwd != newpwd) { try { bll.updatePwd(userid, newpwd); FlowControl.Logout(); ScriptManager.RegisterClientScriptBlock(this, GetType(), DateTime.Now.ToString(), "alert('密码修改成功,请重新登录');location.href='/member/';", true); } catch (Exception) { Response.Write("操作失败,<a href=\"#\" onclick=\"history.go(-1);\">点此返回</a>"); Response.End(); } } }
protected void applyclick(object sender, EventArgs e) { decimal amount = 0.00M; try { amount = Convert.ToDecimal(txtapplyamount.Text); } catch (Exception) { ScriptManager.RegisterClientScriptBlock(this, GetType(), DateTime.Now.ToString(), "alert('请输入合理的数字金额');", true); return; } if (amount < 100) { ScriptManager.RegisterClientScriptBlock(this, GetType(), DateTime.Now.ToString(), "alert('最少提取100元');", true); return; } wgiAdUnionSystem.Model.wgi_cash model = new wgiAdUnionSystem.Model.wgi_cash(); model.status = 1; model.applydate = DateTime.Now; model.cash = amount; model.memo_user = txtapplyremark.Text; model.userid = userid; new wgiAdUnionSystem.BLL.wgi_cash().Add(model); //成功递交申请后,可支付佣金送去相应数目 wgiAdUnionSystem.BLL.wgi_sitehost bll = new wgiAdUnionSystem.BLL.wgi_sitehost(); wgiAdUnionSystem.Model.wgi_sitehost model2 = bll.GetModel(userid); model2.balance -= amount; bll.Update(model2); //Response.Redirect("applyfee.aspx"); Response.Write(Helper.HelperString.getAlertJumpString("申请成功", "applyfee.aspx")); }
protected void btn_login(object sender, EventArgs e) { string sessioncode = ""; try { if (Session["CheckCode"] != null && Session["CheckCode"].ToString() == "") return; else sessioncode = Session["CheckCode"].ToString(); } catch (Exception) { this.Page.Response.Redirect("/member/Default.aspx"); } if (sessioncode.ToLower().Equals(txtCode.Text.ToLower())) { UserPrincipal principal = new UserPrincipal(txtUser.Text, txtPass.Text, 2); if (!principal.Identity.IsAuthenticated) { lblLoginMessage.Visible = true; switch (principal.CheckStatus) { case 1: lblLoginMessage.Text = "用户名不正确!"; break; case 2: lblLoginMessage.Text = "用户名密码错误!"; break; case 3: lblLoginMessage.Text = "您的账户尚未被审核通过!"; break; case 4: lblLoginMessage.Text = "您的账户已被锁定!"; break; default: lblLoginMessage.Text = "未知错误!"; break; } } else { //如果用户通过验证,则将用户信息保存在缓存中,以备后用 //在实际中,朋友们可以尝试使用用户验证票的方式来保存用户信息,这也是.NET内置的用户处理机制 Context.User = principal; string userdata = ""; wgiAdUnionSystem.BLL.wgi_sitehost bll = new wgiAdUnionSystem.BLL.wgi_sitehost(); DataTable dt = bll.GetListByUsername(principal.Identity.Name).Tables[0]; if (dt != null && dt.Rows.Count > 0) { userdata = "member|" + dt.Rows[0]["userid"].ToString() + "|" + dt.Rows[0]["username"].ToString() + "|" + Convert.ToDateTime(dt.Rows[0]["lastdate"]).ToString("yyyy-MM-dd HH:mm:ss") + "|" + dt.Rows[0]["contact"].ToString() + "|" + dt.Rows[0]["balance"].ToString(); } string uid = dt.Rows[0]["userid"].ToString(); string uname = dt.Rows[0]["username"].ToString(); try { bll.updateLoginTime(int.Parse(uid), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); //记录学员登录时间 wgiAdUnionSystem.Model.wgi_loginlog logs = new wgiAdUnionSystem.Model.wgi_loginlog(); //logs.logid = int.Parse(uid); logs.logip = CommonData.GetIp(this.Page); logs.logname = uname; logs.logtime = DateTime.Now; logs.usertype = 1;//1表示网站主 new wgiAdUnionSystem.BLL.wgi_loginlog().Add(logs); } catch (Exception ex) { Response.Write("<script>alert('内部错误!');location.href='/index.aspx'</script>"); } //Session["sid"] = uid; //Session["utype"] = "member"; FlowControl.SaveLoginInfo(principal.Identity.Name, userdata); //Response.Redirect("/member/Default.aspx"); //setpanel(); initData(); string[] userdatas = userdata.Split('|'); this.lblbank.Text = userdatas[5] + "元"; this.lbllast.Text = userdatas[3]; this.lblname.Text = userdatas[4]; this.lbluname.Text = userdatas[2]; if (!string.IsNullOrEmpty(Request.QueryString["url"])) this.Page.Response.Redirect(Request["url"]); } } else { lblLoginMessage.Visible = true; lblLoginMessage.Text = "验证码错误!"; } }
protected void searchResault(object sender, EventArgs e) { string query = ""; lblsearch.Text = "搜索内容<"; lblsearch.Text += " 发送给:" + ddlobjtype.SelectedItem.Text; query += " and a.objtype=" + ddlobjtype.Text; if (txtobjname.Text.Trim() != "") { lblsearch.Text += " 用户名:" + txtobjname.Text; int uid = -1; if (ddlobjtype.Text.Trim() == "0") { List<wgiAdUnionSystem.Model.wgi_sitehost> o = new wgiAdUnionSystem.BLL.wgi_sitehost().GetModelList(" username='******' "); if (o.Count() > 0) { uid = o.SingleOrDefault().userid; } } else if (ddlobjtype.Text.Trim() == "1") { List<wgiAdUnionSystem.Model.wgi_adhost> o = new wgiAdUnionSystem.BLL.wgi_adhost().GetModelList(" username='******' "); if (o.Count() > 0) { uid = o.SingleOrDefault().companyid; } } query += " and a.objid=" + uid + " "; } if (txttitle.Text.Trim() != "") { lblsearch.Text += "标题:" + txttitle.Text + " "; query = " and a.title like '%" + txttitle.Text + "%' "; } if (txtstart.Text.Trim() != "" || txtend.Text.Trim() != "") { lblsearch.Text += "发布时间:"; if (txtstart.Text.Trim() == "") { lblsearch.Text += txtend.Text + "之前"; query += " and a.pubdate<'" + txtend.Text + "' "; } else if (txtend.Text.Trim() == "") { lblsearch.Text += txtstart.Text + "之后"; query += " and a.pubdate>'" + txtstart.Text + "' "; } else { lblsearch.Text += Convert.ToDateTime(txtstart.Text).ToString("yyyy-MM-dd") + "-" + Convert.ToDateTime(txtend.Text).ToString("yyyy-MM-dd") + "之间"; query += " and a.pubdate > '" + txtstart.Text + "' and a.pubdate < '" + txtend.Text + "' "; } } if (lblsearch.Text == "搜索内容<") { lblsearch.Text = ""; lbtnclear.Visible = false; } else { lblsearch.Text += ">"; lbtnclear.Visible = true; } hidquery.Value = query; initData(); }
public void btnUpdate_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtemail.Text == "") { strErr += "email不能为空!\\n"; } if (this.txtmobile.Text == "") { strErr += "mobile不能为空!\\n"; } if (this.txtcontact.Text == "") { strErr += "contact不能为空!\\n"; } if (this.txtqq.Text == "") { strErr += "qq不能为空!\\n"; } if (this.txtidcard.Text == "") { strErr += "idcard不能为空!\\n"; } if (this.txtaddress.Text == "") { strErr += "address不能为空!\\n"; } if (this.txtzipcode.Text == "") { strErr += "zipcode不能为空!\\n"; } if (this.txttel.Text == "") { strErr += "tel不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } string email = this.txtemail.Text; string mobile = this.txtmobile.Text; string contact = this.txtcontact.Text; string qq = this.txtqq.Text; string idcard = this.txtidcard.Text; string address = this.txtaddress.Text; string zipcode = this.txtzipcode.Text; string tel = this.txttel.Text; wgiAdUnionSystem.BLL.wgi_sitehost bll = new wgiAdUnionSystem.BLL.wgi_sitehost(); wgiAdUnionSystem.Model.wgi_sitehost model = bll.GetModel(userid); model.email = email; model.mobile = mobile; model.contact = contact; model.qq = qq; model.idcard = idcard; model.address = address; model.zipcode = zipcode; model.tel = tel; ScriptManager.RegisterClientScriptBlock(this, GetType(), DateTime.Now.ToString(), "alert('资料修改成功');", true); bll.Update(model); }
private void ShowInfo(int userid) { wgiAdUnionSystem.BLL.wgi_sitehost bll = new wgiAdUnionSystem.BLL.wgi_sitehost(); wgiAdUnionSystem.Model.wgi_sitehost model = bll.GetModel(userid); this.txtemail.Text = model.email; this.txtmobile.Text = model.mobile; this.txtcontact.Text = model.contact; this.txtqq.Text = model.qq; this.txtidcard.Text = model.idcard; this.txtaddress.Text = model.address; this.txtzipcode.Text = model.zipcode; this.txttel.Text = model.tel; this.txtregdate.Text = model.regdate.ToString(); this.txtregip.Text = model.regip; this.txtlastdate.Text = model.lastdate.ToString(); this.txtlastip.Text = model.lastip; this.txtstatus.Text = CommonData.getAccountStatusByValue(model.status.ToString()); }
protected void dosubmit(object sender, CommandEventArgs e) { wgiAdUnionSystem.BLL.wgi_sitehost bll = new wgiAdUnionSystem.BLL.wgi_sitehost(); string username = ""; if (e.CommandArgument.ToString() == "add") { username = this.txtusername.Text; if (bll.GetListByUsername(username).Tables[0].Rows.Count > 0) { ScriptManager.RegisterClientScriptBlock(this, GetType(), DateTime.Now.ToString(), "alert('用户名已被使用');", true); return; } } string password = this.txtpassword.Text; string email = this.txtemail.Text; string mobile = this.txtmobile.Text; string accountname = this.txtaccountname.Text; string accountno = this.txtaccountno.Text; string bank = this.txtbank.Text; string branch = this.txtbranch.Text; int usertype = 1;//usertype是个人/网站/博客等,因为已经在usersite里面可以多重定义,所以改为用户在系统里的类型,如网站主,广告主 string contact = this.txtcontact.Text; string qq = this.txtqq.Text; string idcard = this.txtidcard.Text; string address = this.txtaddress.Text; string zipcode = this.txtzipcode.Text; string tel = this.txttel.Text; decimal balance = Convert.ToDecimal(0.00); DateTime regdate = DateTime.Now; string regip = CommonData.GetIp(this.Page); //DateTime lastdate = DateTime.Now; //string lastip = ""; int status = 1;//0表示尚未审核通过,暂时默认网站主注册即通过 if (e.CommandArgument.ToString() == "add") { wgiAdUnionSystem.Model.wgi_sitehost model = new wgiAdUnionSystem.Model.wgi_sitehost(); model.username = username; model.password = password; model.email = email; model.mobile = mobile; model.contact = contact; model.qq = qq; model.idcard = idcard; model.address = address; model.zipcode = zipcode; model.tel = tel; //银行账户信息允许管理员添加,却不允许管理员更改 model.accountname = accountname; model.accountno = accountno; model.bank = bank; model.branch = branch; //账号状态信息自动读取,不允许编辑 //model.balance = balance; //model.lastdate = lastdate; //model.lastip = lastip; model.regdate = regdate; model.regip = regip; model.usertype = usertype; model.status = status; try { bll.Add(model); ScriptManager.RegisterClientScriptBlock(this, GetType(), DateTime.Now.ToString(), "alert('添加成功');top.location=top.location;", true); } catch (Exception) { ScriptManager.RegisterClientScriptBlock(this, GetType(), DateTime.Now.ToString(), "alert('内部错误');", true); } } else if (e.CommandArgument.ToString() == "edit") { try { int userid = int.Parse(this.hiduid.Value); wgiAdUnionSystem.Model.wgi_sitehost model = bll.GetModel(userid); model.password = password; model.email = email; model.mobile = mobile; model.contact = contact; model.qq = qq; model.idcard = idcard; model.address = address; model.zipcode = zipcode; model.tel = tel; if (ddlstatus.Visible = true) model.status = int.Parse(ddlstatus.Text); bll.Update(model); ScriptManager.RegisterClientScriptBlock(this, GetType(), DateTime.Now.ToString(), "alert('修改成功');top.location=top.location;", true); } catch (Exception) { ScriptManager.RegisterClientScriptBlock(this, GetType(), DateTime.Now.ToString(), "alert('内部错误');", true); } } }
/// <summary> /// 编辑/查看时绑定数据 /// </summary> /// <param name="action">编辑传入edit,查看传入show</param> private void caseEdit(string action) { uid = Request.QueryString["uid"]; if (uid == "") { Response.Write("非法进入"); Response.End(); } //绑定数据 wgiAdUnionSystem.BLL.wgi_sitehost bll = new wgiAdUnionSystem.BLL.wgi_sitehost(); wgiAdUnionSystem.Model.wgi_sitehost model = bll.GetModel(int.Parse(uid)); this.txtusername.Text = model.username; this.txtpassword.Attributes.Add("value",model.password); this.txtpwd2.Attributes.Add("value", model.password); this.txtemail.Text = model.email; this.txtmobile.Text = model.mobile; this.txtaccountname.Text = model.accountname; this.txtaccountno.Text = model.accountno; this.txtbank.Text = model.bank; this.txtbranch.Text = model.branch; //this.txtusertype.Text = model.usertype.ToString(); this.txtcontact.Text = model.contact; this.txtqq.Text = model.qq; this.txtidcard.Text = model.idcard; this.txtaddress.Text = model.address; this.txtzipcode.Text = model.zipcode; this.txttel.Text = model.tel; //以下为只显示,不编辑,不新增的字段 this.hiduid.Value = model.userid.ToString(); this.txtbalance.Text = model.balance.ToString()+" 元"; this.txtregdate.Text = model.regdate.ToString(); this.txtregip.Text = model.regip; this.txtlastdate.Text = model.lastdate.ToString(); this.txtlastip.Text = model.lastip; this.txtstatus.Text = CommonData.getAccountStatusByValue(model.status.ToString()); //网站信息 if (action == "edit") { lblusername.Text = model.username; lblusername.Visible = true; txtusername.Visible = false; fdst_bank.Visible = false;//不允许编辑用户银行账户资料 btnsubmit.CommandArgument = "edit"; btncancel.Visible = false;//编辑状态下尽量不给“重置”的功能,以免误清空原用户数据 Helper.HelperDropDownList.BindData(ddlstatus, CommonData.getAccountStatus(), "name", "value", model.status.ToString()); ddlstatus.Visible = true; txtstatus.Visible = false; } else if (action == "show") { btnsubmit.Visible = false; btncancel.Visible = false; fdst_site.Visible = true;//只有查看状态下才有必要看网站信息 trpwd1.Visible = false;//密码不允许查看,但有权更改 trpwd2.Visible = false; odsData.SelectParameters["userid"].DefaultValue = uid; lvsite.DataSourceID = "odsData"; lvsite.DataBind(); foreach (Control item in this.form.Controls) { if (item is TextBox) { (item as TextBox).Enabled = false; } else if (item.Controls.Count>0) { foreach (Control v in item.Controls) { if (v is TextBox) { (v as TextBox).Enabled = false; } } } } txtusername.Enabled = false; } }
private void ShowInfo(int userid) { wgiAdUnionSystem.BLL.wgi_sitehost bll = new wgiAdUnionSystem.BLL.wgi_sitehost(); wgiAdUnionSystem.Model.wgi_sitehost model = bll.GetModel(userid); this.txtaccountname.Text = model.accountname; this.txtaccountno.Text = model.accountno; this.txtbank.Text = model.bank; this.txtbranch.Text = model.branch; }
protected void btnAdd_Click(object sender, EventArgs e) { string username = this.txtusername.Text; wgiAdUnionSystem.BLL.wgi_sitehost bll = new wgiAdUnionSystem.BLL.wgi_sitehost(); if (bll.GetListByUsername(username).Tables[0].Rows.Count > 0) { ScriptManager.RegisterClientScriptBlock(this, GetType(), DateTime.Now.ToString(), "alert('用户名已被使用');", true); return; } #region 服务器验证 string strErr = ""; if (this.txtusername.Text == "") { strErr += "username不能为空!\\n"; } if (this.txtpassword.Text == "") { strErr += "password不能为空!\\n"; } if (this.txtpassword.Text != this.txtpwd2.Text) { strErr += "password不能为空!\\n"; } if (this.txtemail.Text == "") { strErr += "email不能为空!\\n"; } if (this.txtmobile.Text == "" && this.txttel.Text == "") { strErr += "电话、手机至少选填一项!\\n"; } if (this.txtaccountname.Text == "") { strErr += "accountname不能为空!\\n"; } if (this.txtaccountno.Text == "") { strErr += "accountno不能为空!\\n"; } if (this.txtbank.Text == "") { strErr += "bank不能为空!\\n"; } if (this.txtbranch.Text == "") { strErr += "branch不能为空!\\n"; } //if (!PageValidate.IsNumber(txtusertype.Text)) //{ // strErr += "usertype不是数字!\\n"; //} if (this.txtcontact.Text == "") { strErr += "contact不能为空!\\n"; } //if (this.txtqq.Text == "") //{ // strErr += "qq不能为空!\\n"; //} if (this.txtidcard.Text == "") { strErr += "idcard不能为空!\\n"; } //if (this.txtaddress.Text == "") //{ // strErr += "address不能为空!\\n"; //} //if (this.txtzipcode.Text == "") //{ // strErr += "zipcode不能为空!\\n"; //} //if (!PageValidate.IsNumber(txtstatus.Text)) //{ // strErr += "status不是数字!\\n"; //} if (strErr != "") { MessageBox.Show(this, strErr); return; } #endregion string password = this.txtpassword.Text; string email = this.txtemail.Text; string mobile = this.txtmobile.Text; string accountname = this.txtaccountname.Text; string accountno = this.txtaccountno.Text; string bank = this.txtbank.Text; string branch = this.txtbranch.Text; int usertype = 1;//usertype是个人/网站/博客等 string contact = this.txtcontact.Text; string qq = this.txtqq.Text; string idcard = this.txtidcard.Text; string address = this.txtaddress.Text; string zipcode = this.txtzipcode.Text; string tel = this.txttel.Text; decimal balance = Convert.ToDecimal(0.00); DateTime regdate = DateTime.Now; string regip = CommonData.GetIp(this.Page); //DateTime lastdate = DateTime.Now; //string lastip = ""; int status = 1;//0表示尚未审核通过,暂时默认网站主注册即通过 wgiAdUnionSystem.Model.wgi_sitehost model = new wgiAdUnionSystem.Model.wgi_sitehost(); model.username = username; model.password = password; model.email = email; model.mobile = mobile; model.accountname = accountname; model.accountno = accountno; model.bank = bank; model.branch = branch; model.usertype = usertype; model.contact = contact; model.qq = qq; model.idcard = idcard; model.address = address; model.zipcode = zipcode; model.tel = tel; model.balance = balance; model.regdate = regdate; model.regip = regip; //model.lastdate = lastdate; //model.lastip = lastip; model.status = status; try { bll.Add(model); Response.Redirect("regSuccess.aspx"); } catch (Exception) { ScriptManager.RegisterClientScriptBlock(this, GetType(), DateTime.Now.ToString(), "alert('内部错误');", true); } }
private void initData() { string act = Request.QueryString["act"]; //Helper.HelperDropDownList.BindData(ddlobjtype, CommonData.getUsertype(), "name", "value", 0); if (act == "add") { newNotice(); } else if(act=="edit") { editNotice(); } else if (act=="show") { showNotice(); } else { Response.Write("非法进入"); Response.End(); } string uname=""; if (Request.QueryString["objtype"] == "0") { uname = new wgiAdUnionSystem.BLL.wgi_sitehost().GetModel(int.Parse(Request.QueryString["objid"])).username; } else { uname = new wgiAdUnionSystem.BLL.wgi_adhost().GetModel(int.Parse(Request.QueryString["objid"])).username; } lblusername.Text = uname; }