tijian_jichuang/Code/SOH.BLL.Host/BasicBll.cs

74 lines
2.3 KiB
C#
Raw Normal View History

2025-02-20 11:54:48 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EAS.Data;
using EAS.Services;
using SOH.Entities;
using EAS.Data.Access;
namespace SOH.BLL
{
[ServiceObject("基本业务功能")]
[ServiceBind(typeof(IBasic))]
public class BasicBll : IBasic
{
public int GetMax(string tablename, int needcount)
{
//throw new NotImplementedException();
using (DbEntities db = new DbEntities())
{
ParameterCollection pc = new ParameterCollection();
pc.Add("tablename", tablename);
pc.Add("needcount", needcount);
return (int)db.DataAccessor.Query("exec GetIdentity @tablename=?,@needcount=?", pc);
}
}
/// <summary>
/// 获取条码号
/// </summary>
/// <param name="fddm">分店代码</param>
/// <param name="grortt">团体个人1团体0个人</param>
/// <param name="needcount">需要数量</param>
/// <returns></returns>
public int gettmh(int fddm, int grortt, int needcount)
{
string key = "tm_" + fddm.ToString();
int val = GetMax(key, needcount);
string vals = (grortt == 1 ? "1" : "0") + fddm.ToString("00") + val.ToString("0000000");
//if(fddm==2)
//{
// vals = (grortt == 1 ? "1" : "2") + fddm.ToString("00") + val.ToString("0000000");
//}
return int.Parse(vals);
}
/// <summary>
/// 获取会员号
/// </summary>
/// <param name="fddm">分店代码</param>
/// <param name="needcount">需要数量</param>
/// <returns></returns>
public int gethyh(int fddm, int needcount)
{
string key = "hy_" + fddm.ToString();
int val = GetMax(key, needcount);
string vals = fddm.ToString("000") + val.ToString("0000000");
return int.Parse(vals);
}
public List<lis_jydl> GetAlljydl()
{
using (DbEntities db = new DbEntities())
{
return db.list_jydls.OrderBy(l=>l.lisdl).ToList();
//list = list.OrderBy(l => l.time)
//return null;
}
}
}
}