public override string get(HttpContext context) { String agentId = context.Request.Params["agentId"].ToString(); String style = context.Request.Params["style"].ToString(); String sql = " and 1=2"; if (style == "getOrderList") { sql = " and State=1 and AgentId='" + agentId + "' order by CreateTime desc"; DataTable dt1 = new BLL.OrdersBLL().getOrdersByObject(sql); return(MyData.Utils.EasyuiDataGridJson(dt1)); } if (style == "getList") { sql = " and RefereeId='" + agentId + "'order by CreateTime"; } else if (style == "getSelf") { sql = " and Id='" + agentId + "'"; } DataTable dt = new BLL.AgentsBLL().GetAgents(sql); return(MyData.Utils.EasyuiDataGridJson(dt)); }
public override String add(HttpContext context) { //判断上月的的定时任务是否处理完毕 if (!new BLL.LogMonthCreateBLL().IsCreate()) { return("上月会员职级未升级完毕,暂时不允许录入订单!"); } Model.Orders orders = new Model.Orders(); String AgentId = context.Request.Params["AgentId"].ToString(); String Price = context.Request.Params["Price"].ToString(); String OrdersId = context.Request.Params["OrdersId"].ToString(); DataTable dt = new BLL.AgentsBLL().GetAgents(" and Id='" + AgentId + "'"); if (dt.Rows.Count == 0) { return("代理人不存在"); } String yearMonth = DateTime.Now.ToString("yyMM"); String id = yearMonth + "0001"; String oldId = new BLL.OrdersBLL().getLastId(); if (!String.IsNullOrWhiteSpace(oldId)) { if (oldId.StartsWith(yearMonth)) { id = (Convert.ToInt32(oldId) + 1).ToString(); } } orders.Id = id; orders.Price = Convert.ToDecimal(Price); orders.AgentName = dt.Rows[0]["AgentsName"].ToString(); orders.State = Convert.ToInt32(MyData.OrdersState.正常); orders.AgentId = AgentId; orders.CreatePerson = userName; orders.CreateTime = DateTime.Now; orders.UpdatePerson = userName; orders.UpdateTime = DateTime.Now; orders.YearMonth = MyData.Utils.getYearMonth(); orders.YearMonthDate = DateTime.Now; if (new BLL.OrdersBLL().Insert(orders, OrdersId)) { return("0"); } return("添加失败!"); }
public override string get(HttpContext context) { String agentId = context.Request.Params["agentId"].ToString(); String style = context.Request.Params["style"].ToString(); String sql = " and 1=2"; if (style == "getOrderList") { sql = " and State=1 and AgentId='" + agentId + "' order by CreateTime desc"; DataTable dt1 = new BLL.OrdersBLL().getOrdersByObject(sql); return(MyData.Utils.EasyuiDataGridJson(dt1)); } if (style == "getList") { //List<Agents> reAgentsList = new List<Agents>(); //sql = " and AgencyId='" + agentId + "' order by CreateTime "; //List<Agents> agentsList = new BLL.AgentsBLL().GetAgentsList(sql); //if (agentsList != null && agentsList.Count > 0) //{ // foreach (Agents agents in agentsList) // { // if (agents.Rank.StartsWith("S")) // { // reAgentsList.Add(agents); // } // } //} sql = " and AgencyId='" + agentId + "' and Rank in ('S1','S2') order by CreateTime "; } else if (style == "getSelf") { sql = " and Id='" + agentId + "'"; } DataTable dt = new BLL.AgentsBLL().GetAgents(sql); return(MyData.Utils.EasyuiDataGridJson(dt)); }
public override string get(HttpContext context) { String agentId = context.Request.Params["agentId"].ToString(); String style = context.Request.Params["style"].ToString(); String sql = " and 1=2"; if (style == "getOrderList") { sql = " and State=1 and AgentId='" + agentId + "' order by CreateTime desc"; DataTable dt1 = new BLL.OrdersBLL().getOrdersByObject(sql); return(MyData.Utils.EasyuiDataGridJson(dt1)); } if (style == "getList") { List <Agents> reAgentsList = new List <Agents>(); sql = " and AgencyId='" + agentId + "' order by CreateTime "; List <Agents> agentsList1 = new BLL.AgentsBLL().GetAgentsList(sql); if (agentsList1 != null && agentsList1.Count > 0)//一级 { foreach (Agents agents1 in agentsList1) { reAgentsList.Add(agents1); if (agents1.Rank.StartsWith("D") || agents1.Rank.StartsWith("P")) { sql = " and AgencyId='" + agents1.Id + "' order by CreateTime "; List <Agents> agentsList2 = new BLL.AgentsBLL().GetAgentsList(sql); if (agentsList2 != null && agentsList2.Count > 0)//二级 { foreach (Agents agents2 in agentsList2) { agents2._parentId = agents2.AgencyId; reAgentsList.Add(agents2); if (agents2.Rank.StartsWith("D") || agents2.Rank.StartsWith("P")) { sql = " and AgencyId='" + agents2.Id + "' order by CreateTime "; List <Agents> agentsList3 = new BLL.AgentsBLL().GetAgentsList(sql); if (agentsList3 != null && agentsList3.Count > 0)//三级 { foreach (Agents agents3 in agentsList3) { agents3._parentId = agents3.AgencyId; reAgentsList.Add(agents3); } } } } } } } } return(MyData.Utils.EasyuiDataGridJsonForList(reAgentsList)); } else if (style == "getSelf") { sql = " and Id='" + agentId + "'"; } DataTable dt = new BLL.AgentsBLL().GetAgents(sql); return(MyData.Utils.EasyuiDataGridJson(dt)); }
public String getAgents(HttpContext context) { DataTable dt = new BLL.AgentsBLL().GetAgents(" and State!=0"); return(MyData.Utils.EasuuiComboxJson(dt)); }
public override String get(HttpContext context) { int pageRows, page; String order = ""; pageRows = 20; page = 1; BLL.AgentsBLL agentsBLL = new BLL.AgentsBLL(); String strWhere = " 1=1"; string[] st = context.Request.Params["wherestr"].ToString().Split(','); if (!String.IsNullOrWhiteSpace(st[0])) { strWhere += " and Id='" + st[0] + "'"; } if (!String.IsNullOrWhiteSpace(st[1])) { String type = st[1]; if (type == "0") { //代理人 strWhere += " and Rank like 'S%'"; } else if (type == "1") { //代理商 strWhere += " and Rank like 'D%'"; } else if (type == "2") { //合伙人 strWhere += " and Rank like 'P%'"; } } if (!String.IsNullOrWhiteSpace(st[2])) { strWhere += " and Name like '%" + st[2].Trim() + "%'"; } if (!String.IsNullOrWhiteSpace(st[3])) { strWhere += " and Phone='" + st[3].Trim() + "'"; } if (!String.IsNullOrWhiteSpace(st[4])) { strWhere += " and State=" + Convert.ToInt32(st[4]); } if (null != context.Request["rows"]) { pageRows = int.Parse(context.Request["rows"].ToString().Trim()); } if (null != context.Request["page"]) { page = int.Parse(context.Request["page"].ToString().Trim()); } if (null != context.Request["sort"]) { order = context.Request["sort"].ToString().Trim(); } //调用分页的GetList方法 DataTable dt = agentsBLL.GetListByPage(strWhere.ToString(), order, (page - 1) * pageRows + 1, page * pageRows); int count = agentsBLL.GetRecordCount(strWhere.ToString());//获取条数 return(MyData.Utils.EasyuiDataGridJson(dt, count)); }