12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Data;
- using System.Text.RegularExpressions;
- using MySystem.PxcModels;
- using Library;
- namespace MySystem
- {
- public class PublicFunction
- {
- public static decimal NumberFormat(decimal number, int floatCount = 2)
- {
- string str = number.ToString();
- if (str.Contains("."))
- {
- string[] list = str.Split('.');
- if (list[1].Length > floatCount)
- {
- str = list[0] + "." + list[1].Substring(0, floatCount);
- }
- }
- else
- {
- str += ".00";
- }
- return decimal.Parse(str);
- }
- public static string GetPublicParam(WebCMSEntities db, string Key)
- {
- CustomTagSet set = db.CustomTagSet.FirstOrDefault(m => m.Tags == Key);
- if(set != null)
- {
- return set.Contents;
- }
- return "";
- }
- #region 设置押金添加记录公共方法
- public static void MerchantDepositSet(int BrandId, int UserId, int SnId, string SnNo, int BeforeDeposit, decimal DepositAmount, string ReturnNote)
- {
- try
- {
- WebCMSEntities maindb = new WebCMSEntities();
- MerchantDepositSet query = maindb.MerchantDepositSet.Add(new MerchantDepositSet()
- {
- CreateDate = DateTime.Now, //创建时间
- Sort = BrandId,//品牌
- SeoTitle = BeforeDeposit.ToString(),//变更前押金
- DepositAmount = DepositAmount,//押金
- ReturnNote = ReturnNote,//返回信息
- SnNo = SnNo,//机具Sn
- UserId = UserId,//创客Id
- }).Entity;
- maindb.SaveChanges();
- }
- catch (Exception ex)
- {
- function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ":" + ex.ToString(), "设置押金队列异常");
- }
- }
- #endregion
- #region 发送分表数据
- public static void SplitTradeRecord(TradeRecord obj, string TradeMonth)
- {
- RedisDbconn.Instance.AddList("AddTradeRecordQueue", Newtonsoft.Json.JsonConvert.SerializeObject(obj) + "#cut#" + TradeMonth);
- }
- public static void SplitUserAccountRecord(UserAccountRecord obj, string TradeMonth)
- {
- RedisDbconn.Instance.AddList("AddUserAccountRecordQueue", Newtonsoft.Json.JsonConvert.SerializeObject(obj) + "#cut#" + TradeMonth);
- }
- #endregion
- }
- }
|