Beispiel #1
0
        public void SelectJson(int subId)
        {
            int pageIndex = 1, pageSize = 100;
            string orderStr = string.Empty, whereStr = string.Empty;

            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            NFMT.Common.SelectModel select = new NFMT.Common.SelectModel();
            NFMT.DoPrice.BLL.InterestBLL bll = new NFMT.DoPrice.BLL.InterestBLL();

            select = bll.GetInterestStocksSelect(pageIndex, pageSize, orderStr, subId);

            NFMT.Common.ResultModel result = bll.Load(user, select, NFMT.Common.DefaultValue.ClearAuth);
            System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;

            //新增差额行
            System.Data.DataRow dr = dt.NewRow();
            dt.Rows.Add(dr);
            dr["StockLogId"] = 0;
            dr["StockId"] = 0;
            dr["RefNo"] = "本金余额";
            dr["LogDate"] = DateTime.Now;
            dr["AssetId"] = 0;
            dr["AssetName"] = "--";
            dr["CardNo"] = "--";
            dr["BrandId"] = 0;
            dr["BrandName"] = "--";
            dr["DeliverPlaceId"] = 0;
            dr["DPName"] = "--";
            dr["MUId"] = 0;
            dr["MUName"] = "--";
            dr["NetAmount"] = 0;
            dr["InterestAmount"] = 0;
            dr["LastAmount"] = 0;
            dr["StockBala"] = 0;
            dr["InterestStartDate"] = DateTime.Now;
            dr["InterestEndDate"] = DateTime.Now;
            dr["InterestDay"] = 0;
            dr["InterestUnit"] = 0;
            dr["InterestBala"] = 0;
            dr["InterestType"] = (int)NFMT.DoPrice.InterestTypeEnum.差额计息;

            this.SelectedJson = Newtonsoft.Json.JsonConvert.SerializeObject(dt, new Newtonsoft.Json.Converters.DataTableConverter());
        }
        public void ProcessRequest(HttpContext context)
        {
            int pageIndex = 1, pageSize = 10;
            string orderStr = string.Empty, whereStr = string.Empty;

            DateTime fromDate = NFMT.Common.DefaultValue.DefaultTime;
            DateTime toDate = NFMT.Common.DefaultValue.DefaultTime;
            int status = 0;

            if (!string.IsNullOrEmpty(context.Request["s"]))
                int.TryParse(context.Request["s"], out status);
            if (!string.IsNullOrEmpty(context.Request.QueryString["fd"]))
            {
                if (!DateTime.TryParse(context.Request.QueryString["fd"], out fromDate))
                    fromDate = NFMT.Common.DefaultValue.DefaultTime;
            }
            if (!string.IsNullOrEmpty(context.Request.QueryString["td"]))
            {
                if (!DateTime.TryParse(context.Request.QueryString["td"], out toDate))
                    toDate = NFMT.Common.DefaultValue.DefaultTime;
                else
                    toDate.AddDays(1);
            }

            int inCorpId = 0;
            int outCorpId = 0;
            if (string.IsNullOrEmpty(context.Request.QueryString["ic"]) || !int.TryParse(context.Request.QueryString["ic"].Trim(), out inCorpId))
            {
                inCorpId = 0;
            }

            if (string.IsNullOrEmpty(context.Request.QueryString["oc"]) || !int.TryParse(context.Request.QueryString["oc"].Trim(), out outCorpId))
            {
                outCorpId = 0;
            }

            if (!string.IsNullOrEmpty(context.Request.QueryString["pagenum"]))
                int.TryParse(context.Request.QueryString["pagenum"], out pageIndex);
            pageIndex++;
            if (!string.IsNullOrEmpty(context.Request.QueryString["pagesize"]))
                int.TryParse(context.Request.QueryString["pagesize"], out pageSize);

            if (!string.IsNullOrEmpty(context.Request.QueryString["sortdatafield"]) && !string.IsNullOrEmpty(context.Request.QueryString["sortorder"]))
            {
                string sortDataField = context.Request.QueryString["sortdatafield"].Trim();
                string sortOrder = context.Request.QueryString["sortorder"].Trim();

                switch (sortDataField)
                {

                    case "CurrencyName":
                        sortDataField = "cur.CurrencyName ";
                        break;
                    case "OutCorpName":
                        sortDataField = "outCorp.CorpName";
                        break;
                    case "InCorpName":
                        sortDataField = "inCorp.CorpName";
                        break;
                    case "StatusName":
                        sortDataField = "it.InterestStatus";
                        break;
                    case "TradeDirection":
                        sortDataField = "con.TradeDirection";
                        break;
                }
                orderStr = string.Format("{0} {1}", sortDataField, sortOrder);
            }

            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            NFMT.DoPrice.BLL.InterestBLL bll = new NFMT.DoPrice.BLL.InterestBLL();
            NFMT.Common.SelectModel select = bll.GetInterestsSelect(pageIndex, pageSize, orderStr, fromDate, toDate, status, inCorpId, outCorpId);
            NFMT.Common.ResultModel result = bll.Load(user, select);

            context.Response.ContentType = "text/plain";
            if (result.ResultStatus != 0)
            {
                context.Response.Write(result.Message);
                context.Response.End();
            }

            int totalRows = result.AffectCount;
            System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;

            Dictionary<string, object> dic = new Dictionary<string, object>();
            dic.Add("count", totalRows);
            dic.Add("data", dt);

            string postData = Newtonsoft.Json.JsonConvert.SerializeObject(dic, new Newtonsoft.Json.Converters.DataTableConverter());

            context.Response.Write(postData);
        }
        public void ProcessRequest(HttpContext context)
        {
            int pageIndex = 1, pageSize = 10;
            string orderStr = string.Empty, whereStr = string.Empty;

            string subNo = context.Request.QueryString["sn"];

            if (!string.IsNullOrEmpty(context.Request.QueryString["pagenum"]))
                int.TryParse(context.Request.QueryString["pagenum"], out pageIndex);
            pageIndex++;
            if (!string.IsNullOrEmpty(context.Request.QueryString["pagesize"]))
                int.TryParse(context.Request.QueryString["pagesize"], out pageSize);

            if (!string.IsNullOrEmpty(context.Request.QueryString["sortdatafield"]) && !string.IsNullOrEmpty(context.Request.QueryString["sortorder"]))
            {
                string sortDataField = context.Request.QueryString["sortdatafield"].Trim();
                string sortOrder = context.Request.QueryString["sortorder"].Trim();

                switch (sortDataField)
                {
                    case "ContractDate":
                        sortDataField = string.Format("cs.{0}", sortDataField);
                        break;
                    case "ContractNo":
                        sortDataField = string.Format("con.{0}", sortDataField);
                        break;
                    case "SubId":
                        sortDataField = "cs.SubId";
                        break;
                    case "TradeDirectionName":
                        sortDataField = "con.TradeDirection";
                        break;
                    case "InCorpName":
                        sortDataField = "inccd.CorpName";
                        break;
                    case "OutCorpName":
                        sortDataField = "outccd.CorpName";
                        break;
                    case "AssetName":
                        sortDataField = "a.AssetName";
                        break;
                    case "SignWeight":
                        sortDataField = "cs.SignAmount";
                        break;
                }
                orderStr = string.Format("{0} {1}", sortDataField, sortOrder);
            }

            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            NFMT.DoPrice.BLL.InterestBLL bll = new NFMT.DoPrice.BLL.InterestBLL();
            NFMT.Common.SelectModel select = bll.GetPledgeContractListSelect(pageIndex, pageSize, orderStr, subNo);
            NFMT.Common.ResultModel result = bll.Load(user, select);

            context.Response.ContentType = "text/plain";
            if (result.ResultStatus != 0)
            {
                context.Response.Write(result.Message);
                context.Response.End();
            }

            int totalRows = result.AffectCount;
            System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;

            Dictionary<string, object> dic = new Dictionary<string, object>();
            dic.Add("count", totalRows);
            dic.Add("data", dt);

            string postData = Newtonsoft.Json.JsonConvert.SerializeObject(dic, new Newtonsoft.Json.Converters.DataTableConverter());

            context.Response.Write(postData);
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 120, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.修改 });

                NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
                NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

                string redirectUrl = "InterestList.aspx";
                this.navigation1.Routes.Add("利息结算列表", redirectUrl);
                this.navigation1.Routes.Add("利息结算明细", string.Empty);

                int interestId = 0;
                if (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out interestId) || interestId <= 0)
                    this.Page.WarmAlert("参数错误", redirectUrl);

                //获取当前结息
                NFMT.DoPrice.BLL.InterestBLL interestBLL = new NFMT.DoPrice.BLL.InterestBLL();
                result = interestBLL.Get(user, interestId);
                if (result.ResultStatus != 0)
                    this.WarmAlert(result.Message, redirectUrl);

                NFMT.DoPrice.Model.Interest interest = result.ReturnValue as NFMT.DoPrice.Model.Interest;
                if (interest == null || interest.Id <= 0)
                    this.WarmAlert("利息结算不存在", redirectUrl);

                this.curInterest = interest;

                //获取币种
                NFMT.Data.Model.Currency currency = NFMT.Data.BasicDataProvider.Currencies.FirstOrDefault(temp => temp.CurrencyId == interest.CurrencyId);
                if (currency == null || currency.CurrencyId <= 0)
                    this.WarmAlert("币种不存在", redirectUrl);

                this.curCurrency = currency;

                //获取重量单位
                NFMT.Data.Model.MeasureUnit measureUnit = NFMT.Data.BasicDataProvider.MeasureUnits.FirstOrDefault(temp => temp.MUId == interest.Unit);
                if (measureUnit == null || measureUnit.MUId <= 0)
                    this.WarmAlert("重量单位不存在", redirectUrl);

                this.curMeasureUnit = measureUnit;

                //获取子合约
                NFMT.Contract.BLL.ContractSubBLL subBLL = new NFMT.Contract.BLL.ContractSubBLL();
                result = subBLL.Get(user, interest.SubContractId);
                if (result.ResultStatus != 0)
                    this.WarmAlert("子合约不存在", redirectUrl);
                NFMT.Contract.Model.ContractSub sub = result.ReturnValue as NFMT.Contract.Model.ContractSub;
                if (sub == null || sub.SubId <= 0)
                    this.WarmAlert("子合约不存在", redirectUrl);

                this.curSub = sub;

                //品种
                NFMT.Data.Model.Asset asset = NFMT.Data.BasicDataProvider.Assets.FirstOrDefault(temp => temp.AssetId == sub.AssetId);
                if (asset == null || asset.AssetId <= 0)
                    this.WarmAlert("品种获取失败", redirectUrl);

                this.curAsset = asset;

                NFMT.Contract.TradeDirectionEnum tradeDirection = (NFMT.Contract.TradeDirectionEnum)sub.TradeDirection;
                this.curTradeDirection = tradeDirection;

                NFMT.Contract.BLL.SubCorporationDetailBLL corpBLL = new NFMT.Contract.BLL.SubCorporationDetailBLL();
                //我方公司
                result = corpBLL.Load(user, sub.SubId, true);
                if (result.ResultStatus != 0)
                    this.WarmAlert("我方公司获取失败", redirectUrl);

                List<NFMT.Contract.Model.SubCorporationDetail> inCorps = result.ReturnValue as List<NFMT.Contract.Model.SubCorporationDetail>;
                if (inCorps == null || inCorps.Count == 0)
                    this.WarmAlert("我方公司获取失败", redirectUrl);

                NFMT.Contract.Model.SubCorporationDetail inCorp = inCorps.FirstOrDefault(temp => temp.IsDefaultCorp);
                if (inCorp == null || inCorp.CorpId <= 0)
                    this.WarmAlert("我方公司获取失败", redirectUrl);

                this.curInCorp = inCorp;

                //对方公司
                result = corpBLL.Load(user, sub.SubId, false);
                if (result.ResultStatus != 0)
                    this.WarmAlert("对方公司获取失败", redirectUrl);

                List<NFMT.Contract.Model.SubCorporationDetail> outCorps = result.ReturnValue as List<NFMT.Contract.Model.SubCorporationDetail>;
                if (outCorps == null || outCorps.Count == 0)
                    this.WarmAlert("对方公司获取失败", redirectUrl);

                NFMT.Contract.Model.SubCorporationDetail outCorp = outCorps.FirstOrDefault(temp => temp.IsDefaultCorp);
                if (outCorp == null || outCorp.CorpId <= 0)
                    this.WarmAlert("对方公司获取失败", redirectUrl);

                this.curOutCorp = outCorp;

                //json
                int pageIndex = 1, pageSize = 100;
                string orderStr = string.Empty, whereStr = string.Empty;
                NFMT.Common.SelectModel select = new NFMT.Common.SelectModel();

                select = interestBLL.GetCurDetailsSelect(pageIndex, pageSize, orderStr, sub.SubId, interest.InterestId);
                result = interestBLL.Load(user, select, NFMT.Common.DefaultValue.ClearAuth);
                System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;
                this.curJson = Newtonsoft.Json.JsonConvert.SerializeObject(dt, new Newtonsoft.Json.Converters.DataTableConverter());

                System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                string json = serializer.Serialize(interest);
                this.hidModel.Value = json;
            }
        }