标签:
1.前台代码
<%-- builed by manage.aspx.cmt [ver:2015.25.26] at 2015-06-26 15:25:42 --%>
<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="CcrCompanyManage.aspx.cs" Inherits="HraWeb.CcrCompanyManage" %>
<%@ Register Assembly="Trirand.Web" TagPrefix="asp" Namespace="Trirand.Web.UI.WebControls" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div id="toolbar" class="datagrid-toolbar">
<span class="title">行业:</span><input type="text" id="txt_Industry_LK_" name="txt_Industry_LK_" class="input datacontrol" style="width: 150px" />
<a href="#" id="btn_search" iconcls="icon-search" class="button">选择行业</a>
<a href="#" id="btn_supperSearch" iconcls="icon-supperSearch" class="button">高级查询</a>
<a href="#" id="btn_add" iconcls="icon-add" class="button">加入清单</a>
<a href="#" id="btn_del" iconcls="icon-remove" class="button">移除清单</a>
<a href="#" id="btn_adds" iconcls="icon-adds" class="button">全部加入</a>
<a href="#" id="btn_dels" iconcls="icon-BatchDelete" class="button">全部移除</a>
</div>
<div style="text-align: center;">公司基本信息</div>
<div class=‘jdataGrid‘ id="jq1div" style="width: <%=System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width*0.6%>px">
<asp:JQGrid runat="server" ID="jq" Height="400" MultiSelect="true"
DataUrl="/CCR/CcrCompanyManage.aspx?_method=search">
<Columns>
<asp:JQGridColumn DataField="CompanyName" Visible="true" HeaderText="公司名称" Frozen="True"></asp:JQGridColumn>
<asp:JQGridColumn DataField="RealationshipWithGovernment" Visible="true" SupperControlType="Combox" HeaderText="与政府关系" SuperUrl="/Common/EntityJsonList.ashx?_method=entity&entityType=SysEnumDic&&where=ParentCode=‘Relationship_Type‘" SuperDataTextField="EnumName" SuperDataValueField="EnumValue" SuperFilterColumn="RealationshipWithGovernment">
<Formatter>
<asp:CustomFormatter FormatFunction="ChangeType" />
</Formatter>
</asp:JQGridColumn>
<asp:JQGridColumn DataField="RegisteredCapital" Visible="true" HeaderText="注册资本"></asp:JQGridColumn>
<asp:JQGridColumn DataField="PaidupCapital" Visible="true" HeaderText="实收资本"></asp:JQGridColumn>
<asp:JQGridColumn DataField="MainBusiness" Visible="true" HeaderText="主营业务" Frozen="True"></asp:JQGridColumn>
<asp:JQGridColumn DataField="OtherBusiness" Visible="true" HeaderText="兼营业务"></asp:JQGridColumn>
<asp:JQGridColumn DataField="Industry" Visible="true" HeaderText="行业" SupperControlType="Combox" SuperUrl="/Common/EntityJsonList.ashx?_method=entity&entityType=SysEnumDic&&where=ParentCode=‘Sector_Type‘" SuperDataTextField="EnumName" SuperDataValueField="EnumValue" SuperFilterColumn="Industry">
<Formatter>
<asp:CustomFormatter FormatFunction="ChangeType" />
</Formatter>
</asp:JQGridColumn>
<asp:JQGridColumn DataField="Scale" Visible="true" HeaderText="规模"></asp:JQGridColumn>
<asp:JQGridColumn DataField="Ownership" Visible="true" SupperControlType="Combox" HeaderText="所有制类别" SuperUrl="/Common/EntityJsonList.ashx?_method=entity&entityType=SysEnumDic&&where=ParentCode=‘Ownership_Type‘" SuperDataTextField="EnumName" SuperDataValueField="EnumValue" SuperFilterColumn="Ownership">
<Formatter>
<asp:CustomFormatter FormatFunction="ChangeType" />
</Formatter>
</asp:JQGridColumn>
<asp:JQGridColumn DataField="Organization" Visible="true" HeaderText="组织类别" SupperControlType="Combox" SuperUrl="/Common/EntityJsonList.ashx?_method=entity&entityType=SysEnumDic&&where=ParentCode=‘Organization_Type‘" SuperDataTextField="EnumName" SuperDataValueField="EnumValue" SuperFilterColumn="Organization">
<Formatter>
<asp:CustomFormatter FormatFunction="ChangeType" />
</Formatter>
</asp:JQGridColumn>
<asp:JQGridColumn DataField="Subsidiary" Visible="true" HeaderText="全资子公司数量"></asp:JQGridColumn>
<asp:JQGridColumn DataField="HoldingCompany" Visible="true" HeaderText="控股公司数量"></asp:JQGridColumn>
<asp:JQGridColumn DataField="Plant" Visible="true" HeaderText="附属厂数量"></asp:JQGridColumn>
<asp:JQGridColumn DataField="RawDataId" Visible="true" HeaderText="用于关联表的ID"></asp:JQGridColumn>
<asp:JQGridColumn DataField="Purpose" Visible="true" HeaderText="数据用途" SupperControlType="Combox" SuperUrl="/Common/EntityJsonList.ashx?_method=entity&entityType=SysEnumDic&&where=ParentCode=‘CCR_Credit_Score‘" SuperDataTextField="EnumName" SuperDataValueField="EnumValue" SuperFilterColumn="Purpose">
<Formatter>
<asp:CustomFormatter FormatFunction="ChangeType" />
</Formatter>
</asp:JQGridColumn>
<asp:JQGridColumn DataField="BusinessLicenseNum" Visible="true" HeaderText="法人营业执照号码"></asp:JQGridColumn>
<asp:JQGridColumn DataField="LoanCardNum" Visible="true" HeaderText="贷款卡(证)号码"></asp:JQGridColumn>
<asp:JQGridColumn DataField="QualificationLevel" Visible="true" HeaderText="资质等级"></asp:JQGridColumn>
<asp:JQGridColumn DataField="LegalEntityCode" Visible="true" HeaderText="法人代码证号"></asp:JQGridColumn>
<asp:JQGridColumn DataField="LegalEntityPerson" Visible="true" HeaderText="法定代表人"></asp:JQGridColumn>
<asp:JQGridColumn DataField="BaseBankAccountNum" Visible="true" HeaderText="基本帐户行"></asp:JQGridColumn>
<asp:JQGridColumn DataField="BusinessStartDate" Visible="true" HeaderText="公司成立日期">
<Formatter>
<asp:CustomFormatter FormatFunction="getDate" />
</Formatter>
</asp:JQGridColumn>
<asp:JQGridColumn DataField="Region" Visible="true" HeaderText="所属区域"></asp:JQGridColumn>
<asp:JQGridColumn DataField="CreditRate" Visible="true" HeaderText="信用等级"></asp:JQGridColumn>
<asp:JQGridColumn DataField="IsDefaultClient" Visible="true" HeaderText="是否违约客户"></asp:JQGridColumn>
<asp:JQGridColumn DataField="EmployeeNumber" Visible="true" HeaderText="职工人数"></asp:JQGridColumn>
<asp:JQGridColumn DataField="EmployeeWageAvgLevel" Visible="true" HeaderText="职工月均工资水平 "></asp:JQGridColumn>
<asp:JQGridColumn DataField="StockCode" Visible="true" HeaderText="股票代码"></asp:JQGridColumn>
<asp:JQGridColumn DataField="StockCodeName" Visible="true" HeaderText="股票代码名称 "></asp:JQGridColumn>
<asp:JQGridColumn DataField="Id" Visible="false" PrimaryKey="true"></asp:JQGridColumn>
</Columns>
<ClientSideEvents LoadComplete="JDataGrid.loadComplete" />
</asp:JQGrid>
</div>
<div style="text-align: center;">公司信息清单</div>
<div id="tt" class="easyui-tabs" data-options="tools:‘#tab-tools‘" style="width: <%=System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width*0.6%>px">
</div>
<div class=‘jdataGrid‘ id="jq2div" style="width: <%=System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width*0.6%>px;">
<asp:JQGrid runat="server" ID="jq2" Height="400" MultiSelect="True" DataUrl="/CCR/CcrCompanyManage.aspx?_method=searchlist">
<Columns>
<asp:JQGridColumn DataField="CompanyName" Visible="true" HeaderText="公司名称" Frozen="True"></asp:JQGridColumn>
<%-- <asp:JQGridColumn DataField="ClientId" Visible="true" HeaderText="客户ID" ></asp:JQGridColumn>--%>
<asp:JQGridColumn DataField="RealationshipWithGovernment" Visible="true" HeaderText="与政府关系">
<Formatter>
<asp:CustomFormatter FormatFunction="ChangeType" />
</Formatter>
</asp:JQGridColumn>
<asp:JQGridColumn DataField="RegisteredCapital" Visible="true" HeaderText="注册资本"></asp:JQGridColumn>
<asp:JQGridColumn DataField="PaidupCapital" Visible="true" HeaderText="实收资本"></asp:JQGridColumn>
<asp:JQGridColumn DataField="MainBusiness" Visible="true" HeaderText="主营业务" Frozen="True"></asp:JQGridColumn>
<asp:JQGridColumn DataField="OtherBusiness" Visible="true" HeaderText="兼营业务"></asp:JQGridColumn>
<asp:JQGridColumn DataField="Industry" Visible="true" HeaderText="行业">
<Formatter>
<asp:CustomFormatter FormatFunction="ChangeType" />
</Formatter>
</asp:JQGridColumn>
<asp:JQGridColumn DataField="Scale" Visible="true" HeaderText="规模"></asp:JQGridColumn>
<asp:JQGridColumn DataField="Ownership" Visible="true" HeaderText="所有制类别">
<Formatter>
<asp:CustomFormatter FormatFunction="ChangeType" />
</Formatter>
</asp:JQGridColumn>
<asp:JQGridColumn DataField="Organization" Visible="true" HeaderText="组织类别">
<Formatter>
<asp:CustomFormatter FormatFunction="ChangeType" />
</Formatter>
</asp:JQGridColumn>
<asp:JQGridColumn DataField="Subsidiary" Visible="true" HeaderText="全资子公司数量"></asp:JQGridColumn>
<asp:JQGridColumn DataField="HoldingCompany" Visible="true" HeaderText="控股公司数量"></asp:JQGridColumn>
<asp:JQGridColumn DataField="Plant" Visible="true" HeaderText="附属厂数量"></asp:JQGridColumn>
<asp:JQGridColumn DataField="RawDataId" Visible="true" HeaderText="用于关联表的ID"></asp:JQGridColumn>
<asp:JQGridColumn DataField="Purpose" Visible="true" HeaderText="数据用途">
<Formatter>
<asp:CustomFormatter FormatFunction="ChangeType" />
</Formatter>
</asp:JQGridColumn>
<asp:JQGridColumn DataField="BusinessLicenseNum" Visible="true" HeaderText="法人营业执照号码"></asp:JQGridColumn>
<asp:JQGridColumn DataField="LoanCardNum" Visible="true" HeaderText="贷款卡(证)号码"></asp:JQGridColumn>
<asp:JQGridColumn DataField="QualificationLevel" Visible="true" HeaderText="资质等级"></asp:JQGridColumn>
<asp:JQGridColumn DataField="LegalEntityCode" Visible="true" HeaderText="法人代码证号"></asp:JQGridColumn>
<asp:JQGridColumn DataField="LegalEntityPerson" Visible="true" HeaderText="法定代表人"></asp:JQGridColumn>
<asp:JQGridColumn DataField="BaseBankAccountNum" Visible="true" HeaderText="基本帐户行"></asp:JQGridColumn>
<asp:JQGridColumn DataField="BusinessStartDate" Visible="true" HeaderText="公司成立日期">
<Formatter>
<asp:CustomFormatter FormatFunction="getDate" />
</Formatter>
</asp:JQGridColumn>
<asp:JQGridColumn DataField="Region" Visible="true" HeaderText="所属区域"></asp:JQGridColumn>
<asp:JQGridColumn DataField="CreditRate" Visible="true" HeaderText="信用等级"></asp:JQGridColumn>
<asp:JQGridColumn DataField="IsDefaultClient" Visible="true" HeaderText="是否违约客户"></asp:JQGridColumn>
<asp:JQGridColumn DataField="EmployeeNumber" Visible="true" HeaderText="职工人数"></asp:JQGridColumn>
<asp:JQGridColumn DataField="EmployeeWageAvgLevel" Visible="true" HeaderText="职工月均工资水平 "></asp:JQGridColumn>
<asp:JQGridColumn DataField="StockCode" Visible="true" HeaderText="股票代码"></asp:JQGridColumn>
<asp:JQGridColumn DataField="StockCodeName" Visible="true" HeaderText="股票代码名称 "></asp:JQGridColumn>
<asp:JQGridColumn DataField="Id" Visible="false" PrimaryKey="true"></asp:JQGridColumn>
</Columns>
<ClientSideEvents LoadComplete="JDataGrid.loadComplete" />
</asp:JQGrid>
</div>
</form>
<script type="text/javascript">
var index = 0;
function getAllTab() {
$.post("CcrCompanyManage.aspx", { NngaSettingId: NngaSettingId, _method: "GetGroupIndustry" }, function (data) {
var allTabs = $("#tt").tabs("tabs");
var allTabsTitle = [];
for (var i = 0; i < allTabs.length; i++) {
var title = allTabs[i].panel("options").title;
allTabsTitle[allTabsTitle.length] = title;
}
//for (var i = 0; i < allTabsTitle.length; i++) {
// $("#tt").tabs(‘close‘, allTabsTitle[i]);
//}
try {
data = JSON.parse(data);
for (var i = 0; i < data.length; i++) {
GroupIndustryArr.push(data[i]);
if (!($(‘#tt‘).tabs(‘exists‘, data[i].IndustryName))) {
$(‘#tt‘).tabs(‘add‘, {
title: data[i].IndustryName,
closable: true
})
};
}
} catch (e) {
;
}
});
}
function addPanel() {
index++;
$(‘#tt‘).tabs(‘add‘, {
title: ‘Tab‘ + index,
content: ‘<div style="padding:10px">Content‘ + index + ‘</div>‘,
closable: true
});
}
function removePanel() {
var tab = $(‘#tt‘).tabs(‘getSelected‘);
if (tab) {
var index = $(‘#tt‘).tabs(‘getTabIndex‘, tab);
$(‘#tt‘).tabs(‘close‘, index);
}
}
var jsonDic;
var isDelIndustry = false;
var isDelAllIndustry = false;
function ChangeType(value, indx, rec) {
while (jsonDic == undefined) {
jsonDic = UTIL.GetChangeTypeJson("SysEnumDic", "EnumValue", "EnumName");
}
return BindDictDrop(value, jsonDic, "EnumValue", "EnumName", false);
}
//行业多选
UTIL.SetEntityComboByParentCode($("#txt_Industry_LK_"), "Sector_Type", null, null, null, null, 50, null, null, true);
//多选查询
$("#btn_search").click(function () {
var queryParams = $("body").GetSearchPostData();
if (SupperSearch == false) {
var ids = UTIL.GetCombogridMutipleGetSelection($("#txt_Industry_LK_"), "EnumValue", "EnumName");
if (ids != null) {
queryParams["IndustryIds"] = ids;
}
} else {
SupperSearch = false;
}
$("#jq").jqGrid("setGridParam", { postData: queryParams, page: 1 }).trigger("reloadGrid");
JDataGrid.InitSearch();
});
var NngaSettingId;
var SupperSearch = false;
//tab的事件
$(‘#tt‘).tabs({
//选中事件
onSelect: function (title) {
if (isDelIndustry == false) {
var p = $(this).tabs(‘getTab‘, title);
for (var i = 0; i < GroupIndustryArr.length; i++) {
var IndustryName = GroupIndustryArr[i].IndustryName;
var IndustryValue = GroupIndustryArr[i].IndustryValue;
if (IndustryName == title) {
$("#jq2").jqGrid("setGridParam", { postData: { NngaSettingId: NngaSettingId, selIndustry: IndustryValue, page: 1 } }).trigger("reloadGrid");
}
}
} else {
isDelIndustry = false;
}
},
//删除之前的确认事件
onBeforeClose: function (title, index) {
if (isDelAllIndustry == false) {
$.messager.alert("操作提示", ‘你确认要删除‘ + title + ‘的所有样本吗?‘, "warning");
}
isDelIndustry = true;
for (var i = 0; i < GroupIndustryArr.length; i++) {
var IndustryName = GroupIndustryArr[i].IndustryName;
var IndustryValue = GroupIndustryArr[i].IndustryValue;
if (IndustryName == title) {
//$.post("CcrCompanyManage.aspx", { NngaSettingId: NngaSettingId, selIndustry: IndustryValue, _method: "removeTabPanel" });
$.ajax({
async: false,
type: "post",
url: ‘CcrCompanyManage.aspx‘,
data: { NngaSettingId: NngaSettingId, selIndustry: IndustryValue, _method: "removeTabPanel" },
dataType: "json",
success: function (data) {
}
});
var postData = $("#jq2").jqGrid("getGridParam", "postData");
delete postData["selIndustry"];
$("#jq2").jqGrid("setGridParam", { postData: { NngaSettingId: NngaSettingId, page: 1 } }).trigger("reloadGrid");
//getAllTab();
break;
}
}
},
//删除事件
onClose: function (title) {
//完成缓存中的对应行业的移除
}
});
var GroupIndustryArr = new Array();
function PageOnLoad() {
$("#btn_supperSearch").click(function () {
SupperSearch = true;
JDataGrid.InitSupper();
UTIL.popupDiv("pop-div", 550, 400);
});
//获取url参数神经网络结构设置id
NngaSettingId = UTIL.getUrlParam("NngaSettingId");
getAllTab();
//加入清单
$("#btn_add").on("click", function () {
var rowids = $("#jq").jqGrid(‘getGridParam‘, ‘selarrrow‘);
//var isTabExist;
////TODO:判断tab是否存在
//if (!isTabExist) {
// //不存在,添加tab
// $(‘#tt‘).tabs(‘add‘, {
// title: ‘Tab‘,
// //content: $("#jq2div").clone().html(),
// closable: true
// });
//} else {
// //存在,选中tab
// $("#tt").tabs("select", 2);
//}
$.ajax({
async: false,
type: "POST",
url: ‘CcrCompanyManage.aspx?_method=setBatchAddRow&rowidList=‘ + rowids + "&NngaSettingId=" + NngaSettingId,
dataType: "text",
success: function (data) {
getAllTab();
$("#jq2").jqGrid("setGridParam", { postData: { NngaSettingId: NngaSettingId, page: 1 } }).trigger("reloadGrid");
}
});
});
//移除清单
$("#btn_del").on("click", function () {
var rowids = $("#jq2").jqGrid(‘getGridParam‘, ‘selarrrow‘);
$.ajax({
async: false,
type: "POST",
url: ‘CcrCompanyManage.aspx?_method=setBatchRemoveRow&rowidList=‘ + rowids + "&NngaSettingId=" + NngaSettingId,
dataType: "text",
success: function (data) {
getAllTab();
$("#jq2").jqGrid("setGridParam", { postData: { NngaSettingId: NngaSettingId, page: 1 } }).trigger("reloadGrid");
}
});
});
//全部加入
$("#btn_adds").on("click", function () {
var rowids = $("#jq").jqGrid(‘getGridParam‘, ‘selarrrow‘);
var insdustryIds = UTIL.GetCombogridMutipleGetSelection($("#txt_Industry_LK_"), "EnumValue", "EnumName");
$.ajax({
async: false,
type: "POST",
url: "CcrCompanyManage.aspx?_method=setBatchAddAllRow&NngaSettingId=" + NngaSettingId + "&IndustryIds=" + insdustryIds,
dataType: "text",
success: function (data) {
getAllTab();
$("#jq2").jqGrid("setGridParam", { postData: { NngaSettingId: NngaSettingId, page: 1 } }).trigger("reloadGrid");
}
});
});
//全部移除
$("#btn_dels").on("click", function () {
$.ajax({
async: false,
type: "POST",
url: "CcrCompanyManage.aspx?_method=setBatchRemoveAllRow&NngaSettingId=" + NngaSettingId,
dataType: "text",
success: function (data) {
isDelAllIndustry = false;
getAllTab();
$("#jq2").jqGrid("setGridParam", { postData: { NngaSettingId: NngaSettingId, page: 1 } }).trigger("reloadGrid");
}
});
isDelAllIndustry = true;
var rowids = $("#jq").jqGrid(‘getGridParam‘, ‘selarrrow‘);
var allTabs = $("#tt").tabs("tabs");
var allTabsTitle = [];
for (var i = 0; i < allTabs.length; i++) {
var title = allTabs[i].panel("options").title;
allTabsTitle[allTabsTitle.length] = title;
}
for (var i = 0; i < allTabsTitle.length; i++) {
$("#tt").tabs(‘close‘, allTabsTitle[i]);
}
});
//控件按钮设置
$(".button").linkbutton({ plain: true });
}
</script>
</body>
</html>
2.后台代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HraWeb.Common;
using WebApp.Common;
using Contract.Domain;
using System.Collections;
using System.Runtime.Serialization.Json;
using Common;
using Elmah;
using Framework;
namespace HraWeb
{
public partial class CcrCompanyManage : JQEntityManage<Contract.Domain.CcrFundermental>
{
private Spring.Caching.ICache cache;
private Spring.Caching.ICache SpringCache
{
get
{
if (cache == null)
cache = (Spring.Caching.ICache)ctx.GetObject("AspNetCache");
return cache;
}
set { cache = value; }
}
/// <summary>
/// 加入清单
/// </summary>
public void setBatchAddRow()
{
string NngaSettingId = Request["NngaSettingId"] ?? "";
string CheckRowIds = Request["rowidList"];
if (string.IsNullOrEmpty(CheckRowIds)) return;
List<string> idsList = CheckRowIds.Split(‘,‘).ToList();
List<int> intIds = new List<int>();
idsList.ForEach(a => { intIds.Add(int.Parse(a)); });
info = new QueryInfo();
info.QueryObject = "CcrFundermental";
info.AddParam("ids", intIds, " and Id in (:ids)");
List<CcrFundermental> newfundermentals = new List<CcrFundermental>();
if (SpringCache.Get("CcrCompanyManage_jq_list") == null)
{
SpringCache.Insert("CcrCompanyManage_jq_list", new Dictionary<string, List<CcrFundermental>>());
}
List<CcrFundermental> tempfundermentals = Holworth.Utility.HraUtility.ListToT<CcrFundermental>(Dao.FindList(info)).ToList();
if (tempfundermentals != null)
{
var dictionary = (Dictionary<string, List<CcrFundermental>>)SpringCache.Get("CcrCompanyManage_jq_list");
if (dictionary != null && dictionary.ContainsKey(NngaSettingId))
{
newfundermentals = dictionary[NngaSettingId];
NewfundermentalsAddListCheckRepert(newfundermentals, tempfundermentals);
}
else
{
dictionary.Add(NngaSettingId, tempfundermentals);
newfundermentals = tempfundermentals;
}
}
var json = Newtonsoft.Json.JsonConvert.SerializeObject(newfundermentals);
Response.Write(json);
Response.End();
}
/// <summary>
/// 移除清单
/// </summary>
public void setBatchRemoveRow()
{
string NngaSettingId = Request["NngaSettingId"] ?? "";
string CheckRowIds = Request["rowidList"];
if (string.IsNullOrEmpty(CheckRowIds)) return;
List<string> idsList = CheckRowIds.Split(‘,‘).ToList();
List<int> intIds = new List<int>();
idsList.ForEach(a => { intIds.Add(int.Parse(a)); });
info = new QueryInfo();
info.QueryObject = "CcrFundermental";
info.AddParam("ids", intIds, " and Id in (:ids)");
List<CcrFundermental> newfundermentals = new List<CcrFundermental>();
if (SpringCache.Get("CcrCompanyManage_jq_list") == null)
{
SpringCache.Insert("CcrCompanyManage_jq_list", new Dictionary<string, List<CcrFundermental>>());
return;
}
List<CcrFundermental> tempfundermentals = Holworth.Utility.HraUtility.ListToT<CcrFundermental>(Dao.FindList(info)).ToList();
if (tempfundermentals != null && tempfundermentals.Count > 0)
{
var dictionary = (Dictionary<string, List<CcrFundermental>>)SpringCache.Get("CcrCompanyManage_jq_list");
if (dictionary != null && dictionary.ContainsKey(NngaSettingId))
{
newfundermentals = dictionary[NngaSettingId];
var newfundermentalsDic = newfundermentals.ToDictionary(x => x.Id);
tempfundermentals.ForEach(a =>
{
newfundermentals.Remove(newfundermentalsDic[a.Id]);
});
}
}
var json = Newtonsoft.Json.JsonConvert.SerializeObject(newfundermentals);
Response.Write(json);
Response.End();
}
/// <summary>
/// 全部加入
/// </summary>
public void setBatchAddAllRow()
{
string NngaSettingId = Request["NngaSettingId"] ?? "";
info = Session["jq1_setInfo"] as QueryInfo;
if (info == null)
{
info = SetInfo();
}
if (!string.IsNullOrEmpty(Request["IndustryIds"]))
{
string[] ids = Request["IndustryIds"].Split(‘;‘);
info.Parameters.Remove("IndustryIds");
info.AddParam("IndustryIds", ids, " and Industry in (:IndustryIds)");
}
info.QueryObject = "CcrFundermental";
List<CcrFundermental> newfundermentals = Holworth.Utility.HraUtility.ListToT<CcrFundermental>(Dao.FindList(info)).ToList();
if (SpringCache.Get("CcrCompanyManage_jq_list") == null)
{
SpringCache.Insert("CcrCompanyManage_jq_list", new Dictionary<string, List<CcrFundermental>>());
}
var dictionary = (Dictionary<string, List<CcrFundermental>>)SpringCache.Get("CcrCompanyManage_jq_list");
if (dictionary != null && dictionary.ContainsKey(NngaSettingId))
{
var tempfundermentals = dictionary[NngaSettingId];
NewfundermentalsAddListCheckRepert(newfundermentals, tempfundermentals);
dictionary[NngaSettingId] = newfundermentals;
}
else
{
dictionary.Add(NngaSettingId, newfundermentals);
}
var json = Newtonsoft.Json.JsonConvert.SerializeObject(newfundermentals);
Response.Write(json);
Response.End();
}
/// <summary>
/// 全部移除
/// </summary>
public void setBatchRemoveAllRow()
{
string NngaSettingId = Request["NngaSettingId"] ?? "";
List<CcrFundermental> newfundermentals = new List<CcrFundermental>();
int i = 0;
var dictionary = (Dictionary<string, List<CcrFundermental>>)SpringCache.Get("CcrCompanyManage_jq_list");
if (dictionary != null && dictionary.ContainsKey(NngaSettingId))
{
dictionary[NngaSettingId] = new List<CcrFundermental>();
}
var json = Newtonsoft.Json.JsonConvert.SerializeObject(newfundermentals);
Response.Write(json);
Response.End();
}
public void NewfundermentalsAddListCheckRepert(List<CcrFundermental> newfyFundermentals, List<CcrFundermental> tempfundermentals)
{
for (int i = 0; i < tempfundermentals.Count; i++)
{
var temp = tempfundermentals[i];
if (newfyFundermentals.Count(f => f.Id == temp.Id) <= 0)
{
newfyFundermentals.Add(temp);
}
}
}
protected override void Page_Load(object sender, EventArgs e)
{
//给基类服务接口复制,可不付
//base.svc = Psvc;
if (!IsPostBack)
{
}
switch (Request["_method"])
{
case "setBatchAddRow":
setBatchAddRow();
break;
case "searchlist":
setSearchList();
break;
case "setBatchRemoveRow":
setBatchRemoveRow();
break;
case "setBatchAddAllRow":
setBatchAddAllRow();
break;
case "setBatchRemoveAllRow":
setBatchRemoveAllRow();
break;
case "GetGroupIndustry":
GetGroupIndustry();
break;
case "removeTabPanel"://移除行业(页签时触发的事件)
removeTabPanel();
break;
}
jq.ComputHeight = string.Empty;
jq.Height = 150;
jq.Width = 1800;
jq2.ComputHeight = string.Empty;
jq2.Height = 150;
jq2.Width = 1800;
base.Page_Load(sender, e);
}
private void removeTabPanel()
{
string NngaSettingId = Request["NngaSettingId"] ?? "";
List<CcrFundermental> newfundermentals = new List<CcrFundermental>();
if (SpringCache.Get("CcrCompanyManage_jq_list") == null)
{
SpringCache.Insert("CcrCompanyManage_jq_list", new Dictionary<string, List<CcrFundermental>>());
return;
}
var dictionary = (Dictionary<string, List<CcrFundermental>>)SpringCache.Get("CcrCompanyManage_jq_list");
if (!dictionary.ContainsKey(NngaSettingId))
{
return;
}
List<CcrFundermental> totalFunmentals = dictionary[NngaSettingId];
List<CcrFundermental> tempfundermentals = totalFunmentals;
if (!string.IsNullOrEmpty(Request["selIndustry"]))
{
tempfundermentals = tempfundermentals.Where(x => x.Industry == Request["selIndustry"]).ToList();
}
if (tempfundermentals != null && tempfundermentals.Count > 0)
{
var totalFunmentalsDic = totalFunmentals.ToDictionary(x => x.Id);
tempfundermentals.ForEach(a =>
{
totalFunmentals.Remove(totalFunmentalsDic[a.Id]);
});
}
var json = Newtonsoft.Json.JsonConvert.SerializeObject(newfundermentals);
Response.Write(json);
Response.End();
}
private void GetGroupIndustry()
{
QueryInfo info = new QueryInfo();
info.QueryObject = "SysEnumDic";
List<SysEnumDic> IndustryList = Holworth.Utility.HraUtility.ListToT<SysEnumDic>(Dao.FindList(info)).ToList();
string NngaSettingId = Request["NngaSettingId"] ?? "";
if (!string.IsNullOrEmpty(NngaSettingId))
{
if (SpringCache.Get("CcrCompanyManage_jq_list") != null)
{
Dictionary<string, List<CcrFundermental>> dictionary = SpringCache.Get("CcrCompanyManage_jq_list") as Dictionary<string, List<CcrFundermental>>;
List<CcrFundermental> funmentals = new List<CcrFundermental>();
if (dictionary.ContainsKey(NngaSettingId))
{
funmentals = dictionary[NngaSettingId].OrderBy(x => x.Industry).ToList().Distinct(new fdsDistinct()).ToList();
var fds = from f in funmentals join d in IndustryList on f.Industry equals d.EnumValue.ToString() select new { IndustryValue = f.Industry, IndustryName = d.EnumName };
var fdJson = Newtonsoft.Json.JsonConvert.SerializeObject(fds);
Response.Write(fdJson);
}
}
}
Response.End();
}
private void setSearchList()
{
try
{
int PageSize = 0;
List<CcrFundermental> fundermentals = new List<CcrFundermental>();
if (SpringCache.Get("CcrCompanyManage_jq_list") != null)
{
var dictionary = SpringCache.Get("CcrCompanyManage_jq_list") as Dictionary<string, List<CcrFundermental>>;
string NngaSettingId = Request["NngaSettingId"];
if (NngaSettingId == null)
{
NngaSettingId = Request["txt_NngaSettingId_"];
}
if (NngaSettingId != null && NngaSettingId.Contains(‘,‘))
{
NngaSettingId = Request["NngaSettingId"].Split(‘,‘)[0];
}
if (dictionary.ContainsKey(NngaSettingId))
{
fundermentals = dictionary[NngaSettingId];
}
if (!string.IsNullOrEmpty(Request["selIndustry"]))
{
//点击tab页面进行的行业过滤 由于动态为存在的行业做了tab页
fundermentals = fundermentals.Where(x => x.Industry == Request["selIndustry"]).ToList();
}
}
#region 分页信息
int pageIndex = 0;
try
{
PageSize = int.Parse(HttpContext.Current.Request["rows"]);
pageIndex = int.Parse(HttpContext.Current.Request["page"]);
if (!string.IsNullOrEmpty(Request["sidx"]))
{
info.OrderBy.Add(Request["sidx"] + " " + Request["sord"]);
}
}
catch (Exception ex)
{
}
#endregion
int totalPage = fundermentals.Count / PageSize;
if (fundermentals.Count % PageSize != 0)
{
totalPage++;
}
fundermentals = fundermentals.OrderBy(x => x.Industry).ToList();
string industry = "";
if (fundermentals.Count > 0)
{
industry = fundermentals[0].Industry;
}
//默认选取第一个行业的公司进行输出
if (fundermentals.Count > 0 && string.IsNullOrEmpty(Request["selIndustry"]))
{
fundermentals = fundermentals.Where(x => x.Industry == industry).Skip((pageIndex - 1) * PageSize).Take(PageSize).ToList();
}
int totalCount = fundermentals.Count;
JGridJson d = new JGridJson(totalPage, fundermentals, pageIndex, totalCount);
HttpContext.Current.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(d));
}
catch (Exception ex)
{
System.Collections.ArrayList list = new System.Collections.ArrayList();
list.Add(new
{
ErrorCode = -999,
Message = ex.Message
});
Utility.JSUtil.log(ex);
ErrorSignal.FromCurrentContext().Raise(ex);
DataGridJson d = new DataGridJson(0, list);
HttpContext.Current.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(d));
}
finally
{
HttpContext.Current.Response.End();
}
}
/// <summary>
/// 设置查询条件或者语句
/// </summary>
/// <returns></returns>
protected override Framework.QueryInfo SetInfo()
{
info = base.SetInfo();
Session["jq1_setInfo"] = info.Clone();
if (!string.IsNullOrEmpty(Request["IndustryIds"]))
{
string[] ids = Request["IndustryIds"].Split(‘;‘);
info.AddParam("IndustryIds", ids, " and Industry in (:IndustryIds)");
}
return info;
}
/// <summary>
/// 初始化页面控件
/// </summary>
protected override void InitPage()
{
if (!jq2.DataUrl.Contains("NngaSettingId"))
{
jq2.DataUrl = "/CCR/CcrCompanyManage.aspx?_method=searchlist&txt_NngaSettingId_=" + Request["NngaSettingId"];
}
base.InitPage();
// BindDrop(drp_Unit, "SPSW", true);
}
/// <summary>
/// 获取缓存的jq2清单 dictionary的key为神经网络设置id,值为该神经网络设置下配置的公司集合
/// </summary>
/// <returns></returns>
protected Dictionary<string, List<CcrFundermental>> GetJQ2ListCache()
{
if (SpringCache.Get("CcrCompanyManage_jq_list") == null)
{
return new Dictionary<string, List<CcrFundermental>>();
}
return SpringCache.Get("CcrCompanyManage_jq_list") as Dictionary<string, List<CcrFundermental>>;
}
//private Contract.IService.IAlmBankCashService psvc;
///// <summary>
///// 初始化
///// </summary>
//Contract.IService.IAlmBankCashService Psvc
//{
// get
// {
// if (psvc == null)
// {
// psvc = ctx.GetObject("AlmBankCashService") as Contract.IService.IAlmBankCashService;
// }
// return psvc;
// }
//}
}
}
标签:
原文地址:http://www.cnblogs.com/kexb/p/5059448.html