/// <summary> /// 用户提现 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool Draw(MReceiptFundRecord model) { List <DbParameter> Params = new List <DbParameter>(); Params.Add(new DbParameter(":v_account_id", model.AccountId)); Params.Add(new DbParameter(":v_order_no", string.Empty)); Params.Add(new DbParameter(":v_change_type", model.ChangeType)); Params.Add(new DbParameter(":v_change_amount", model.ChangeAmount)); Params.Add(new DbParameter(":v_card_type", model.ProductType)); Params.Add(new DbParameter(":v_operator", model.Operator)); Params.Add(new DbParameter(":v_remark", model.Remark)); Params.Add(new DbParameter { Name = "v_code", Direction = System.Data.ParameterDirection.Output }); var res = dbAccess.DbProvider.ExcuteProcToArray("sp_draw_account_info", Params.ToArray()); if (Convert.ToInt32(res[0]) == 100) { return(true); } else { return(false); } }
/// <summary> /// 获取数据列表 /// </summary> /// <param name="json">json数据</param> /// <returns></returns> public List <MReceiptFundRecord> GetDataList(string json) { MReceiptFundRecord data = JsonData.JavaScriptDeserialize <MReceiptFundRecord>(json); return(handler.GetDataList(data, ORDER_BY, Lib4Net.DB.MatchMode.Exact)); }
/// <summary> /// 添加或修改数据,id为空时为添加,否则为修改 /// </summary> /// <param name="vo">实体数据</param> /// <returns></returns> public IResult Save(MReceiptFundRecord vo) { IResult result = new Result(false); bool status = dbAccess.Save(vo) > 0; if (status) { result = new Result(true); result["id"] = CommFun.GetString(dbAccess.Builder.ODMapConfig.PrimaryKeyField.GetValue(vo)); } return(result); }
/// <summary> /// 账户体现 /// </summary> /// <returns></returns> public ActionResult Draw(string id) { object rst = null; try { if (!string.IsNullOrEmpty(id)) { return(View(ReceiptAccountInfoService.Instance.QueryItem(id))); } else { foreach (var key in Request.Form.AllKeys) { if (string.IsNullOrEmpty(Request.Form[key])) { rst = new { success = false, info = "缺少参数" }; break; } } MReceiptFundRecord record = new MReceiptFundRecord();//资金变动实体model record.ChangeAmount = Convert.ToDecimal(Request.Form["ChangeAmount"]); record.AccountId = Convert.ToInt64(Request.Form["__id"]); record.Remark = Request.Form["Remark"]; record.Operator = LoginStatus.UserName; record.ChangeType = Convert.ToInt32(Request.Form["ChangeType"]); if (record.ChangeAmount <= ReceiptAccountInfoService.Instance.QueryItem(record.AccountId.ToString()).CurrentModel.Balance) { if (ReceiptAccountInfoService.Instance.Draw(record)) { rst = new { success = true, info = "操作成功" }; } else { rst = new { success = false, info = "操作失败" } }; } else { rst = new { success = false, info = "余额不足" }; } return(Json(rst)); } } catch (Exception ex) { rst = new { success = false, info = ex.Message }; return(Json(rst)); } }
/// <summary> /// 查询列表数据 /// </summary> /// <param name="nvc">参数集合</param> /// <returns></returns> public ReceiptFundRecordListModel Query(NameValueCollection nvc) { ReceiptFundRecordListModel model = new ReceiptFundRecordListModel(); MReceiptFundRecord entity = new MReceiptFundRecord(); StringBuilder WhereString = new StringBuilder(); //下游渠道查询 if (!string.IsNullOrEmpty(nvc["PayType"])) { WhereString.AppendFormat(" and t1.account_type={0}", nvc["PayType"]); } if (!string.IsNullOrEmpty(nvc["ChannelNo"])) { WhereString.AppendFormat(" and t1.down_channel_no={0}", nvc["ChannelNo"]); } model.PageSize = CommFun.ToInt(nvc["ps"], SettingHelper.Instance.GetInt("PageSize", 10)).Value; model.PageIndex = CommFun.ToInt(nvc["pi"], SettingHelper.Instance.GetInt("PageIndex", 0)).Value + 1; entity.SetData(nvc, false); entity.TrimEmptyProperty(); entity.AddData(":PS", model.PageSize); entity.AddData(":PI", model.PageIndex); entity.AddData(":WhereString", string.IsNullOrEmpty(WhereString.ToString()) ? " and 1=1" : WhereString.ToString()); //时间 DateTime st = CommFun.ToDateTime(nvc["s"], DateTime.Now.AddDays(-1)).Value; DateTime et = CommFun.ToDateTime(nvc["e"], DateTime.Now).Value; entity.AddData("ST", st.ToString("yyyy-MM-dd")); entity.AddData("ET", et.ToString("yyyy-MM-dd")); //关键字 string keyWords = CommFun.GetString(nvc["KeyWords"]); if (!string.IsNullOrEmpty(keyWords)) { entity.OrderNO = keyWords; } model.TotalCount = CommFun.ToInt(handler.GetScalarByXmlTemplate("getCount", entity), 0).GetValueOrDefault(); if (model.TotalCount > 0) { model.List = handler.GetDataListByTemplate("getList", entity); } return(model); }
/// <summary> /// 添加或修改数据,id为空时为添加,否则为修改 /// </summary> /// <param name="id">主键值</param> /// <param name="vo">实体数据</param> /// <returns></returns> public IResult Save(string id, MReceiptFundRecord vo) { bool status = false; IResult result = new Result(status); if (string.IsNullOrEmpty(id)) { status = dbAccess.CreateNew(vo); } else { status = dbAccess.Update(id, vo); } if (status) { result = new Result(true); result["id"] = CommFun.GetString(dbAccess.Builder.ODMapConfig.PrimaryKeyField.GetValue(vo)); } return(result); }
/// <summary> /// 获取指定条件的数据集 /// </summary> /// <param name="query">查询条件</param> /// <param name="orderBy">排序字段,{f:属性名} asc</param> /// <param name="mmode">字符串匹配模式 Exact:精确匹配 Vague:模糊匹配</param> /// <param name="cmode">条件连接字符串 And 或 OR</param> /// <returns></returns> public DataSet GetDataSet(MReceiptFundRecord query, string orderBy = "", MatchMode mmode = MatchMode.Exact, ConnectMode cmode = ConnectMode.And) { return(dbAccess.GetDataSet(query, orderBy, mmode, cmode)); }
/// <summary> /// 查询单实体信息(单实体数据) /// </summary> /// <param name="id">主键编号</param> /// <returns></returns> public MReceiptFundRecord GetSingleDataByTemplate(string xmlTemplateName, MReceiptFundRecord vo) { return(dbAccess.GetSingleDataByTemplate(xmlTemplateName, vo)); }
/// <summary> /// 根据模版获取DataSet /// </summary> /// <param name="xmlTemplateName">模板名称</param> /// <param name="vo">实体</param> /// <returns></returns> public DataSet GetDataSetByTemplate(string xmlTemplateName, MReceiptFundRecord vo) { return(dbAccess.GetDataSetByTemplate(xmlTemplateName, vo)); }
/// <summary> /// 根据模板获取实体信息 /// </summary> /// <param name="xmlTemplateName">模板名称</param> /// <param name="vo">实体</param> /// <returns></returns> public List <MReceiptFundRecord> GetDataListByTemplate(string xmlTemplateName, MReceiptFundRecord vo) { return(dbAccess.GetDataListByTemplate(xmlTemplateName, vo)); }
/// <summary> /// 根据模板名称获取第一行一列的值 /// </summary> /// <param name="xmlTemplateName">模板名称</param> /// <param name="vo">实体</param> /// <returns></returns> public object GetScalarByXmlTemplate(string xmlTemplateName, MReceiptFundRecord vo) { return(dbAccess.GetScalarByTemplate(xmlTemplateName, vo)); }
/// <summary> /// 根据主键值修改实体数据 /// </summary> /// <param name="vo">实体数据</param> /// <returns></returns> public bool Update(MReceiptFundRecord vo) { return(dbAccess.Update(vo)); }
/// <summary> /// 添加新数据 /// </summary> /// <param name="vo">实体数据</param> /// <returns></returns> public bool CreateNew(MReceiptFundRecord vo) { return(dbAccess.CreateNew(vo)); }
/// <summary> /// 获取分页数据集 /// </summary> /// <param name="query">查询条件</param> /// <param name="pageSize">分页</param> /// <param name="pageIndex">页索引从1开始</param> /// <param name="totalCount">总条数</param> /// <param name="orderBy">排序字段</param> /// <param name="mmode">字符串匹配模式 Exact:精确匹配 Vague:模糊匹配</param> /// <param name="cmode">条件连接字符串 And 或 OR</param> /// <returns></returns> public DataSet GetPagerDataSet(MReceiptFundRecord query, int pageSize, int pageIndex, out int totalCount, string orderBy = "", MatchMode mmode = MatchMode.Exact, ConnectMode cmode = ConnectMode.And) { totalCount = dbAccess.GetCount(query, mmode, cmode); return(dbAccess.GetPagerData(query, pageSize, pageIndex, orderBy, mmode, cmode)); }
/// <summary> /// 提现 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool Draw(MReceiptFundRecord model) { return(handler.Draw(model)); }
/// <summary> /// 获取指定条件的记录总数 /// </summary> /// <param name="query">查询条件</param> /// <param name="mmode">字符串匹配模式 Exact:精确匹配 Vague:模糊匹配</param> /// <param name="cmode">条件连接字符串 And 或 OR</param> /// <returns></returns> public int GetCount(MReceiptFundRecord query, MatchMode mmode = MatchMode.Exact, ConnectMode cmode = ConnectMode.And) { return(dbAccess.GetCount(query, mmode, cmode)); }
/// <summary> /// 保存实体数据 /// </summary> /// <param name="id">主键编号</param> /// <param name="entity">实体数据</param> /// <returns></returns> public IResult Save(string id, MReceiptFundRecord entity) { return(handler.Save(id, entity)); }