コード例 #1
0
        /// <summary>
        /// 获取选择顾问列表
        /// </summary>
        public string FP10210(string crSN, string sortStr)
        {
            string investorUserSN = session["userSN"].ToString();

            string orderStr = string.Empty;

            string[] sortStrSplit = sortStr.Split(',');
            for (int i = 1; i < (sortStrSplit.Length - 1); i++)
            {
                string[] sortStrSplitSplit = sortStrSplit[i].Split('#');
                if ((i != 1))
                {
                    orderStr += ",";
                }
                orderStr += sortStrSplitSplit[0] == "1" ? " successCaseAmount" : " caseAmount";
                orderStr += sortStrSplitSplit[1] == "A" ? "" : " desc";
            }

            using (DBMA1DataContext dbma1 = new DBMA1DataContext())
            {
                List <SelectConsultantList> consultantList = null;

                string sqlStr = string.Format("select VP509011.consultantUserSN,VP509011.serviceProvince,VP509011.serviceCity,VP509011.caseAmount,VP509011.successCaseAmount,A.qualificationSN from VP509011 left join (select consultantUserSN,qualificationSN from P104 where  investorUserSN = '{0}' and creditRightSN = '{1}') as A on VP509011.consultantUserSN = A.consultantUserSN", investorUserSN, crSN);

                if (orderStr == string.Empty)
                {
                    consultantList = dbma1.ExecuteQuery <SelectConsultantList>(sqlStr).ToList();
                }
                else
                {
                    sqlStr         = string.Format("{0} order by {1}", sqlStr, orderStr);
                    consultantList = dbma1.ExecuteQuery <SelectConsultantList>(sqlStr).ToList();
                }

                //发布费用
                A023    a023 = dbma1.A023s.First();
                decimal?fee  = a023.consultantReserveCost;

                //账户余额
                F000    f000    = dbma1.F000s.Where(c => c.userSN == investorUserSN).First();
                decimal balance = f000.balance;

                return(string.Format("{{\"balance\":\"{0}\",\"fee\":\"{1}\",\"consultantDataList\":{2}}}", balance, fee, C101.FC10107(consultantList)));
            }
        }
コード例 #2
0
        /// <summary>
        /// 获取推荐投资方列表
        /// </summary>
        public string FP20107(string sortStr)
        {
            string userSN = session["userSN"].ToString();
            //string userSN = "U00001";

            string orderStr = string.Empty;

            string[] sortStrSplit = sortStr.Split(',');
            for (int i = 1; i < (sortStrSplit.Length - 1); i++)
            {
                string[] sortStrSplitSplit = sortStrSplit[i].Split('#');
                if ((i != 1))
                {
                    orderStr += ",";
                }
                orderStr += sortStrSplitSplit[0] == "1" ? " minInvestMoneyAmount" : " investCaseAmount";
                orderStr += sortStrSplitSplit[1] == "A" ? "" : " desc";
            }

            using (DBMA1DataContext dbma1 = new DBMA1DataContext())
            {
                List <RecommandInvestModel> recommandInvestDataList = null;

                if (orderStr == string.Empty)
                {
                    recommandInvestDataList = dbma1.ExecuteQuery <RecommandInvestModel>("select * from VP106011").ToList();
                }
                else
                {
                    string sqlStr = string.Format(@"select * from VP106011 order by {0}", orderStr);
                    recommandInvestDataList = dbma1.ExecuteQuery <RecommandInvestModel>(sqlStr).ToList();
                }

                string recommandInvestDataListStr = C101.FC10107(recommandInvestDataList);

                //账户余额
                F000    f000    = dbma1.F000s.Where(c => c.userSN == userSN).First();
                decimal balance = f000.balance;


                return(string.Format("{{\"recommandInvestDataList\":{0},\"balance\":\"{1}\"}}", recommandInvestDataListStr, balance));
            }
        }
コード例 #3
0
ファイル: CP101.cs プロジェクト: waterStone528/job
        //搜索,返回全部数据
        private IEnumerable <VP101001> Search(DBMA1DataContext dbma1, string keyword, string provinceSN, string citySN, string capitalPurposeSN, string paymentTypeSN, string guaranteeTypeSN, string financingMain, string sortStr)
        {
            List <string> sortList = new List <string>();

            sortList.Add("loanDays");
            sortList.Add("financingAmount");
            sortList.Add("dailyRate");
            sortList.Add("mortgageRate");

            string sqlLinkStr  = "where";
            string sqlWhereStr = "";

            if (keyword != "")
            {
                sqlWhereStr += string.Format(" {0} creditRightSN like N'%{1}%'", sqlLinkStr, keyword);
                sqlLinkStr   = "and";
            }

            if (provinceSN != "区域-省" && provinceSN != "-1")
            {
                sqlWhereStr += string.Format(" {0} province=N'{1}'", sqlLinkStr, provinceSN);
                sqlLinkStr   = "and";
            }
            if (citySN != "区域-市" && citySN != "-1")
            {
                sqlWhereStr += string.Format(" {0} city=N'{1}'", sqlLinkStr, citySN);
                sqlLinkStr   = "and";
            }
            if (capitalPurposeSN != "资金用途" && capitalPurposeSN != "-1")
            {
                sqlWhereStr += string.Format(" {0} capitalPurposeType=N'{1}'", sqlLinkStr, capitalPurposeSN);
                sqlLinkStr   = "and";
            }
            if (paymentTypeSN != "还款方式" && paymentTypeSN != "-1")
            {
                sqlWhereStr += string.Format(" {0} repaymentType=N'{1}'", sqlLinkStr, paymentTypeSN);
                sqlLinkStr   = "and";
            }
            if (guaranteeTypeSN != "保证方式" && guaranteeTypeSN != "-1")
            {
                sqlWhereStr += string.Format(" {0} guaranteeType=N'{1}'", sqlLinkStr, guaranteeTypeSN);
                sqlLinkStr   = "and";
            }
            if (financingMain != "融资方" && financingMain != "-1")
            {
                bool ifCompany = financingMain == "企业" ? true : false;
                sqlWhereStr += string.Format(" {0} mainFinancing=N'{1}'", sqlLinkStr, ifCompany);
                sqlLinkStr   = "and";
            }

            string sqlOrderByStr = "";

            string[] sortStrSplit = sortStr.Split(',');
            for (int i = 1; i < (sortStrSplit.Length - 1); i++)
            {
                string[] sortStrSplitSplit = sortStrSplit[i].Split('#');
                if (i == 1)
                {
                    sqlOrderByStr += "order by";
                }
                else
                {
                    sqlOrderByStr += ",";
                }

                int    orderByFieldNum  = Convert.ToInt32(sortStrSplitSplit[0]) - 4;
                string orderByFieldName = sortList[orderByFieldNum];
                string order            = sortStrSplitSplit[1] == "A" ? "" : " desc";
                sqlOrderByStr += string.Format(" {0} {1}", orderByFieldName, order);
            }

            string sqlStr = string.Format("select * from VP101001 {0} {1}", sqlWhereStr, sqlOrderByStr);

            IEnumerable <VP101001> crDataList = dbma1.ExecuteQuery <VP101001>(sqlStr);

            return(crDataList);
        }