• 增加节点额度可能用到


    BasLimitConfig.cs

    /* Copyright (c) 2014 Xiamen HaiHui Software Co., Ltd. All rights reserved
     *
     * Create by huanglc@holworth.com at 2014-12-01 16:19:22
     *
     */
     
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Runtime.Serialization;

    namespace Contract.Domain
    {
        
        ///<summary>
        ///限额配置
        ///</summary>
                 [DataContract(Namespace = "Contract.Domain")]
        public class BasLimitConfig: Framework.Domain.Entity
        {                
                          /// <summary>
                /// 限额条件ID
                /// </summary>
                [DataMember]
                public virtual int? LimitConditionId
                {
                   get;
                   set;
                }
                        
                        /// <summary>
                /// 限额ID
                /// </summary>
                [DataMember]
                public virtual int? LimitTypeId
                {
                   get;
                   set;
                }
                        
                        /// <summary>
                /// 限额名称
                /// </summary>
                [DataMember]
                public virtual string LimitTypeName
                {
                   get;
                   set;
                }                        
                        
                        /// <summary>
                /// 对应维度1ID
                /// </summary>
                [DataMember]
                public virtual int? LimitDim1Id
                {
                   get;
                   set;
                }
                        
                        /// <summary>
                /// 对应维度1值
                /// </summary>
                [DataMember]
                public virtual string LimitDim1Value
                {
                   get;
                   set;
                }                        
                        
                        /// <summary>
                /// 对应维度2ID
                /// </summary>
                [DataMember]
                public virtual int? LimitDim2Id
                {
                   get;
                   set;
                }
                        
                        /// <summary>
                /// 对应维度2值
                /// </summary>
                [DataMember]
                public virtual string LimitDim2Value
                {
                   get;
                   set;
                }                        
                        
                        /// <summary>
                /// 对应维度3ID
                /// </summary>
                [DataMember]
                public virtual int? LimitDim3Id
                {
                   get;
                   set;
                }
                        
                        /// <summary>
                /// 对应维度3值
                /// </summary>
                [DataMember]
                public virtual string LimitDim3Value
                {
                   get;
                   set;
                }                        
                        
                        /// <summary>
                /// 对应维度4ID
                /// </summary>
                [DataMember]
                public virtual int? LimitDim4Id
                {
                   get;
                   set;
                }
                        
                        /// <summary>
                /// 对应维度4值
                /// </summary>
                [DataMember]
                public virtual string LimitDim4Value
                {
                   get;
                   set;
                }                        
                        
                        /// <summary>
                /// 对应维度5ID
                /// </summary>
                [DataMember]
                public virtual int? LimitDim5Id
                {
                   get;
                   set;
                }
                        
                        /// <summary>
                /// 对应维度5值
                /// </summary>
                [DataMember]
                public virtual string LimitDim5Value
                {
                   get;
                   set;
                }                        
                        
                        /// <summary>
                /// 对应维度6ID
                /// </summary>
                [DataMember]
                public virtual int? LimitDim6Id
                {
                   get;
                   set;
                }
                        
                        /// <summary>
                /// 对应维度6值
                /// </summary>
                [DataMember]
                public virtual string LimitDim6Value
                {
                   get;
                   set;
                }                        
                        
                        /// <summary>
                /// 对应维度7ID
                /// </summary>
                [DataMember]
                public virtual int? LimitDim7Id
                {
                   get;
                   set;
                }
                        
                        /// <summary>
                /// 对应维度7值
                /// </summary>
                [DataMember]
                public virtual string LimitDim7Value
                {
                   get;
                   set;
                }                        
                        
                        /// <summary>
                /// 下限值
                /// </summary>
                [DataMember]
                public virtual Decimal? LowerLimitValue
                {
                   get;
                   set;
                }                        
                        
                        /// <summary>
                /// 黄线值
                /// </summary>
                [DataMember]
                public virtual Decimal? YellowLimitValue
                {
                   get;
                   set;
                }                        
                        
                        /// <summary>
                /// 红线值
                /// </summary>
                [DataMember]
                public virtual Decimal? RedLimitValue
                {
                   get;
                   set;
                }                        
                        
                        /// <summary>
                /// 上限值
                /// </summary>
                [DataMember]
                public virtual Decimal? UpperLimitValue
                {
                   get;
                   set;
                }
                /// <summary>
                /// 实际额度
                /// </summary>
                [DataMember]
                public virtual Decimal? ActualIsAmount
                {
                    get;
                    set;
                }
                /// <summary>
                /// 部门额度
                /// </summary>
                [DataMember]
                public virtual Decimal? PartIsAmount
                {
                    get;
                    set;
                }

            [DataMember]
            public virtual string LimitBundleName
            {

                get; set;
            }


        }
        
    }

    BasLimitToConfigureManage.aspx

    <%-- builed by manage.aspx.cmt  [ver:2014.19.01] at 2014-12-01 16:19:20 --%>

    <%@ Page Language="C#" AutoEventWireup="True" CodeBehind="BasLimitToConfigureManage.aspx.cs"
        Inherits="HraWeb.BasLimitToConfigureManage" %>

    <%@ 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>
         <style>
        .left
        {
            20%;
             float:left;
             overflow:auto;
               display:inline;
          
        }
       .Mid
        {
            20%;
             float:left;
             overflow:auto;
               display:inline;
         
        }
        
        .right
        {
              60%;
             float:left;
             overflow-x:hidden;
             display:inline;
             
        }
        </style>

    </head>
    <body>
        <form id="form1" runat="server">
        <div id="toolbar" class="datagrid-toolbar">
            <span class="title">限额类型名称:</span>
             <input type="text" id="txt_LimitTypeName_LK_" name="txt_LimitTypeName_LK_"
                class="input datacontrol" style=" 100px" />
                     <span class="title">限额绑定名称:</span>
             <input type="text" id="Text1" name="txt_LimitBundleName_LK_"
                class="input datacontrol" style=" 100px" />
                <a href="#" id="btn_edit"  iconcls="icon-edit" class="button">编辑</a>
                <a href="#" id="btn_search" iconcls="icon-search" class="button">查询</a>
                <a href="#" id="btn_warrant" iconcls="icon-warrant" class="button">授权</a>
                <a href="#" id="btn_Rereferesh" iconcls="icon-mini-refresh" class="button">刷新</a>
                <a href="#" id="btn_Update" iconcls="icon-edit" class="button">批量</a>
                        
        </div>
        <div style="100%">
                <div class='left'>
                   <ul id="tt1" class="easyui-tree"></ul>
                </div>
                 <div class='Mid'>
                   <ul id="tt2" class="easyui-tree"></ul>
                </div>
         <div class='jdataGrid  right'>
            <asp:JQGrid runat="server" ID="jq" MultiSelect="True" AutoWidth="true" Height="400" DataUrl="/BAS/BasLimitToConfigureManage.aspx?_method=search">
                <Columns>
                      <asp:JQGridColumn DataField="LimitBundleName" Visible="true" HeaderText="限额绑定名称">
                    </asp:JQGridColumn>
                    <asp:JQGridColumn DataField="LimitTypeName" Visible="False" Frozen="True"  HeaderText="限额名称">
                    </asp:JQGridColumn>
                    <asp:JQGridColumn DataField="LimitDim1Id" Visible="False" Frozen="True" Width="100" HeaderText="对应维度1ID">
                    </asp:JQGridColumn>
                    <asp:JQGridColumn DataField="LimitDim1Value" Visible="true" Frozen="True" Width="280" HeaderText="对应维度1值">
                    </asp:JQGridColumn>
                    <asp:JQGridColumn DataField="LimitDim2Id" Visible="False" Width="120" HeaderText="对应维度2ID">
                    </asp:JQGridColumn>
                    <asp:JQGridColumn DataField="LimitDim2Value" Visible="true" Width="260" HeaderText="对应维度2值">
                    </asp:JQGridColumn>
                    <asp:JQGridColumn DataField="UpperLimitValue" Visible="true" HeaderText="上限值">
                    </asp:JQGridColumn>
                    <asp:JQGridColumn DataField="LowerLimitValue" Visible="true" HeaderText="下限值">
                    </asp:JQGridColumn>
                    <asp:JQGridColumn DataField="YellowLimitValue" Visible="true" HeaderText="黄线值">
                    </asp:JQGridColumn>
                    <asp:JQGridColumn DataField="RedLimitValue" Visible="true" HeaderText="红线值">
                    </asp:JQGridColumn>
                    
                    <asp:JQGridColumn DataField="PartIsAmount" Visible="true" HeaderText="节点限额">
                    </asp:JQGridColumn>
                        <asp:JQGridColumn DataField="ActualIsAmount" Visible="true" HeaderText="实际额度">
                    </asp:JQGridColumn>
         
                  
                    
                    <asp:JQGridColumn DataField="Id" Visible="false" PrimaryKey="true">
                    </asp:JQGridColumn>
                </Columns>
                <ClientSideEvents LoadComplete="JDataGrid.loadComplete" RowDoubleClick="JDataGrid.rowDoubleClick" />
            </asp:JQGrid>
            <input type="hidden" class="input datacontrol" id="txt_LimitDim1Id_" name="txt_LimitDim1Id_"/>
             <input type="hidden" class="input datacontrol" id="txt_LimitDim2Id_" name="txt_LimitDim2Id_"/>
        </div>
        </div>
        </form>
        <script type="text/javascript">
            var parentId1 = "";
            var parentId2 = "";
            var parentControl1 = null;
            var parentControl2 = null;
            function PageOnLoad() {
                $(".left").height($("body").height - 100);
                $(".Mid").height($("body").height - 100);
                LoadTree1(true);
                LoadTree2(true);
                $("#btn_Update").click(function () {
                    //这个是单选
                    //var rowid = $("#jq").jqGrid('getGridParam', 'selrow');
                    //这个是manage页面列表的多选现在列出供以后参考
                    var rowids = $("#jq").jqGrid('getGridParam', 'selarrrow');

                    var rowidList = new Array();
                    for (var i = 0; i < rowids.length; i++) {
                        rowidList.push(rowids[i]);
                    }
                    if (rowidList.length > 0) {
                        rowidList = JSON.stringify(rowidList);
                    }
                    else {
                        rowidList = "";
                    }

                    JDataGrid.Add("/BAS/BatchLimitWindowEdit.aspx?_method=BatchSetLimit&RowidList=" + rowidList, 600, 270, "限额批量窗口");

                });
                $("#btn_Rereferesh").click(function () {

                    $("#btn_search").click();

                });
                $("#btn_warrant").click(function () {

                    var url = "/BAS/BasLimitBusinessGrantProductManage.aspx";
                    JDataGrid.Edit(null, url, 600, 500, "业务产品权限设置");

                });
                //控件按钮设置
                $(".button").linkbutton({ plain: true });
                //参数说明:控件Id,查询地址,编辑页面的宽度,高度,编辑页面标题,新增按钮,编辑按钮,删除按钮,查询按钮,查询回调函数
                JDataGrid.InitGrid("jq", "/BAS/BasLimitToConfigureEdit.aspx", 600, 400, "限额管理", $("#btn_add"), $("#btn_edit"), $("#btn_del"), $("#btn_search"));

            }
            function LoadTree1(isLoadGrid) {
                DataGrid.WaitMessage();
                $("#tt1").tree(
                  { url: '/BAS/BasLimitBusiStrucManage.aspx?_method=LoadTree&_id=0&a=' + Math.random(),
                      method: 'get',
                      animate: true,
                      formatter: function (node) {
                          var s = node.text;
                          if (node.children) {
                              s += "&nbsp;<span style='color:blue'>(" + node.children.length + ")</span>";
                          }
                          return s;
                      },
                      onBeforeExpand: function (node, param) {
                          var url = "/BAS/BasLimitBusiStrucManage.aspx?_method=loadChild&child=" + node.id;
                          $('#tt1').tree('options').url = url;
                      },
                      onClick: function (node) {

                          // $("#txt_LimitDim2Id_").val("");
                          parentId1 = node.id;
                          $("#txt_LimitDim1Id_").val(parentId1);
                          //  $("#jq").jqGrid("setGridParam", { postData: { txt_Name_LK_: $("#txt_Name_LK_").val(), "BaslimitBusinessStruPId": node.id} }).trigger("reloadGrid");

                          $("#btn_search").click();



                      },
                      onLoadSuccess: function (node, data) {
                          DataGrid.RemoveWaitMessage();
                      }
                  }
              );
                //   off_id = $("#tt").selectNode.txt_OfficeId_;

            }
            function LoadTree2(isLoadGrid) {
                DataGrid.WaitMessage();
                $("#tt2").tree(
                  { url: '/BAS/BasLimitProStrucManage.aspx?_method=LoadTree&_id=0&a=' + Math.random(),
                      method: 'get',
                      animate: true,
                      formatter: function (node) {
                          var s = node.text;
                          if (node.children) {
                              s += "&nbsp;<span style='color:blue'>(" + node.children.length + ")</span>";
                          }
                          return s;
                      },
                      onBeforeExpand: function (node, param) {
                          var url = "/BAS/BasLimitProStrucManage.aspx?_method=loadChild&child=" + node.id;
                          $('#tt2').tree('options').url = url;
                      },
                      onClick: function (node) {


                          parentId2 = node.id;
                          //$("#txt_LimitDim2Id_").val(parentId2);
                          $("#jq").jqGrid("setGridParam", { postData: { txt_Name_LK_: $("#txt_Name_LK_").val(), "BaslimitproStruPId": node.id} }).trigger("reloadGrid");
                          $("#btn_search").click();


                      },
                      onLoadSuccess: function (node, data) {

                          DataGrid.RemoveWaitMessage();
                      }
                  }
              );


            }

            function Refresh() {
                $("#btn_search").click();
            }

            function RelaodTree1(data) {
                LoadTree1(true);
            }
            function RelaodTree2(data) {
                LoadTree2(true);
            }

        </script>
    </body>
    </html>
    BasLimitToConfigureManage.aspx.cs

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using DevExpress.Data.PLinq.Helpers;
    using Framework;
    using HraWeb.Common;
    using Utility;
    using WebApp.Common;
    using Contract.Domain;
    using System.Collections;

    namespace HraWeb
    {
        public partial class BasLimitToConfigureManage : JQEntityManage<Contract.Domain.BasLimitConfig>
        {

            protected override void Page_Load(object sender, EventArgs e)
            {
               

                //给基类服务接口复制,可不付
                //base.svc = Psvc;
                if (!IsPostBack)
                {

                }
              
                base.Page_Load(sender, e);
            }



            /// <summary>
            /// 设置查询条件或者语句
            /// </summary>
            /// <returns></returns>
            protected override Framework.QueryInfo SetInfo()
            {
                InitSearchCache();
                info = base.SetInfo();
                if (!string.IsNullOrEmpty(Request["BaslimitproStruPId"]))
                {
                    
                    string LimitDim2Id = Request["BaslimitproStruPId"];
                    List<string> LimitDim2IdList = GetAllProChildIds(LimitDim2Id);
                    LimitDim2IdList.Add(LimitDim2Id);
                    string[] LimitDim2Ids = LimitDim2IdList.ToArray();

                    info.AddParam("LimitDim2Ids", LimitDim2Ids, " and LimitDim2Id in (:LimitDim2Ids)");

                }
                return info;
            }

            private void InitSearchCache()
            {
                SpringCache.Remove("GetBasLimitProStrucs");
                List<BasLimitProStruc> list1 = SpringCache.Get("GetBasLimitProStrucs") as List<BasLimitProStruc>;

                if (list1 == null || list1.Count <= 0)
                {
                    IList list2 = Dao.FindList(new QueryInfo("BasLimitProStruc"));

                    List<BasLimitProStruc> list3 = new List<BasLimitProStruc>();
                    foreach (var b in list2)
                    {

                        list3.Add(b as BasLimitProStruc);
                    }

                    SpringCache.Insert("GetBasLimitProStrucs", list3);


                }
                SpringCache.Remove("GetBasLimitConfigs");
                List<BasLimitConfig> list11 = SpringCache.Get("GetBasLimitConfigs") as List<BasLimitConfig>;

                if (list11 == null || list11.Count <= 0)
                {
                    IList list12 = Dao.FindList(new QueryInfo("BasLimitConfig"));

                    List<BasLimitConfig> list3 = new List<BasLimitConfig>();
                    foreach (var b in list12)
                    {

                        list3.Add(b as BasLimitConfig);
                    }

                    SpringCache.Insert("GetBasLimitConfigs", list3);


                }
                SpringCache.Remove("BasLimitBusiStrucs");
                List<BasLimitBusiStruc> childList = SpringCache.Get("BasLimitBusiStrucs") as List<BasLimitBusiStruc>;
                if (childList == null || childList.Count <= 0)
                {
                    IList list12 = Dao.FindList(new QueryInfo("BasLimitBusiStruc"));

                    List<BasLimitBusiStruc> list3 = new List<BasLimitBusiStruc>();
                    foreach (var b in list12)
                    {

                        list3.Add(b as BasLimitBusiStruc);
                    }

                    SpringCache.Insert("BasLimitBusiStrucs", list3);


                }
            }

            private List<string> GetAllProChildIds(string parentID)
            {
                List<string> ids = new List<string>();
         
                List<BasLimitProStruc> list1 = SpringCache.Get("GetBasLimitProStrucs") as List<BasLimitProStruc>;

                List<BasLimitProStruc> prosFuncList=new List<BasLimitProStruc>();
                prosFuncList = list1;
                prosFuncList = (from s in prosFuncList where s.ParentId.ToString() == parentID select s).ToList();

                //QueryInfo info = new QueryInfo("BasLimitProStruc b");
                //info.AddParam("ParentId", parentID, " and (b.ParentId=:ParentId )");

                 //prosList = Dao.FindList(info);
                foreach (BasLimitProStruc b1 in prosFuncList)
                {
                    //BasLimitProStruc b1 = b as BasLimitProStruc;
                    ids.Add(b1.Id);
                    if (ParentHasChild(b1.Id))
                    {

                        ids.AddRange(GetAllProChildIds(b1.Id));
                    }

                }






                return ids;




            }
            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;
                }
            }
            private bool ParentHasChild(string id)
            {
           
                List<BasLimitProStruc> list1 = SpringCache.Get("GetBasLimitProStrucs") as List<BasLimitProStruc>;
                list1 = (from s in list1 where s.ParentId.ToString() == id select s).ToList();
                if (list1.Count > 0)
                    return true;
                return false;

            }

            /// <summary>
            /// 初始化页面控件
            /// </summary>
            protected override void InitPage()
            {
                base.InitPage();

                // BindDrop(drp_Unit, "SPSW", true);
            }
            public static List<int?> list1 = new List<int?>();
            public static List<int?> list2 = new List<int?>();
            public static List<int?> list3 = new List<int?>();
            public static List<int?> list4 = new List<int?>();
            public override void ChangeList(QueryInfo infoList)
            {


                
                
                    List<PorductUpperLimit> dic = new List<PorductUpperLimit>();

                    List<BasLimitConfig> funcBasLimitConfigList = new List<BasLimitConfig>();
                    list1.Clear();
                    list2.Clear();
                    foreach (var b in infoList.List)
                    {
                        BasLimitConfig b1 = b as BasLimitConfig;
                        list1.Add(b1.LimitDim1Id);
                        list2.Add(b1.LimitDim2Id);
                        funcBasLimitConfigList.Add(b as BasLimitConfig);

                    }
                   

                    // 1.算出每个交易员对应货币的实际额度
                    foreach (BasLimitConfig b in funcBasLimitConfigList)
                    {
                        if (IsTrader(b.LimitDim1Id) && IsMoney(Convert.ToString(b.LimitDim2Id)))
                        {

                            dic.Add(new PorductUpperLimit() { TraderId = b.LimitDim1Id, TraderName = b.LimitDim1Value, ProductId = b.LimitDim2Id, ProductName = b.LimitDim2Value, UpperLimitValue = b.UpperLimitValue });
                            b.ActualIsAmount = b.UpperLimitValue;
                            b.PartIsAmount = b.UpperLimitValue;
                        }
                        else
                        {

                            b.ActualIsAmount = NextnodeAmount(b);
                            b.PartIsAmount = NextnodePartAmount(b);

                        }
                        if (b.ActualIsAmount <= 0&&b.PartIsAmount>0)
                        {
                            b.ActualIsAmount = b.PartIsAmount;
                        }

                    }
                
               


            }

            private decimal? NextnodePartAmount(BasLimitConfig b)
            {
                decimal? d = 0;
                string childServiceId = "";
                string childProductId = "";
                int? id1 = b.LimitDim1Id;
                int? id2 = b.LimitDim2Id;
                try
                {

                    string strId1s = GetchildServiceId(id1);
                    if (strId1s.Contains(','))
                        strId1s = strId1s.Substring(0, strId1s.Length - 1);
                    string strId2s = GetchildProductId(id2);
                    if (strId2s.Contains(','))
                        strId2s = strId2s.Substring(0, strId2s.Length - 1);

                    List<string> strid1Arr = strId1s.Split(',').ToList();
                    List<string> strid2Arr = strId2s.Split(',').ToList();

                    for (int i = 0; i < strid1Arr.Count; i++)
                    {
                        for (int j = 0; j < strid2Arr.Count; j++)
                        {
                            List<BasLimitConfig> BasLimitConfigs = SpringCache.Get("GetBasLimitConfigs") as List<BasLimitConfig>;
                            string i1 = strid1Arr[i];
                            string i2 = strid2Arr[j];
                            //if (list1.Contains(int.Parse(i1)) && list2.Contains(int.Parse(i2)))
                            {
                                BasLimitConfigs = (from s in BasLimitConfigs
                                                   where s.LimitDim1Id.ToString() == i1.ToString() && s.LimitDim2Id.ToString() == i2.ToString()
                                                   select s).ToList();
                                if (BasLimitConfigs != null && BasLimitConfigs.Count > 0)
                                {
                                    BasLimitConfig b1 = BasLimitConfigs[0];
                                    //QueryInfo info = new QueryInfo("BasLimitConfig");
                                    //info.AddParam("LimitDim1Id", i1, " and LimitDim1Id=:LimitDim1Id");
                                    //info.AddParam("LimitDim2Id", i2, " and LimitDim2Id=:LimitDim2Id");
                                    //BasLimitConfig b1 = Dao.FindOne(info) as BasLimitConfig;
                                    if (b1 != null)
                                    {
                                        d += b1.UpperLimitValue;

                                    }
                                }


                            }

                        }

                    }
                }
                catch (Exception ex)
                {

                    JSUtil.log(ex.ToString());
                }

                return d;
            }

       


            private decimal? NextnodeAmount(BasLimitConfig b)
            {
                decimal? d = 0;
                int? id1 = b.LimitDim1Id;
                int? id2 = b.LimitDim2Id;

                try
                {

                    string strId1s = GetAllTraderId(id1);
                    if (strId1s.Contains(','))
                        strId1s = strId1s.Substring(0, strId1s.Length - 1);
                    string strId2s = GetAllProductId(id2);
                    if (strId2s.Contains(','))
                        strId2s = strId2s.Substring(0, strId2s.Length - 1);

                    List<string> strid1Arr = strId1s.Split(',').ToList();
                    List<string> strid2Arr = strId2s.Split(',').ToList();
                 
                    for (int i = 0; i < strid1Arr.Count; i++)
                    {
                        for (int j = 0; j < strid2Arr.Count; j++)
                        {
                            List<BasLimitConfig> BasLimitConfigs = SpringCache.Get("GetBasLimitConfigs") as List<BasLimitConfig>;
                            string i1 = strid1Arr[i];
                            string i2 = strid2Arr[j];
                            //if (list1.Contains(int.Parse(i1)) && list2.Contains(int.Parse(i2)))
                            {
                                BasLimitConfigs = (from s in BasLimitConfigs
                                    where s.LimitDim1Id.ToString() == i1.ToString() && s.LimitDim2Id.ToString() == i2.ToString()
                                    select s).ToList();
                                if (BasLimitConfigs != null && BasLimitConfigs.Count > 0)
                                {
                                      BasLimitConfig b1 = BasLimitConfigs[0];

                                    if (b1 != null)
                                    {
                                        d += b1.UpperLimitValue;

                                    }
                              }
                               

                            }

                        }

                    }
                }
                catch (Exception ex)
                {

                    JSUtil.log(ex);
                }



                return d;




            }
    //why
            private string GetchildProductId(int? id2)
            {
                string PNameList = string.Empty;
                List<BasLimitProStruc> childList = SpringCache.Get("GetBasLimitProStrucs") as List<BasLimitProStruc>;
                childList = (from s in childList where s.ParentId.ToString() == id2.ToString() select s).ToList();
                for (int i = 0; i < childList.Count; i++)
                {
                    PNameList +=(int.Parse(childList[i].Id)) + ",";
                }

                return PNameList;
            }

            private string GetchildServiceId(int? id2)
            {
                string PNameList = string.Empty;
                List<BasLimitBusiStruc> childList = SpringCache.Get("BasLimitBusiStrucs") as List<BasLimitBusiStruc>;
                childList = (from s in childList where s.ParentId.ToString() == id2.ToString() select s).ToList();
                for (int i = 0; i < childList.Count; i++)
                {
                    PNameList +=(int.Parse(childList[i].Id)) + ",";
                }
                return PNameList;
            }
            private string GetAllProductId(int? id2)
            {
                string PNameList = string.Empty;
                if (IsMoney(id2.ToString()))
                {
                    list4.Add(id2);
                    return id2.ToString();
                }
                List<BasLimitProStruc> childList2 = SpringCache.Get("GetBasLimitProStrucs") as List<BasLimitProStruc>;
                childList2 = (from s in childList2 where s.ParentId.ToString() == id2.ToString() select s).ToList();

                //QueryInfo info = new QueryInfo("BasLimitProStruc");
                //info.AddParam("ParentId", id2, " and ParentId=:ParentId");

                //IList childList = Dao.FindByQueryInfo(info).List;


                for (int i = 0; i < childList2.Count; i++)
                {
                    //BasLimitProStruc basLimitPro = childList[i] as BasLimitProStruc;
                    PNameList += GetAllProductId(int.Parse(childList2[i].Id)) + ",";
                }


                return PNameList;
            }

            private string GetAllTraderId(int? id1)
            {
                string PNameList = string.Empty;
                if (IsTrader(id1))
                {

                    list3.Add(id1);

                    return id1.ToString();
                }
                //
                List<BasLimitBusiStruc> childList = SpringCache.Get("BasLimitBusiStrucs") as List<BasLimitBusiStruc>;
                childList = (from s in childList where s.ParentId.ToString() == id1.ToString() select s).ToList();

                //
                //QueryInfo info = new QueryInfo("BasLimitBusiStruc");
                //info.AddParam("ParentId", id1, " and ParentId=:ParentId");
                //IList childList = Dao.FindByQueryInfo(info).List;
                if (childList != null && childList.Count > 0)
                {
                    for (int i = 0; i < childList.Count; i++)
                    {
                        //BasLimitBusiStruc child = childList[i] as BasLimitBusiStruc;

                        PNameList += GetAllTraderId(int.Parse(childList[i].Id)) + ",";
                    }
                }
                





                return PNameList;



            }


            private bool IsMoney(string limitDim2Id)
            {

                List<BasLimitProStruc> list = SpringCache.Get("GetBasLimitProStrucs") as List<BasLimitProStruc>;
                list = (from s in list where s.Id.ToString() == limitDim2Id.ToString() && s.ProLevel == 4 select s).ToList();

                //QueryInfo MoneyInfo = new QueryInfo("BasLimitProStruc");

                //MoneyInfo.Where.Add("where", " and Id=:limitDim2Id and ProLevel=4");
                //MoneyInfo.Parameters.Add("limitDim2Id", limitDim2Id);
                //IList list = Dao.FindByQueryInfo(MoneyInfo).List;

                if (list.Count > 0)
                {
                    return true;
                }
                return false;
            }

            private bool IsTrader(decimal? limitDim1Id)
            {
                List<BasLimitBusiStruc> list = SpringCache.Get("BasLimitBusiStrucs") as List<BasLimitBusiStruc>;
                list = (from s in list where s.Id == limitDim1Id.ToString() && s.IsTrader == 1 select s).ToList();

                //QueryInfo TraderInfo = new QueryInfo("BasLimitBusiStruc");

                //TraderInfo.Where.Add("where", " and Id=:limitDim1Id and IsTrader=1");
                //TraderInfo.Parameters.Add("limitDim1Id", limitDim1Id);
                //IList list = Dao.FindByQueryInfo(TraderInfo).List;

                if (list.Count > 0)
                {
                    return true;
                }
                return false;
            }


        }

        internal class PorductUpperLimit
        {
            public int? TraderId { get; set; }
            public string TraderName { get; set; }
            public int? ProductId { get; set; }
            public string ProductName { get; set; }
            public decimal? UpperLimitValue { get; set; }

        }
    }

    BasLimitToConfigureManage.aspx.designer.cs.

    //------------------------------------------------------------------------------
    // <自动生成>
    //     此代码由工具生成。
    //
    //     对此文件的更改可能会导致不正确的行为,并且如果
    //     重新生成代码,这些更改将会丢失。
    // </自动生成>
    //------------------------------------------------------------------------------

    namespace HraWeb {
        
        
        public partial class BasLimitToConfigureManage {
            
            /// <summary>
            /// Head1 控件。
            /// </summary>
            /// <remarks>
            /// 自动生成的字段。
            /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
            /// </remarks>
            protected global::System.Web.UI.HtmlControls.HtmlHead Head1;
            
            /// <summary>
            /// form1 控件。
            /// </summary>
            /// <remarks>
            /// 自动生成的字段。
            /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
            /// </remarks>
            protected global::System.Web.UI.HtmlControls.HtmlForm form1;
            
            /// <summary>
            /// jq 控件。
            /// </summary>
            /// <remarks>
            /// 自动生成的字段。
            /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
            /// </remarks>
            protected global::Trirand.Web.UI.WebControls.JQGrid jq;
        }
    }

  • 相关阅读:
    第二十章 用户管理(一)
    第十九章 Linux中常用字符的特殊含义
    每日日报
    每日日报
    每日日报
    每日日报
    每日日报
    每日日报
    每日日报
    每日日报
  • 原文地址:https://www.cnblogs.com/kexb/p/4540367.html
Copyright © 2020-2023  润新知