protected void Page_Load(object sender, EventArgs e) { int id = RequestTool.RequestInt("id", 0); //if (id == 0) //{ // if (!EX_Admin.Power("supplier_group_edit", "添加商家分组")) // { // WindowNoPower(); // } //} //else //{ // if (!EX_Admin.Power("supplier_group_edit", "编辑商家分组")) // { // WindowNoPower(); // } //} model = B_Lebi_Agent_Area.GetModel(id); if (model == null) { model = new Lebi_Agent_Area(); } cos = B_Lebi_CardOrder.GetList("Type_id_CardType=312", ""); }
/// <summary> /// 编辑区域代理 /// </summary> public void AreaAgent_Edit() { int id = RequestTool.RequestInt("id", 0); int Area_id = RequestTool.RequestInt("Area_id", 0); int PArea_id = RequestTool.RequestInt("PArea_id", 0); if (Area_id == 0) { Area_id = PArea_id; } Lebi_Agent_Area model = B_Lebi_Agent_Area.GetModel(id); int count = B_Lebi_Agent_Area.Counts("Area_id=" + Area_id + " and id!=" + id + ""); if (count > 0) { Response.Write("{\"msg\":\"" + Tag("不能选择此区域") + "\"}"); return; } if (model == null) { model = new Lebi_Agent_Area(); } B_Lebi_Agent_Area.BindForm(model); model.Area_id = Area_id; if (model.id == 0) { //if (!EX_Admin.Power("supplier_group_add", "添加商家分组")) //{ // AjaxNoPower(); // return; //} B_Lebi_Agent_Area.Add(model); id = B_Lebi_Agent_Area.GetMaxId(); Log.Add("添加代理区域", "Agent_Area", id.ToString(), CurrentAdmin, model.User_UserName + "[" + model.Area_id + "]"); } else { //if (!EX_Admin.Power("supplier_group_edit", "编辑商家分组")) //{ // AjaxNoPower(); // return; //} B_Lebi_Agent_Area.Update(model); Log.Add("编辑代理区域", "Agent_Area", id.ToString(), CurrentAdmin, model.User_UserName + "[" + model.Area_id + "]"); } string result = "{\"msg\":\"OK\", \"id\":\"" + id + "\"}"; Response.Write(result); }
/// <summary> /// 编辑区域代理-代理人 /// </summary> public void AreaAgentUser_Edit() { int id = RequestTool.RequestInt("id", 0); Lebi_Agent_Area model = B_Lebi_Agent_Area.GetModel(id); if (model == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } string User_UserName = RequestTool.RequestString("User_UserName"); if (User_UserName == "") { Response.Write("{\"msg\":\"" + Tag("用户名不能空") + "\"}"); return; } Lebi_User user = B_Lebi_User.GetModel("UserName=lbsql{'" + User_UserName + "'}"); if (user == null) { Response.Write("{\"msg\":\"" + Tag("用户不存在") + "\"}"); return; } if (model.Time_end > System.DateTime.Now.Date && model.User_id != user.id) { Response.Write("{\"msg\":\"" + Tag("其他代理还未到期") + "\"}"); return; } if (model == null) { model = new Lebi_Agent_Area(); } B_Lebi_Agent_Area.BindForm(model); model.User_id = user.id; B_Lebi_Agent_Area.Update(model); Log.Add("绑定区域代理", "Agent_Area", id.ToString(), CurrentAdmin, model.User_UserName + "[" + model.Area_id + "]"); string result = "{\"msg\":\"OK\", \"id\":\"" + id + "\"}"; Response.Write(result); }
/// <summary> /// 余额购买其他内容 /// </summary> public void BuyOther() { int keyid = RequestTool.RequestInt("keyid"); string tablename = RequestTool.RequestSafeString("tablename"); decimal postmoney = RequestTool.RequestDecimal("money"); string paypwd = RequestTool.RequestSafeString("paypwd"); decimal money = 0; if (EX_User.MD5(paypwd) != CurrentUser.Pay_Password) { Response.Write("{\"msg\":\"" + Tag("支付密码错误") + "\"}"); return; } if (tablename == "Agent_Product_Level") { Lebi_Agent_Product_Level lev = B_Lebi_Agent_Product_Level.GetModel(keyid); if (lev == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } Lebi_Agent_Product_User user = B_Lebi_Agent_Product_User.GetModel("User_id=" + CurrentUser.id + ""); if (user == null) { //新购买的情况 money = lev.Price; if (money > CurrentUser.Money) { Response.Write("{\"msg\":\"" + Tag("余额不足") + "\"}"); return; } user = new Lebi_Agent_Product_User(); user.Agent_Product_Level_id = lev.id; user.Commission = lev.Commission; user.Count_Product = lev.Count_Product; user.Count_product_change = lev.Count_product_change; user.User_id = CurrentUser.id; user.User_UserName = CurrentUser.UserName; user.Time_end = System.DateTime.Now.AddYears(lev.Years); B_Lebi_Agent_Product_User.Add(user); } else { if (user.Agent_Product_Level_id == lev.id) { //续费的情况 money = lev.Price; if (money > CurrentUser.Money) { Response.Write("{\"msg\":\"" + Tag("余额不足") + "\"}"); return; } user.Time_end = user.Time_end.AddYears(lev.Years); B_Lebi_Agent_Product_User.Update(user); //更新代理商品的过期时间 } else { //升级的情况 Lebi_Agent_Product_Level userlev = B_Lebi_Agent_Product_Level.GetModel(user.Agent_Product_Level_id); if (userlev.Sort > lev.Sort) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } money = lev.Price - userlev.Price; if (money < 0) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } if (money > CurrentUser.Money) { Response.Write("{\"msg\":\"" + Tag("余额不足") + "\"}"); return; } user.Agent_Product_Level_id = lev.id; user.Commission = lev.Commission; user.Count_Product = lev.Count_Product; user.Count_product_change = lev.Count_product_change; B_Lebi_Agent_Product_User.Update(user); } } EX_User.GiveUserCard(CurrentUser, lev.CardOrder_id);//赠送代金券 Money.AddMoney(CurrentUser, 0 - money, 196, null, "", ""); } else if (tablename == "Agent_Area") { Lebi_Agent_Area area = B_Lebi_Agent_Area.GetModel(keyid); if (area == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } if (area.User_id > 0 && area.User_id != CurrentUser.id) { Response.Write("{\"msg\":\"" + Tag("不能代理此区域") + "\"}"); return; } money = area.Price; if (money > CurrentUser.Money) { Response.Write("{\"msg\":\"" + Tag("余额不足") + "\"}"); return; } if (area.User_id == 0) { //新购买的情况 area.User_id = CurrentUser.id; area.User_UserName = CurrentUser.UserName; area.Time_end = System.DateTime.Now.AddYears(1); area.IsFailure = 0; B_Lebi_Agent_Area.Update(area); } else { //续费的情况 area.Time_end = area.Time_end.AddYears(1); area.IsFailure = 0; B_Lebi_Agent_Area.Update(area); } EX_User.GiveUserCard(CurrentUser, area.CardOrder_id);//赠送代金券 Money.AddMoney(CurrentUser, 0 - money, 196, null, "", ""); } else if (tablename == "suppliermargin")//供应商保证金 { Lebi_Supplier supplier = B_Lebi_Supplier.GetModel("User_id=" + CurrentUser.id); if (supplier == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } //新购买的情况 money = supplier.Money_Margin - supplier.Money_Margin_pay; if (money > CurrentUser.Money) { Response.Write("{\"msg\":\"" + Tag("余额不足") + "\"}"); return; } supplier.Money_Margin_pay += money; B_Lebi_Supplier.Update(supplier); Money.AddMoney(CurrentUser, 0 - money, 197, null, "", ""); } else if (tablename == "suppliermargin")//供应商保证金 { Lebi_Supplier supplier = B_Lebi_Supplier.GetModel("User_id=" + CurrentUser.id); if (supplier == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } money = supplier.Money_Margin - supplier.Money_Margin_pay; if (money > CurrentUser.Money) { Response.Write("{\"msg\":\"" + Tag("余额不足") + "\"}"); return; } supplier.Money_Margin_pay += money; B_Lebi_Supplier.Update(supplier); Money.AddMoney(CurrentUser, 0 - money, 197, null, "", ""); } else if (tablename == "supplierservice")//供应商服务费 { Lebi_Supplier supplier = B_Lebi_Supplier.GetModel("User_id=" + CurrentUser.id); if (supplier == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } Lebi_Supplier_Group group = B_Lebi_Supplier_Group.GetModel("id=" + supplier.Supplier_Group_id); if (group == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } money = supplier.Money_Service; if (money > CurrentUser.Money) { Response.Write("{\"msg\":\"" + Tag("余额不足") + "\"}"); return; } supplier.Time_End = supplier.Time_End.AddDays(group.ServiceDays); B_Lebi_Supplier.Update(supplier); Money.AddMoney(CurrentUser, 0 - money, 198, null, "", ""); } Response.Write("{\"msg\":\"OK\"}"); }
public string GetAreas(int pid, int deep, string tag = "") { StringBuilder sb = new StringBuilder(); List <Lebi_Area> areas = B_Lebi_Area.GetList("Parentid=" + pid + "", "Sort desc"); Lebi_Agent_Area model; string where = ""; foreach (Lebi_Area area in areas) { if (!IsShow(area.id)) { continue; } where = "Area_id=" + area.id + ""; //if (key != "") // where += " and User_UserName like '%" + key + "%'"; //if (status > 0) //{ // if (status == 1) // where += " and User_id>0"; // if (status == 2) // where += " and User_id=0"; //} model = B_Lebi_Agent_Area.GetModel(where); if (model == null) { sb.Append("<tr class=\"list\" " + tag + "><td> </td><td colspan=\"10\">" + deepstr(deep) + "<img id=\"img" + area.id + "\" onclick=\"ShowChild(" + area.id + ")\" src=\"" + AdminImage("minus.gif") + "\"/> " + area.Name + "</td></tr>"); string newtag = ""; if (tag == "") { newtag = "t" + area.id + "=\"true\""; } else { newtag = tag + " t" + area.id + "=\"true\""; } sb.Append(GetAreas(area.id, deep + 1, newtag)); } else { string style = ""; if (model.User_id > 0 && model.Time_end > System.DateTime.Now) { style = "style=\"color:red;\""; } sb.Append("<tr class=\"list\" " + tag + " ondblclick=\"Edit(" + model.id + ")\">"); sb.Append("<td class=\"center\"><input type=\"checkbox\" value=\"" + model.id + "\" name=\"sid\" /></td>"); sb.Append("<td " + style + ">" + deepstr(deep) + "<img id=\"img" + area.id + "\" src=\"" + AdminImage("minus.gif") + "\" onclick=\"ShowChild(" + area.id + ")\"/> " + Shop.Bussiness.EX_Area.GetAreaName(model.Area_id, 1) + "</td>"); sb.Append("<td>" + model.User_UserName + "</td>"); sb.Append("<td>" + DefaultCurrency.Msige + " " + model.Price + "</td>"); sb.Append("<td>" + model.Commission_1 + "</td>"); sb.Append("<td>" + model.Commission_2 + "</td>"); sb.Append("<td>" + GetCOrder(model.CardOrder_id) + "</td>"); sb.Append("<td>" + model.Time_add.ToShortDateString() + "</td>"); sb.Append("<td>" + model.Time_end.ToShortDateString() + "</td>"); sb.Append("<td>" + (model.IsFailure == 1 ? Tag("失效") : Tag("正常")) + "</td>"); sb.Append("<td><a href=\"javascript:void(0)\" onclick=\"Edit(" + model.id + ")\">" + Tag("编辑") + "</a>"); sb.Append(" | <a href=\"javascript:void(0)\" onclick=\"AreaAgentUser_Edit(" + model.id + ")\">" + Tag("绑定") + "</a>"); sb.Append(" | <a href=\"agentmoney.aspx?areaid=" + model.Area_id + "\">" + Tag("查看佣金") + "</a>"); sb.Append("</td></tr>"); } } return(sb.ToString()); }