| | |
| | | case "add": |
| | | return this.Add(context); //添加 |
| | | case "list": |
| | | return this.List(context); //查询 |
| | | return this.List(context); //产品查询 |
| | | case "productClassesList": |
| | | return this.ProductClassesList(context); //产品查询 |
| | | case "get": |
| | | return this.Get(context); //获取记录信息 |
| | | case "updateStatus": |
| | |
| | | int num = 0; |
| | | foreach (GwProduct bean in list) |
| | | { |
| | | |
| | | ++num; |
| | | str1 = str1 + (object) "<tr><td>" + (object) bean.Icon; |
| | | str1 = str1 + "</td><td>" + bean.Name + "</td>"; |
| | | str1 = string.Concat(new object[4] |
| | | //str1 = str1 + (object) "<tr><td>" + "<img src=\"../static/images/productIcon/" + (object) bean.Icon + "\" >"; |
| | | if (bean.Classes == 1 && !string.IsNullOrEmpty(bean.Icon)) |
| | | { |
| | | str1, |
| | | "<td>", |
| | | bean.Instructions, |
| | | "</td>" |
| | | }); |
| | | str1 = str1 + "<td>" + (object)this.ClassesToName(bean.Classes) + "</td>"; |
| | | str1 += "<tr><td>" + "<img src=\"../static/images/productIcon/" + (object)bean.Icon + "\" >" + "</td>"; |
| | | } |
| | | else |
| | | { |
| | | str1 += "<tr><td>" + (object)bean.Icon + "</td>"; |
| | | } |
| | | |
| | | str1 = str1 + "<td>" + ProductToName(bean.ParentId) + "</td>"; |
| | | str1 += "<td>" + bean.Name + "</td>"; |
| | | //str1 = str1 + "<td>" + (object)this.ClassesToName(bean.Classes) + "</td>"; |
| | | if (bean.RouterType == 1) |
| | | { |
| | | str1 += "<td rowspan=\"1\"><div class=\"btn btn-primary btn-xs\">点路由</div>"; |
| | | str1 += "<td rowspan=\"1\"><span class='label label-primary'>通道</span>"; |
| | | str1 += string.Format("<div>移动:{0}</div><div>电信:{1}</div><div>联通:{2}</div>", (object)this.GetOpName(bean.CmOpId), (object)this.GetOpName(bean.CtOpId), (object)this.GetOpName(bean.CuOpId)); |
| | | } |
| | | else if (bean.RouterType == 3) |
| | | { |
| | | str1 += "<td rowspan=\"1\"><div class=\"btn btn-success btn-xs\">组路由</div>"; |
| | | str1 += "<td rowspan=\"1\"><span class='label label-success'>通道组</span>"; |
| | | str1 += string.Format("<div>移动:{0}</div><div>电信:{1}</div><div>联通:{2}</div>", (object)this.GetGroupName(bean.CmGroupid), (object)this.GetGroupName(bean.CtGroupid), (object)this.GetGroupName(bean.CuGroupid)); |
| | | } |
| | | else |
| | | { |
| | | str1 += "<td rowspan=\"1\"></td>"; |
| | | } |
| | | str1 = str1 + "<td>" + ProductToName(bean.ParentId) + "</td>"; |
| | | str1 = str1 + "<td>" + IsDefaultToName(bean.IsDefault) + "</td>"; |
| | | str1 = str1 + "<td>" + IsEnableToName(bean.IsEnable) + "</td>"; |
| | | str1 = string.Concat(new object[4] |
| | | { |
| | | str1, |
| | | "<td>", |
| | | bean.Sort, |
| | | "</td>" |
| | | }); |
| | | /** |
| | | str1 = string.Concat(new object[4] |
| | | { |
| | | str1, |
| | | "<td>", |
| | | bean.Sort, |
| | | "</td>" |
| | | });**/ |
| | | str1 = string.Concat(new object[4] |
| | | { |
| | | str1, |
| | |
| | | "</td>" |
| | | }); |
| | | |
| | | str1 += string.Format("<td>{0}元/条</td>", (object)(Convert.ToDecimal(bean.Price) / new Decimal(1000))); |
| | | str1 += string.Format("<td>{0}</td>", (object)(Convert.ToDecimal(bean.Price) / new Decimal(1000))); |
| | | str1 = str1 + "<td>" + bean.CreateTime + "</td>"; |
| | | str1 += "<td class=\"text-right\">"; |
| | | str1 = string.Concat(new object[4] |
| | | { |
| | | str1, |
| | | "<td>", |
| | | bean.Instructions, |
| | | "</td>" |
| | | }); |
| | | str1 += "<td class=\"text-center \">"; |
| | | str1 = bean.IsEnable != 0 ? str1 + string.Format("<a href=\"javascript:;\" data-id=\"{0}\" data-is_enable=\"0\" class=\"action-update-status btn btn-primary btn-xs\"><i class=\"fa fa-toggle-off\"></i> 停用</a> ", (object) bean.Id ) : str1 + string.Format("<a href=\"javascript:;\" data-id=\"{0}\" data-is_enable=\"1\" class=\"action-update-status btn btn-default btn-xs\"><i class=\"fa fa-toggle-on\"/></i> 启用</a> ", (object) bean.Id ); |
| | | str1 += string.Format("<a href=\"javascript:;\" data-id=\"{0}\" class=\"action-modal-edit btn btn-success btn-xs\"><i class=\"fa fa-edit\"></i> 编辑</a> ", (object) bean.Id); |
| | | str1 += string.Format("<a href=\"javascript:;\" data-id=\"{0}\" class=\"action-delete btn btn-default btn-xs\"><i class=\"fa fa-trash\"></i> 删除</a> ", (object) bean.Id); |
| | |
| | | } |
| | | } |
| | | else |
| | | str1 += "<tr><td colspan=\"13\" style=\"padding-left:5px; text-align: center;\">暂无信息</td></tr>"; |
| | | str1 += "<tr><td colspan=\"11\" style=\"padding-left:5px; text-align: center;\">暂无信息</td></tr>"; |
| | | |
| | | return new JsonPageResult(true, new |
| | | { |
| | | Table = str1.ToString(), |
| | | TotalCount = recordCount |
| | | }); |
| | | } |
| | | |
| | | |
| | | |
| | | //加载产品分类信息 |
| | | private JsonPageResult ProductClassesList(PageContext<SysUser> context) |
| | | { |
| | | //Console.WriteLine("List.............[" + context.GetInt("name") + "][" + context.GetInt("classes") + "]"); |
| | | int classes = context.GetInt("classes"); |
| | | string name = context.GetString("name"); |
| | | |
| | | int recordCount = 0; |
| | | int pageSize = context.GetInt("pageSize", 50); |
| | | int pageIndex = context.GetInt("pageIndex", 1); |
| | | |
| | | List<GwProduct> list = _Dao.LoadInfoList(classes, name, pageSize, pageIndex, out recordCount); |
| | | |
| | | string str1 = ""; |
| | | if (list != null && list.Count > 0) |
| | | { |
| | | |
| | | int num = 0; |
| | | foreach (GwProduct bean in list) |
| | | { |
| | | |
| | | ++num; |
| | | |
| | | str1 += "<tr>"; |
| | | str1 += "<td>" + bean.Name + "</td>"; |
| | | str1 += "<td>" + ProductToName(bean.ParentId) + "</td>"; |
| | | str1 = str1 + "<td>" + IsEnableToName(bean.IsEnable) + "</td>"; |
| | | str1 = str1 + "<td>" + bean.CreateTime + "</td>"; |
| | | str1 = str1 + "<td>" + bean.Remark + "</td>"; |
| | | |
| | | str1 += "<td class=\"text-center\">"; |
| | | str1 = bean.IsEnable != 0 ? str1 + string.Format("<a href=\"javascript:;\" data-id=\"{0}\" data-is_enable=\"0\" class=\"action-update-status btn btn-primary btn-xs\"><i class=\"fa fa-toggle-off\"></i> 停用</a> ", (object) bean.Id ) : str1 + string.Format("<a href=\"javascript:;\" data-id=\"{0}\" data-is_enable=\"1\" class=\"action-update-status btn btn-default btn-xs\"><i class=\"fa fa-toggle-on\"/></i> 启用</a> ", (object) bean.Id ); |
| | | str1 += string.Format("<a href=\"javascript:;\" data-id=\"{0}\" class=\"action-modal-edit btn btn-success btn-xs\"><i class=\"fa fa-edit\"></i> 编辑</a> ", (object) bean.Id); |
| | | str1 += string.Format("<a href=\"javascript:;\" data-id=\"{0}\" class=\"action-delete btn btn-default btn-xs\"><i class=\"fa fa-trash\"></i> 删除</a> ", (object) bean.Id); |
| | | str1 += "</td>"; |
| | | str1 += "</tr>"; |
| | | } |
| | | } |
| | | else |
| | | str1 += "<tr><td colspan=\"11\" style=\"padding-left:5px; text-align: center;\">暂无信息</td></tr>"; |
| | | |
| | | return new JsonPageResult(true, new |
| | | { |
| | |
| | | int ctGroupid = 0; |
| | | int price = 0; |
| | | int givingNum = 0; |
| | | |
| | | string parentId = context.GetString("parentId", ""); |
| | | string path = ""; |
| | | if (string.IsNullOrEmpty(parentId) ) |
| | | { |
| | | path = "0"; |
| | | } |
| | | else |
| | | { |
| | | GwProduct newProduct = _Dao.Get(parentId); |
| | | if(newProduct!=null) |
| | | { |
| | | path = newProduct.Path=="" ? "0" : newProduct.Path + "," + newProduct.Id ; |
| | | } |
| | | else |
| | | { |
| | | path = "0"; |
| | | } |
| | | |
| | | } |
| | | |
| | | string info = "" ; |
| | | if (classes == -1) { |
| | |
| | | if (string.IsNullOrEmpty(name)) |
| | | { |
| | | throw new ArgumentException(info + "名称不能为空!"); |
| | | } |
| | | |
| | | if (string.IsNullOrEmpty(parentId)) |
| | | { |
| | | throw new ArgumentException("所属产品类别不能为空!"); |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | } |
| | | string parentId = context.GetString("parentId", "0"); |
| | | string path = ""; |
| | | if (parentId.Equals("0")) |
| | | { |
| | | path = "0"; |
| | | } |
| | | else |
| | | { |
| | | GwProduct newProduct = _Dao.Get(parentId); |
| | | if(newProduct!=null) |
| | | { |
| | | path = newProduct.Path=="" ? "0" : newProduct.Path + "," + newProduct.Id ; |
| | | } |
| | | else |
| | | { |
| | | path = "0"; |
| | | } |
| | | |
| | | } |
| | | int isEnable = context.GetInt("isEnable", 0); |
| | | |
| | | //int price = context.GetInt("price", 0); |
| | |
| | | int ctGroupid = 0; |
| | | int price = 0; |
| | | int givingNum = 0; |
| | | |
| | | string parentId = context.GetString("parentId", ""); |
| | | string path = ""; |
| | | if (string.IsNullOrEmpty(parentId) ) |
| | | { |
| | | path = "0"; |
| | | } |
| | | else |
| | | { |
| | | GwProduct newProduct = _Dao.Get(parentId); |
| | | if(newProduct!=null) |
| | | { |
| | | path = newProduct.Path=="" ? "0" : newProduct.Path + "," + newProduct.Id ; |
| | | } |
| | | else |
| | | { |
| | | path = "0"; |
| | | } |
| | | |
| | | } |
| | | |
| | | string info = "" ; |
| | | if (classes == -1) { |
| | |
| | | if (string.IsNullOrEmpty(name)) |
| | | { |
| | | throw new ArgumentException(info + "名称不能为空!"); |
| | | } |
| | | |
| | | if (string.IsNullOrEmpty(parentId)) |
| | | { |
| | | throw new ArgumentException("所属产品类别不能为空!"); |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | } |
| | | string parentId = context.GetString("parentId", "0"); |
| | | string path = ""; |
| | | if (parentId.Equals("0")) |
| | | { |
| | | path = "0"; |
| | | } |
| | | else |
| | | { |
| | | GwProduct newProduct = _Dao.Get(parentId); |
| | | if(newProduct!=null) |
| | | { |
| | | path = newProduct.Path=="" ? "0" : newProduct.Path + "," + newProduct.Id ; |
| | | } |
| | | else |
| | | { |
| | | path = "0"; |
| | | } |
| | | |
| | | } |
| | | int isEnable = context.GetInt("isEnable", 0); |
| | | |
| | | string remark = context.GetString("remark", ""); |
| | |
| | | if (classes == -1) |
| | | return string.Empty; |
| | | else if(classes == 0) |
| | | return "0-产品分类"; |
| | | return "产品分类"; |
| | | else if(classes == 1) |
| | | return "1-产品"; |
| | | return "产品"; |
| | | |
| | | return string.Empty; |
| | | } |
| | |
| | | if (isDefault == -1) |
| | | return string.Empty; |
| | | else if(isDefault == 0) |
| | | return "0-个性化"; |
| | | return "<span class='label label-warning'>个性化</span>"; |
| | | else if(isDefault == 1) |
| | | return "1-系统默认"; |
| | | return "<span class='label label-success'>系统默认</span>"; |
| | | |
| | | return string.Empty; |
| | | } |
| | |
| | | if (isEnable == -1) |
| | | return string.Empty; |
| | | else if(isEnable == 0) |
| | | return "0-停用"; |
| | | return "<span class='label label-default'>已停用</span>"; |
| | | else if(isEnable == 1) |
| | | return "1-启用"; |
| | | return "<span class='label label-primary'>已启用</span>"; |
| | | |
| | | return string.Empty; |
| | | } |