public double GetShiJiang(string allMoney, string userId) { MemberInfo memberInfo = MemberInfo.Read(int.Parse(userId)); SetMealInfo setMealInfo = SetMealInfo.Read(memberInfo.SetMealId); ConfigInfo configInfo = ConfigInfo.Read(1); double num = (double.Parse(allMoney) > setMealInfo.CappingAward) ? setMealInfo.CappingAward : double.Parse(allMoney); return(num - num * (double)configInfo.FenHong * 0.01 - num * configInfo.KouShui * 0.01); }
public void BindData() { MemberInfo memberInfo = MemberInfo.Read(int.Parse(this.Session["userId"].ToString())); this.lb_userName.Text = memberInfo.UserName; this.lb_money.Text = memberInfo.Money.ToString(); this.lb_jifen.Text = memberInfo.JiFen.ToString(); SetMealInfo setMealInfo = SetMealInfo.Read(memberInfo.SetMealId); this.lb_setMealName.Text = setMealInfo.Name; }
public static List <SetMealInfo> ReadList(string whereStr) { List <SetMealInfo> list = new List <SetMealInfo>(); Database database = new Database(); DataView defaultView = database.RunProc("select * from SetMeal " + whereStr).Tables[0].DefaultView; for (int i = 0; i < defaultView.Count; i++) { list.Add(SetMealInfo.Read(int.Parse(defaultView[i]["id"].ToString()))); } database.Dispose(); return(list); }
public void BindData() { MemberInfo memberInfo = MemberInfo.Read(int.Parse(this.Session["userId"].ToString())); SetMealInfo setMealInfo = SetMealInfo.Read(memberInfo.SetMealId); this.lb_username.Text = memberInfo.UserName; this.lb_truename.Text = memberInfo.TrueName; this.lb_tuijianRen.Text = memberInfo.TuiJianRen; this.lb_guanliRen.Text = memberInfo.GuanLiRen; this.lb_bankType.Text = memberInfo.KaiHuBank; this.lb_bankAccount.Text = memberInfo.KaiHuAccount; this.lb_setMealName.Text = setMealInfo.Name; this.lb_addDate.Text = memberInfo.AddDate.ToString(); this.lb_agencyName.Text = memberInfo.AgencyName; this.lb_Mondy.Text = memberInfo.Money.ToString(); this.tb_mobile.Text = memberInfo.Mobile; this.tb_qq.Text = memberInfo.QQ; this.lb_zfb.Text = memberInfo.ZhiFuBao; this.lb_zfbName.Text = memberInfo.ZhiFuBaoName; }
protected void gridview1_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { SetMealInfo setMealInfo = SetMealInfo.Read((int)this.gridview1.DataKeys[e.RowIndex].Value); setMealInfo.Name = ((TextBox)this.gridview1.Rows[e.RowIndex].FindControl("name")).Text; setMealInfo.Money = double.Parse(((TextBox)this.gridview1.Rows[e.RowIndex].FindControl("money")).Text); setMealInfo.Point = int.Parse(((TextBox)this.gridview1.Rows[e.RowIndex].FindControl("point")).Text); setMealInfo.CappingAward = double.Parse(((TextBox)this.gridview1.Rows[e.RowIndex].FindControl("cappingAward")).Text); setMealInfo.TouchAward = double.Parse(((TextBox)this.gridview1.Rows[e.RowIndex].FindControl("touchAward")).Text); setMealInfo.ServiceAward = double.Parse(((TextBox)this.gridview1.Rows[e.RowIndex].FindControl("serviceAward")).Text); setMealInfo.rapidAward = double.Parse(((TextBox)this.gridview1.Rows[e.RowIndex].FindControl("rapidAward")).Text); setMealInfo.jiandianAward = double.Parse(((TextBox)this.gridview1.Rows[e.RowIndex].FindControl("jiandianAward")).Text); setMealInfo.IsAgency = (((CheckBox)this.gridview1.Rows[e.RowIndex].FindControl("isAgency")).Checked ? 1 : 0); setMealInfo.Update(); this.Page.ClientScript.RegisterStartupScript(base.GetType(), "Ok", "alert('修改成功');", true); this.BindData(); } catch (Exception ex) { this.Page.ClientScript.RegisterStartupScript(base.GetType(), "Ok", "alert('" + ex.Message + "');", true); } }
protected void gridview1_RowUpdating(object sender, GridViewUpdateEventArgs e) { DateTime now = DateTime.Now; MemberInfo memberInfo = MemberInfo.Read((int)this.gridview1.DataKeys[e.RowIndex].Value); SetMealInfo setMealInfo = SetMealInfo.Read(memberInfo.SetMealId); IList <MemberInfo> list = MemberInfo.ReadList("where username='******'"); if (list.Count == 1) { if (list[0].Money < setMealInfo.Money) { this.Page.ClientScript.RegisterStartupScript(base.GetType(), "Ok", "alert('代理商余额不足,不能通过审核!');", true); return; } SetMealInfo setMealInfo2 = SetMealInfo.Read(list[0].SetMealId); list[0].Money = list[0].Money - setMealInfo.Money; list[0].Update(); CaiwuInfo caiwuInfo = new CaiwuInfo(0, this.Session["user"].ToString(), list[0].Id, list[0].UserName, -setMealInfo.Money, list[0].Money, "审核会员" + memberInfo.UserName, now); caiwuInfo.Insert(); ProductOrderInfo productOrderInfo = new ProductOrderInfo(0, 1, memberInfo.Id, memberInfo.UserName, setMealInfo.Name, "", setMealInfo.Money, "", DateTime.Now, 0); productOrderInfo.Insert(); memberInfo.Status = 1; memberInfo.Update(); this.BindData(); JiangJinInfo jiangJinInfo = new JiangJinInfo(0, list[0].Id, list[0].UserName, memberInfo.Id, memberInfo.UserName, 0.0, setMealInfo.Money * setMealInfo2.ServiceAward * 0.01, "服务津贴", setMealInfo.Money * setMealInfo2.ServiceAward * 0.01, now); jiangJinInfo.Insert(); MemberInfo memberInfo2 = memberInfo; string[] array = memberInfo.UserPath.Split(new char[] { ',' }); for (int i = array.Length - 1; i >= 0; i--) { MemberInfo memberInfo3 = MemberInfo.Read(int.Parse(array[i])); int num = (memberInfo3.ZuoQu >= memberInfo3.YouQu) ? memberInfo3.YouQu : memberInfo3.ZuoQu; if (memberInfo2.FenZhi == 1) { DuiPengInfo duiPengInfo = new DuiPengInfo(0, memberInfo3.Id, memberInfo3.UserName, memberInfo.Id, memberInfo.UserName, setMealInfo.Point, 0, now); duiPengInfo.Insert(); memberInfo3.ZuoQu += setMealInfo.Point; memberInfo3.Update(); } else { if (memberInfo2.FenZhi == 2) { DuiPengInfo duiPengInfo2 = new DuiPengInfo(0, memberInfo3.Id, memberInfo3.UserName, memberInfo.Id, memberInfo.UserName, 0, setMealInfo.Point, now); duiPengInfo2.Insert(); memberInfo3.YouQu += setMealInfo.Point; memberInfo3.Update(); } } int num2 = (memberInfo3.ZuoQu >= memberInfo3.YouQu) ? memberInfo3.YouQu : memberInfo3.ZuoQu; if (num != num2) { SetMealInfo setMealInfo3 = SetMealInfo.Read(memberInfo3.SetMealId); JiangJinInfo jiangJinInfo2 = new JiangJinInfo(0, memberInfo3.Id, memberInfo3.UserName, memberInfo.Id, memberInfo.UserName, (double)(num2 - num) * setMealInfo3.TouchAward, 0.0, "对碰奖", (double)(num2 - num) * setMealInfo3.TouchAward, now); jiangJinInfo2.Insert(); } memberInfo2 = MemberInfo.Read(int.Parse(array[i])); } } }
public void BindData() { this.repeater1.DataSource = this.db.RunProcGetDataView("select B.Name as setMealName,A.* from Member as A,setMeal as B where A.setMealId=B.id and A.agencyName='" + this.Session["user"].ToString() + "' and A.status=0 order by A.id"); this.repeater1.DataBind(); if (base.Request["action"] != null && base.Request["action"] == "check") { List <MemberInfo> list = MemberInfo.ReadList(string.Concat(new object[] { "where status=0 and id=", int.Parse(base.Request.QueryString["id"]), " and agencyName='", this.Session["user"].ToString(), "'" })); if (list.Count == 1) { DateTime now = DateTime.Now; MemberInfo memberInfo = MemberInfo.Read(int.Parse(base.Request.QueryString["id"])); SetMealInfo setMealInfo = SetMealInfo.Read(memberInfo.SetMealId); IList <MemberInfo> list2 = MemberInfo.ReadList("where username='******'"); if (list2.Count == 1) { if (list2[0].Money < setMealInfo.Money) { this.Page.ClientScript.RegisterStartupScript(base.GetType(), "Ok", "alert('您的电子货币余额不足,不能通过审核!请充值后再审核');", true); return; } SetMealInfo setMealInfo2 = SetMealInfo.Read(list2[0].SetMealId); list2[0].Money = list2[0].Money - setMealInfo.Money; list2[0].Update(); CaiwuInfo caiwuInfo = new CaiwuInfo(0, this.Session["user"].ToString(), list2[0].Id, list2[0].UserName, -setMealInfo.Money, list2[0].Money, "审核会员" + memberInfo.UserName, now); caiwuInfo.Insert(); ProductOrderInfo productOrderInfo = new ProductOrderInfo(0, 1, memberInfo.Id, memberInfo.UserName, setMealInfo.Name, "", setMealInfo.Money, "", DateTime.Now, 0); productOrderInfo.Insert(); memberInfo.Status = 1; memberInfo.Update(); this.BindData(); JiangJinInfo jiangJinInfo = new JiangJinInfo(0, list2[0].Id, list2[0].UserName, memberInfo.Id, memberInfo.UserName, 0.0, setMealInfo.Money * setMealInfo2.ServiceAward * 0.01, "服务津贴", setMealInfo.Money * setMealInfo2.ServiceAward * 0.01, now); jiangJinInfo.Insert(); MemberInfo memberInfo2 = memberInfo; string[] array = memberInfo.UserPath.Split(new char[] { ',' }); for (int i = array.Length - 1; i >= 0; i--) { MemberInfo memberInfo3 = MemberInfo.Read(int.Parse(array[i])); int num = (memberInfo3.ZuoQu >= memberInfo3.YouQu) ? memberInfo3.YouQu : memberInfo3.ZuoQu; if (memberInfo2.FenZhi == 1) { DuiPengInfo duiPengInfo = new DuiPengInfo(0, memberInfo3.Id, memberInfo3.UserName, memberInfo.Id, memberInfo.UserName, setMealInfo.Point, 0, now); duiPengInfo.Insert(); memberInfo3.ZuoQu += setMealInfo.Point; memberInfo3.Update(); } else { if (memberInfo2.FenZhi == 2) { DuiPengInfo duiPengInfo2 = new DuiPengInfo(0, memberInfo3.Id, memberInfo3.UserName, memberInfo.Id, memberInfo.UserName, 0, setMealInfo.Point, now); duiPengInfo2.Insert(); memberInfo3.YouQu += setMealInfo.Point; memberInfo3.Update(); } } int num2 = (memberInfo3.ZuoQu >= memberInfo3.YouQu) ? memberInfo3.YouQu : memberInfo3.ZuoQu; if (num != num2) { SetMealInfo setMealInfo3 = SetMealInfo.Read(memberInfo3.SetMealId); JiangJinInfo jiangJinInfo2 = new JiangJinInfo(0, memberInfo3.Id, memberInfo3.UserName, memberInfo.Id, memberInfo.UserName, (double)(num2 - num) * setMealInfo3.TouchAward, 0.0, "对碰奖", (double)(num2 - num) * setMealInfo3.TouchAward, now); jiangJinInfo2.Insert(); } memberInfo2 = MemberInfo.Read(int.Parse(array[i])); } } base.Response.Redirect("UserList.aspx"); } else { this.Page.ClientScript.RegisterStartupScript(base.GetType(), "none", "alert('您没有权限审核此用户!');", true); base.Response.Redirect("UserList.aspx"); } base.Response.Redirect("UserList.aspx"); } if (base.Request["action"] != null && base.Request["action"] == "delete") { List <MemberInfo> list3 = MemberInfo.ReadList(string.Concat(new object[] { "where status=0 and id=", int.Parse(base.Request.QueryString["id"]), " and agencyName='", this.Session["user"], "'" })); if (list3.Count == 1) { string userPath = list3[0].UserPath; int num3 = 0; List <MemberInfo> list4 = MemberInfo.ReadList("where username='******'"); if (list4.Count == 1) { num3 = list4[0].FenZhi; } List <MemberInfo> list5 = MemberInfo.ReadList("where guanliRen='" + list3[0].UserName + "'"); if (list5.Count == 1 && num3 != 0) { list5[0].GuanLiRen = list3[0].GuanLiRen; list5[0].FenZhi = num3; list5[0].UserPath = list3[0].UserPath; list5[0].Update(); } List <MemberInfo> list6 = MemberInfo.ReadList("where userpath like '" + userPath + "%'"); for (int j = 0; j < list6.Count; j++) { list6[j].UserPath = list6[j].UserPath.Replace(list3[0].Id + ",", ""); list6[j].Update(); } MemberInfo.Delete(list3[0].Id); base.Response.Redirect("UserList.aspx"); return; } this.Page.ClientScript.RegisterStartupScript(base.GetType(), "none", "alert('您没有权限删除此用户!');", true); } }