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_Product_Level.GetModel(id); if (model == null) { model = new Lebi_Agent_Product_Level(); } cos = B_Lebi_CardOrder.GetList("Type_id_CardType=312", ""); }
/// <summary> /// 返回代理级别 /// </summary> /// <param name="id"></param> /// <returns></returns> public string GetLevelName(int id) { Lebi_Agent_Product_Level level = B_Lebi_Agent_Product_Level.GetModel(id); if (level == null) { level = new Lebi_Agent_Product_Level(); } return(level.Name); }
protected void Page_Load(object sender, EventArgs e) { PageSize = RequestTool.getpageSize(25); key = RequestTool.RequestString("key"); string where = "1=1"; //if (key != "") // where += " and User_UserName like '%" + key + "%'"; models = B_Lebi_Agent_Product_Level.GetList(where, "Sort desc", PageSize, page); int recordCount = B_Lebi_Agent_Product_Level.Counts(where); PageString = Pager.GetPaginationString("?page={0}&key=" + key, page, PageSize, recordCount); }
public string LevelOption(int selid) { List <Lebi_Agent_Product_Level> models = B_Lebi_Agent_Product_Level.GetList("", "Sort desc"); string str = ""; foreach (Lebi_Agent_Product_Level model in models) { string sel = ""; if (selid == model.id) { sel = "selected"; } str += "<option " + sel + " value=" + model.id + ">" + model.Name + "</option>"; } return(str); }
/// <summary> /// 删除商品代理级别 /// </summary> public void ProductAgentLevel_Del() { string ids = RequestTool.RequestString("ids"); //if (!EX_Admin.Power("supplier_group_del", "删除商家分组")) //{ // AjaxNoPower(); // return; //} if (ids != "") { B_Lebi_Agent_Product_Level.Delete("id in (lbsql{" + ids + "})"); } Log.Add("删除商品代理级别", "Agent_ProductLevel", ids, CurrentAdmin, ids); Response.Write("{\"msg\":\"OK\"}"); }
/// <summary> /// 编辑商品代理级别 /// </summary> public void ProductAgentLevel_Edit() { int id = RequestTool.RequestInt("id", 0); Lebi_Agent_Product_Level model = B_Lebi_Agent_Product_Level.GetModel(id); string User_UserName = RequestTool.RequestString("User_UserName"); if (model == null) { model = new Lebi_Agent_Product_Level(); } B_Lebi_Agent_Product_Level.BindForm(model); model.Years = 1; if (model.id == 0) { //if (!EX_Admin.Power("supplier_group_add", "添加商家分组")) //{ // AjaxNoPower(); // return; //} B_Lebi_Agent_Product_Level.Add(model); id = B_Lebi_Agent_Product_Level.GetMaxId(); Log.Add("添加商品代理级别", "Agent_ProductLevel", id.ToString(), CurrentAdmin); } else { //if (!EX_Admin.Power("supplier_group_edit", "编辑商家分组")) //{ // AjaxNoPower(); // return; //} B_Lebi_Agent_Product_Level.Update(model); Log.Add("编辑商品代理级别", "Agent_ProductLevel", id.ToString(), CurrentAdmin); } 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\"}"); }