private void AbbreviationsCellValueChanged(object sender, DataGridViewCellEventArgs e) { DataGridViewRow row = AbbreviationsDataGridView.CurrentRow; if (row == null) { return; } string nvAbbreviation = ((row.Cells[Constants.COLUMN_ABBREVIATION].Value == DBNull.Value) ? string.Empty : row.Cells[Constants.COLUMN_ABBREVIATION].Value).ToString(); if (!string.IsNullOrWhiteSpace(nvAbbreviation)) { Dapper.DynamicParameters param = new Dapper.DynamicParameters(); param.Add("@" + Constants.COLUMN_ABBREVIATION_ID, row.Cells[Constants.COLUMN_ABBREVIATION_ID].Value); param.Add("@" + Constants.COLUMN_ABBREVIATION, row.Cells[Constants.COLUMN_ABBREVIATION].Value); param.Add("@" + Constants.COLUMN_ABBREVIATION_FLAG, row.Cells[Constants.COLUMN_ABBREVIATION_FLAG].Value); try { DataAccess.UpdateAbbreviation(param); } catch (System.Data.SqlClient.SqlException ex) { MessageBox.Show(Properties.Resources.NOTIFY_ABBREVIATION_CELL, Properties.Resources.CAPTION_ABBREVIATIONS, MessageBoxButtons.OK, MessageBoxIcon.Error); if (log != null) { log.Error(Properties.Resources.NOTIFY_ABBREVIATION_CELL, ex); } } } }
public IActionResult Upsert(Category category) { if (ModelState.IsValid) { var parameter = new Dapper.DynamicParameters(); parameter.Add("@Name", category.Name); if (category.ParentId != null) { parameter.Add("@ParentId", category.ParentId); } else { parameter.Add("@ParentId", null); } // Create new category if (category.Id == 0) { _unitOfWork.SP_Call.Execute(StaticDetails.Proc_Category_Create, parameter); } else { parameter.Add("@Id", category.Id); _unitOfWork.SP_Call.Execute(StaticDetails.Proc_Category_Update, parameter);; } _unitOfWork.Save(); return(RedirectToAction(nameof(Index))); } return(View(category)); }
protected string query(ref tablesViewModel viewModel) { string ret = ""; tableDisp tmpModel = viewModel.editModel; tableLib tlib = new tableLib(connEPLabDB); var paras = new Dapper.DynamicParameters(); paras.Add("TableName", tmpModel.tableName + "", DbType.String); paras.Add("TableDesc", tmpModel.tableDesc + "", DbType.String); string sql = @" select top 1000 * from tables where (@TableName='' or tablename=@TableName) and (@TableDesc='' or tableDesc=@TableDesc) "; var qry = tlib.Query <tableDisp>(sql, paras); if (qry.Any()) { viewModel.queryResult = qry.ToList(); } else { viewModel.queryResult = null; } return(ret); }
protected string query(ref fieldsViewModel viewModel) { string ret = ""; fieldDisp tmpModel = viewModel.editModel; fieldLib flib = new fieldLib(connEPLabDB); var paras = new Dapper.DynamicParameters(); paras.Add("tableId", tmpModel.tableId, DbType.Guid); paras.Add("fieldName", tmpModel.fieldName + "", DbType.String); paras.Add("fieldDesc", tmpModel.fieldDesc + "", DbType.String); string sql = @" select * from fields where (@tableId='00000000-0000-0000-0000-000000000000' or tableId=@tableId) and (@fieldName='' or fieldName=@fieldName) and (@fieldDesc='' or fieldDesc=@fieldDesc) order by defaultOrder "; var qry = flib.Query <fieldDisp>(sql, paras); if (qry.Any()) { viewModel.queryResult = qry.ToList(); } else { viewModel.queryResult = null; } return(ret); }
public async Task <IActionResult> PageData(int page, int limit, string Title, string Content, int type) { string msg = string.Empty; int code = 0; int total = 0; string sWhere = string.Empty; IEnumerable <EMessageBox> list = null; try { var param = new Dapper.DynamicParameters(); if (!string.IsNullOrEmpty(Title)) { sWhere += " and Title like @Title"; param.Add("Title", string.Format("%{0}%", Title)); } if (!string.IsNullOrEmpty(Content)) { sWhere += " and Content like @Content"; param.Add("Content", string.Format("%{0}%", Content)); } total = await _MessageBoxRepository.GetTotalCount(sWhere, param); list = await _MessageBoxRepository.GetPageAsync(page, limit, sWhere, param); } catch (Exception ex) { code = -1; msg = ex.Message; } return(Ok(new { code = code, msg = msg, count = total, data = list })); }
private void GetContractInfo(string key) { string contactno = key; this.submodel = new SubscribeBLL().GetSubscribeInfoContractNo(contactno); if (submodel.AddDate < Convert.ToDateTime("2016-3-11")) { companyName = "广东俊特团贷网络信息服务股份有限公司"; } else { companyName = "东莞团贷网互联网科技服务有限公司"; } Dapper.DynamicParameters param = new Dapper.DynamicParameters(); param = new Dapper.DynamicParameters(); param.Add("@projectId", submodel.ProjectId); param.Add("@curUserId", WebUserAuth.UserId); string strSQL = "select Count(1) from project where Id=@projectId and UserId=@curUserId"; bool isExist = PublicConn.QuerySingle <int>(strSQL, ref param) > 0; if (this.submodel.SubscribeUserId != WebUserAuth.UserId && !isExist) { HttpContext.Current.Response.Write("对不起,您没有权限查看此合同。"); HttpContext.Current.Response.End(); return; } }
protected string WeDeadlines = string.Empty; //we计划月份 protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { Guid UserId = WebUserAuth.UserId.Value; var para = new Dapper.DynamicParameters(); para.Add("@UserId", UserId); para.Add("@rank", 0, DbType.Int32, ParameterDirection.Output); TuanDai.DB.TuanDaiDB.Execute(TdConfig.ApplicationName, TdConfig.DBRead, "exec p_GetUserAutoQueue @UserId,@rank out", ref para); rankid = para.Get <int?>("@rank") ?? 0; //List<UserAutoTenderSettingInfo> list = // new UserAutoTenderSettingBLL().GetUserAutoTenderSettingListByUserId(UserId); //autoList = list.ToList(); string sql = @"SELECT * FROM (SELECT * FROM dbo.UserAutoTenderSetting WITH(NOLOCK) WHERE UserId=@UserId UNION SELECT Id,UserId,ProjectType,''AS RepaymentType,0 AS StartRate,0 AS EndRate,0 AS StartDeadLine,0 AS EndDeadLine,StartDate,EndDate,ReservedAmout,0 AS PreAmout,SortOrder,Status,CreateDate,0 AS StartDeadType,0 AS EndDeadType FROM dbo.UserAutoWePlanSetting WITH(NOLOCK) WHERE UserId=@UserId)a ORDER BY a.SortOrder"; var settingList = TuanDai.DB.TuanDaiDB.Query <UserAutoTenderSettingInfo>(TdConfig.ApplicationName, TdConfig.DBRealRead, sql, ref para); autoList = settingList; //获取自动投标设置 WebSettingInfo webSettingInfo = new WebSettingBLL().GetWebSettingInfo("17191362-568A-4F46-8D7D-5C23D80C9D8B"); this.perAmountLimit = !string.IsNullOrEmpty(webSettingInfo.Param2Value) ? webSettingInfo.Param2Value : "100"; this.limitPercent = !string.IsNullOrEmpty(webSettingInfo.Param3Value) ? webSettingInfo.Param3Value : "100"; } }
//获取每种商品每天的个人的最大兑换数量 private void GetLimitNum() { string id = Context.Request.QueryString["id"]; string sql = " select @LimitNum=LimitNum,@IsLimitNum=IsLimitNum,@LeastLevel=LeastLevel,@IsLeastLevel=IsLeastLevel from dbo.MVipProductConfigure where ProductId=@productId "; var param = new Dapper.DynamicParameters(); param.Add("@LimitNum", 0, DbType.Int32, ParameterDirection.Output); param.Add("@IsLimitNum", 0, DbType.Boolean, ParameterDirection.Output); param.Add("@LeastLevel", 0, DbType.Int32, ParameterDirection.Output); param.Add("@IsLeastLevel", 0, DbType.Boolean, ParameterDirection.Output); param.Add("@productId", id); TuanDai.DB.TuanDaiDB.Execute(TdConfig.ApplicationName, TdConfig.DBVipWrite, sql, ref param); bool isLimitNum = param.Get <bool?>("@IsLimitNum").HasValue ? param.Get <bool>("@IsLimitNum") : false; if (isLimitNum) { LimitNum = param.Get <int?>("@LimitNum").HasValue ? param.Get <int>("@LimitNum") : 0; } bool isLeastLevel = param.Get <bool?>("@IsLeastLevel").HasValue ? param.Get <bool>("@IsLeastLevel") : false; if (isLeastLevel) { LeastLevel = param.Get <int?>("@LeastLevel").HasValue ? param.Get <int>("@LeastLevel") : 1; } }
private bool IsExchangeProduct(int type) { //每天限制为白天08:00-22:00 if ((DateTime.Now.Hour < 8 || DateTime.Now.Hour >= 22)) { return(true); } if (!WebUserAuth.UserId.HasValue || WebUserAuth.UserId.Value == Guid.Empty) { return(false); } string sqlText = " select top 1 *from dbo.MVipExchangeHistory(nolock) where SubType=@subType and UserId=@userId order by AddDate desc"; var param = new Dapper.DynamicParameters(); param.Add("@userId", WebUserAuth.UserId.Value); param.Add("@subType", type); List <MVipExchangeHistory> list = TuanDai.DB.TuanDaiDB.Query <MVipExchangeHistory>(TdConfig.ApplicationName, TdConfig.DBVipWrite, sqlText, ref param); if (list != null && list.Count >= 1) { DateTime exTime = list[0].AddDate; if (exTime.Date == DateTime.Now.Date) //当天有兑换过 { return(true); } } return(false); }
public List <DB_MC_PATIENT_INFO> GetPatListByID(JWT_Form_Body form) { string actionName = "GetPatListByID"; List <DB_MC_PATIENT_INFO> pList = new List <DB_MC_PATIENT_INFO>(); Dapper.DynamicParameters dp = new Dapper.DynamicParameters(); string sql = "SELECT * FROM " + DB_TABLE_NAME.DB_MC_PATIENT_INFO + " WHERE 1=1 "; if (!string.IsNullOrWhiteSpace(form.site_id)) { sql += " AND SITE_ID =@SITE_ID"; dp.Add("SITE_ID", form.site_id); } if (!string.IsNullOrWhiteSpace(form.hosp_id)) { sql += " AND HOSP_KEY LIKE @HOSP_KEY"; dp.Add("HOSP_KEY", form.hosp_id + '%'); } pList = DBLink.DBA.getSqlDataTable <DB_MC_PATIENT_INFO>(sql, dp); pList.ForEach(x => { x.EXPECTED_ARRIVAL_DATETIME = !string.IsNullOrWhiteSpace(x.EXPECTED_ARRIVAL_DATETIME) ? Function_Library.getDateString(DateTime.Parse(x.EXPECTED_ARRIVAL_DATETIME), DATE_FORMAT.yyyy_MM_dd_HHmm) : ""; x.SELECTION_DATETIME = !string.IsNullOrWhiteSpace(x.SELECTION_DATETIME) ? Function_Library.getDateString(DateTime.Parse(x.SELECTION_DATETIME), DATE_FORMAT.yyyy_MM_dd_HHmm) : ""; }); return(pList); }
private void TABPreferencesLeave(object sender, EventArgs e) { if (NAVPanelFormTabControl.SelectedTab.Name != "TABPreferences") { if (GetNotifyPreferenceChange() && GetEnablePreferenceChange()) { InformPreferenceChanged(); } } SaveLastTabOpened(NAVPanelFormTabControl.SelectedTab.Name); void SaveLastTabOpened(string selectedTab) { if (selectedTab != null) { if (MaintainTabState) { Dapper.DynamicParameters param = new Dapper.DynamicParameters(); param.Add("@" + Constants.COLUMN_USER_ID, UserHelper.UserPropertiesModel.iUserID); param.Add("@" + Constants.COLUMN_USER_LAST_FILENAME_OPENED, UserHelper.UserStateModel.nvLastFilenameOpened); param.Add("@" + Constants.COLUMN_USER_LAST_TAB_FOCUS, selectedTab); param.Add("@" + Constants.COLUMN_USER_LAST_TABLE_FOCUS, UserHelper.UserStateModel.nvLastTableFocus); param.Add("@" + Constants.COLUMN_USER_BUILD_VERSION, Constants.BUILD_VERSION); DataAccess.InsertUserStateLogEntry(param); } UserHelper.UserStateModel.nvLastTabFocus = selectedTab; } } }
private void btnSave_Click(object sender, EventArgs e) { if (_obj != null) { Dapper.DynamicParameters paramss = new Dapper.DynamicParameters(); paramss.Add("Ten", txtTen.Text); paramss.Add("ID", txtID.Text); var xxx = _baseService.ExcuteNonQuery("update LoaiVanBan set Ten = @Ten where ID = @ID", paramss); if (xxx > 0) { MessageBox.Show("Sửa loại văn bản thành công!"); this.Close(); } else { MessageBox.Show("Sửa loại văn bản thất bại!"); } } else { Dapper.DynamicParameters paramss = new Dapper.DynamicParameters(); paramss.Add("Ten", txtTen.Text); var xxx = _baseService.ExcuteNonQuery("Insert into LoaiVanBan(Ten) Values(@Ten)", paramss); if (xxx > 0) { MessageBox.Show("Thêm mới loại văn bản thành công!"); this.Close(); } else { MessageBox.Show("Thêm mới loại văn bản thất bại!"); } } }
public async Task <IEnumerable <ESysMenu> > GetPageAsync(int PageIndex, int PageSize, string sWhere, Dapper.DynamicParameters param) { string sql = "select * from(select ROW_NUMBER() over(order by MenuID desc)n,MenuID,MenuTitle,MenuUrl,ParentID,Sort,Style,Status from Sys_Menu where 1=1 {0} ) p where p.n>@p1 and p.n<=@p2"; sql = string.Format(sql, sWhere); param.Add("p1", (PageIndex - 1) * PageSize); param.Add("p2", PageIndex * PageSize); return(await _context.QueryAsync <ESysMenu>(sql, param)); }
public async Task <IEnumerable <EMessageBox> > GetPageAsync(int PageIndex, int PageSize, string sWhere, Dapper.DynamicParameters param) { string sql = "select * from(select ROW_NUMBER() over(order by ID desc)n,ID,Sender,SenderID,Receiver,ReceiverID,SendTime,CreateTime,Title,Content,Type,Status from MessageBox where 1=1 {0} ) p where p.n>@p1 and p.n<=@p2"; sql = string.Format(sql, sWhere); param.Add("p1", (PageIndex - 1) * PageSize); param.Add("p2", PageIndex * PageSize); return(await _context.QueryAsync <EMessageBox>(sql, param)); }
public async Task <IEnumerable <ESysUserInfo> > GetPageAsync(int PageIndex, int PageSize, string sWhere, Dapper.DynamicParameters param) { string sql = "select * from(select ROW_NUMBER() over(order by UserID desc)n,UserID,UserName,RealName,Pwd,Mobile,Wechat,OpenId,Dept,Position,Status from Sys_UserInfo where 1=1 {0} ) p where p.n>@p1 and p.n<=@p2"; sql = string.Format(sql, sWhere); param.Add("p1", (PageIndex - 1) * PageSize); param.Add("p2", PageIndex * PageSize); return(await _context.QueryAsync <ESysUserInfo>(sql, param)); }
public async Task <IEnumerable <ESysKeywords> > GetPageAsync(int PageIndex, int PageSize, string sWhere, Dapper.DynamicParameters param) { string sql = "select * from(select ROW_NUMBER() over(order by ID desc)n,ID,Keyword,ReplaceValue,Status from Sys_Keywords where 1=1 {0} ) p where p.n>@p1 and p.n<=@p2"; sql = string.Format(sql, sWhere); param.Add("p1", (PageIndex - 1) * PageSize); param.Add("p2", PageIndex * PageSize); return(await _context.QueryAsync <ESysKeywords>(sql, param)); }
public static Dapper.DynamicParameters GetUIGAUserItemParameters(int LoginUID, int itemID, int grade, long wigaUid) { Dapper.DynamicParameters queryParameters = new Dapper.DynamicParameters(); queryParameters.Add("@01iLoginUID_input", LoginUID); queryParameters.Add("@02iItemID_input", itemID); queryParameters.Add("@03iGradeID_input", grade); queryParameters.Add("@04iWIGAUID_input", wigaUid); return(queryParameters); }
public async Task <IEnumerable <ESysAlarmLevel> > GetPageAsync(int PageIndex, int PageSize, string sWhere, Dapper.DynamicParameters param) { string sql = "select * from(select ROW_NUMBER() over(order by ID desc)n,ID,AlarmLevel,AlarmType,iAlarmLevel from Sys_AlarmLevel where 1=1 {0} ) p where p.n>@p1 and p.n<=@p2"; sql = string.Format(sql, sWhere); param.Add("p1", (PageIndex - 1) * PageSize); param.Add("p2", PageIndex * PageSize); return(await _context.QueryAsync <ESysAlarmLevel>(sql, param)); }
/// <summary> /// 获取某类复投宝的利率设置 /// </summary> /// <param name="productTypeId">产品类型Id</param> /// <returns></returns> public List <WeProductFTBRateInfo> GetWeFTBRateList(int productTypeId, DateTime publisherDate) { string strSQL = "select * from We_ProductFTBRate where ProductTypeId=@typeId and ( (@publisherDate between StartDate and EndDate) or StartDate is null) order by MonthType"; Dapper.DynamicParameters dyParams = new Dapper.DynamicParameters(); dyParams.Add("@typeId", productTypeId); dyParams.Add("@publisherDate", publisherDate); return(PublicConn.QueryBySql <WeProductFTBRateInfo>(strSQL, ref dyParams)); }
//获取每种商品每天的个人的最大兑换数量 private void GetLimitNum(Guid id) { string sql = " select @LimitNum=LimitNum from dbo.MVipProductConfigure where IsLimitNum=1 and ProductId=@productId "; var param = new Dapper.DynamicParameters(); param.Add("@LimitNum", 0, DbType.Int32, ParameterDirection.Output); param.Add("@productId", id); TuanDai.DB.TuanDaiDB.Execute(TdConfig.ApplicationName, TdConfig.DBVipWrite, sql, ref param); LimitNum = param.Get <int?>("@LimitNum").HasValue ? param.Get <int>("@LimitNum") : 0; }
private int UpdateAccountRechare(AccountRechareInfo Info) { string strSQL = " Update AccountRechare Set" + " [From]=@From WHERE TranOrder=@TranOrder"; var paramData = new Dapper.DynamicParameters(); paramData.Add("@From", Info.From); paramData.Add("@TranOrder", Info.TranOrder); return(PublicConn.ExecuteTD(PublicConn.DBWriteType.FundWrite, strSQL, ref paramData)); }
/// <summary> /// 传入开始时间与月份获取最后还款时间 /// </summary> /// <param name="starTime">开始时间</param> /// <param name="month">月份</param> /// <param name="repaymentType">还款方式</param> /// <returns></returns> public DateTime GetEndTime(DateTime starTime, int month, int repaymentType) { var dyParams = new Dapper.DynamicParameters(); dyParams.Add("@StarTime", starTime); dyParams.Add("@Month", month); dyParams.Add("@RepaymentType", repaymentType); string strSQL = "SELECT dbo.f_GetMaxRepayment_Date(@StarTime,@month,@RepaymentType)"; return(PublicConn.QuerySingle <DateTime>(strSQL, ref dyParams)); }
/// <summary> /// 获取订单加息的利率 /// </summary> /// <param name="orderid"></param> /// <returns></returns> private decimal GetOrderJxRate(Guid orderid, Guid userid) { string sql = @"select TuandaiRedRate+isnull(R.RatePercent,0) from dbo.We_Order W left join dbo.RateCoupon20151226 R on W.Id=R.OrderId where W.UserId=@UserId and W.Id=@OrderId"; var dyParams = new Dapper.DynamicParameters(); dyParams.Add("@UserId", userid); dyParams.Add("@OrderId", orderid); return(TuanDai.DB.TuanDaiDB.QueryFirstOrDefault <decimal?>(TdConfig.DBRead, sql, ref dyParams) ?? 0); }
private void GetContractInfo(string key) { string contactno = key; this.submodel = new SubscribeBLL().GetSubscribeInfoContractNo(contactno); if (submodel.AddDate < Convert.ToDateTime("2016-3-11")) { companyName = "广东俊特团贷网络信息服务股份有限公司"; } else { companyName = "东莞团贷网互联网科技服务有限公司"; } if (submodel.AddDate.Value <= DateTime.Parse("2015-07-31")) { Response.Redirect(string.Format("/Contract/ContractJzdb.aspx?key={0}&type=mobileapp", key)); return; } Dapper.DynamicParameters param = new Dapper.DynamicParameters(); param = new Dapper.DynamicParameters(); param.Add("@ProjectId", submodel.ProjectId); param.Add("@curUserId", WebUserAuth.UserId); string strSQL = "select Count(1) from project(nolock) where Id=@ProjectId and UserId=@curUserId"; bool isExist = PublicConn.QuerySingle <int>(strSQL, ref param) > 0; if (this.submodel.SubscribeUserId != WebUserAuth.UserId && !isExist) { HttpContext.Current.Response.Write("对不起,您没有权限查看此合同。"); HttpContext.Current.Response.End(); return; } this.subBasicModel = userbll.GetUserBasicInfoModelById(submodel.SubscribeUserId.Value); //投资人信息 this.proModel = projectbll.GetProjectDetailInfo(submodel.ProjectId.Value); this.publisherModel = userbll.GetUserBasicInfoModelById(proModel.UserId.Value); //借款人信息 this.SharesPercent = (publisherModel.NumberOfShares * 10000m / 100000000m * 100m).ToString("0.00"); this.PrincipalInterest = submodel.Amount.Value + submodel.InterestAmount.Value; AssureModel = new Common.Contract().GetAssureOrganizationByProjectId(proModel.Id); //印章小图片 this.AssureModel.image = new Common.Contract().GetSmallImage(this.AssureModel.image); RepaymentTypeDesc = new Common.Contract().GetRepaymentTypeDesc(proModel.RepaymentType ?? 0); if (WebUserAuth.UserId == publisherModel.Id) { this.subBasicModel.RealName = StringHandler.MaskStartPre(subBasicModel.RealName, 1); //出借人 this.subBasicModel.IdentityCard = StringHandler.MaskCardNo(subBasicModel.IdentityCard); //出借人身份证号 } else { this.publisherModel.RealName = StringHandler.MaskStartPre(publisherModel.RealName, 1); //借款 人 this.publisherModel.IdentityCard = StringHandler.MaskCardNo(publisherModel.IdentityCard); //借款人身份证号 } }
private int UpdateAccountRechare(byte?From, string TranOrder) { int result = 0; string strSQL = " Update AccountRechare Set" + " [From]=@From WHERE TranOrder=@TranOrder"; var paramData = new Dapper.DynamicParameters(); paramData.Add("@From", From); paramData.Add("@TranOrder", TranOrder); result = PublicConn.ExecuteTD(PublicConn.DBWriteType.FundWrite, strSQL, ref paramData); return(result); }
/// <summary> /// 获取订单加息的利率 /// </summary> /// <param name="orderid"></param> /// <returns></returns> private decimal GetOrderJxRate(decimal tuandaiRate, Guid orderid, Guid userid) { if (tuandaiRate > 0) { return(tuandaiRate); } else { string sql = "SELECT RatePercent FROM RateCoupon20151226 with(nolock) WHERE UserId=@UserId AND OrderId=@OrderId"; var dyParams = new Dapper.DynamicParameters(); dyParams.Add("@UserId", userid); dyParams.Add("@OrderId", orderid); return(PublicConn.QuerySingle <decimal?>(sql, ref dyParams) ?? 0); } }
public static Dapper.DynamicParameters GetWIGAInsertItemParameters(int LoginUID, int charType, int itemID, int grade, int period, int duration) { Dapper.DynamicParameters queryParameters = new Dapper.DynamicParameters(); queryParameters.Add("@01iLoginUID_input", LoginUID); queryParameters.Add("@02iCharType_input", charType); queryParameters.Add("@03iItemID_input", itemID); queryParameters.Add("@04iGradeID_input", grade); queryParameters.Add("@05iPeriod_input", period); queryParameters.Add("@06iDuration_input", duration); queryParameters.Add("@07iGetType_input", 2); queryParameters.Add("@08iStatus_input ", 2); queryParameters.Add("@09iItemLevel_input", 0); queryParameters.Add("@10iStrengthLevel_input", -1); return(queryParameters); }
//获取复投宝的待收本息 public Tuple <decimal, decimal> GetFTBDueInAmountInterest(Guid userId) { var dyParams = new Dapper.DynamicParameters(); dyParams.Add("@UserId", userId); dyParams.Add("@totalAmount", 0, DbType.Decimal, ParameterDirection.Output, 18, null, 2); dyParams.Add("@totalInterest", 0, DbType.Decimal, ParameterDirection.Output, 18, null, 2); string strSQL = "select @totalAmount=RecoverBorrowOut, @totalInterest=DueComeInterest from We_FundAccountInfo where UserId=@UserId"; PublicConn.ExecuteTD(PublicConn.DBWriteType.Read, strSQL, ref dyParams); Tuple <decimal, decimal> result = new Tuple <decimal, decimal>(dyParams.Get <decimal?>("@totalAmount") ?? 0, dyParams.Get <decimal?>("@totalInterest") ?? 0); return(result); }
public static UserEnterpriseInfo GetBorrowerGuaranteeEnterprise(Guid borrowerUserId, DateTime AddDate) { string sql = "select * from UserInEnterprise with(nolock) where BorrowerUserId=@BorrowerUserId"; var dyParams = new Dapper.DynamicParameters(); dyParams.Add("@BorrowerUserId", borrowerUserId); List <UserInEnterpriseInfo> UserInEnterpriseList = PublicConn.QueryBySql <UserInEnterpriseInfo>(sql, ref dyParams); UserInEnterpriseInfo userInEnterprise; if (UserInEnterpriseList.Count() > 1) { userInEnterprise = UserInEnterpriseList.Where(p => p.CreateDate < AddDate).OrderByDescending(p => p.CreateDate).FirstOrDefault(); } else { userInEnterprise = UserInEnterpriseList.FirstOrDefault(); } if (userInEnterprise != null) { Guid EnterpriseUserId = userInEnterprise.EnterpriseUserId; // UserEnterprise userenter = db.UserEnterprise.FirstOrDefault(p => p.UserId == EnterpriseUserId); sql = "select * from UserEnterprise with(nolock) where UserId=@UserId"; dyParams = new Dapper.DynamicParameters(); dyParams.Add("@UserId", EnterpriseUserId); UserEnterpriseInfo userenter = PublicConn.QuerySingle <UserEnterpriseInfo>(sql, ref dyParams); return(userenter); } else { return(null); } }
private void GetContractInfo() { string strSQL = @"SELECT a.Id as ProductId,a.ProductName, a.PlanAmount,a.ProjectTypes,a.Deadline,b.RepeatInvestType, b.YearRate, b.MinYearRate, a.StartDate,a.UnitAmount, b.Amount as JoinAmount, b.OrderQty, b.UserId, b.OrderDate FROM dbo.We_Product a WITH(NOLOCK) left JOIN dbo.We_Order b WITH(NOLOCK) on b.ProductId=a.Id WHERE b.Id=@WeOrderId"; var dyParams = new Dapper.DynamicParameters(); dyParams.Add("@WeOrderId", Key); List <MyWeOrderInfo> list = new List <MyWeOrderInfo>(); list = PublicConn.QueryBySql <MyWeOrderInfo>(strSQL, ref dyParams); WeOrder = list.Count > 0 ? list[0] : new MyWeOrderInfo(); if (WeOrder.OrderDate >= DateTime.Parse("2016-03-11")) { companyName = "东莞团贷网互联网科技服务有限公司"; Sealt_TuanDai = "images/tuandai_ss.png"; } this.subBasicModel = userbll.GetUserBasicInfoModelById(WeOrder.UserId);//投资人信息 switch (GetTypeWord(WeOrder.ProductId).ToLower()) { case "b": case "c": RepaymentTypeDesc = "每月付息"; break; case "a": RepaymentTypeDesc = "每月付息或到期本息"; break; } }
public static TheTableInformation FetchTableAndHistory(Guid? jobID = null, string tableName = null) { if ((jobID == null) == (string.IsNullOrWhiteSpace(tableName))) { throw new ArgumentException("Either job ID or job Name should be supplied, not both."); } var dbArgs = new Dapper.DynamicParameters(); if (jobID != null) { dbArgs.Add("@jobID", jobID); tableName = (string)DapperWrapper.ExecuteScalar("SELECT [dbo].[FetchJobName](@jobID)", dbArgs); dbArgs.Add("@JobNamePattern", tableName); } else { dbArgs.Add("@JobNamePattern", tableName); jobID = (Guid?)DapperWrapper.ExecuteScalar("SELECT [dbo].[FetchJobID](@JobNamePattern)", dbArgs); if (jobID != null) { dbArgs.Add("@jobID", jobID); } } var model = new TheTableInformation { TheName = tableName, TheData = null, TheHistory = null }; if (jobID != null) { model.TheData = DapperWrapper.Query<TheTableEntry>("SELECT * FROM [dbo].[FetchATable](@jobID)", dbArgs).ToList(); model.TheHistory = DapperWrapper.Query<TheTableHistoryEntry>( "SELECT * FROM [dbo].[FetchJobHistory](@jobID, @JobNamePattern) ORDER BY [Completed] DESC", dbArgs).ToList(); } return model; }