180 lines
6.1 KiB
C#
180 lines
6.1 KiB
C#
namespace BLL
|
|
{
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Data.Linq;
|
|
using System.Web.Security;
|
|
using System.Web.UI.WebControls;
|
|
using Model;
|
|
|
|
/// <summary>
|
|
/// 保管员信息
|
|
/// </summary>
|
|
public static class StoremanInfoService
|
|
{
|
|
/// <summary>
|
|
/// 根据主键获取保管员信息
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
public static Model.Weld_Storeman GetStoremanById(string id)
|
|
{
|
|
return Funs.DB.Weld_Storeman.FirstOrDefault(e => e.StoremanId == id);
|
|
}
|
|
|
|
public static Model.Weld_Storeman GetStoremanByUserId(string userId)
|
|
{
|
|
return Funs.DB.Weld_Storeman.FirstOrDefault(e => e.UserId == userId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加保管员信息
|
|
/// </summary>
|
|
/// <param name="storeMan"></param>
|
|
public static void AddStoreMan(Model.Weld_Storeman storeMan)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.Weld_Storeman newStoreman = new Model.Weld_Storeman();
|
|
newStoreman.StoremanId = storeMan.StoremanId;
|
|
newStoreman.StoreCode = storeMan.StoreCode;
|
|
newStoreman.StoreName = storeMan.StoreName;
|
|
newStoreman.UserId = storeMan.UserId;
|
|
db.Weld_Storeman.InsertOnSubmit(newStoreman);
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改保管员信息
|
|
/// </summary>
|
|
/// <param name="storeMan"></param>
|
|
public static void UpdateStoreMan(Model.Weld_Storeman storeMan)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.Weld_Storeman newStoreman = db.Weld_Storeman.FirstOrDefault(e => e.StoremanId == storeMan.StoremanId);
|
|
if (newStoreman != null)
|
|
{
|
|
newStoreman.StoreCode = storeMan.StoreCode;
|
|
newStoreman.StoreName = storeMan.StoreName;
|
|
// newStoreman.UserId = storeMan.UserId;
|
|
newStoreman.IdentityCard = storeMan.IdentityCard;
|
|
newStoreman.SignatureUrl = storeMan.SignatureUrl;
|
|
//newStoreman.MyFinger = storeMan.MyFinger;
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键删除保管员信息
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
public static void DeleteStoreManById(string id)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.Weld_Storeman storeMan = db.Weld_Storeman.FirstOrDefault(e => e.StoremanId == id);
|
|
if (storeMan!=null)
|
|
{
|
|
db.Weld_Storeman.DeleteOnSubmit(storeMan);
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 登记保管员指纹信息
|
|
/// </summary>
|
|
/// <param name="teamGroup"></param>
|
|
public static void StoremanFinger(string storemanId, string myFinger)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.Weld_Storeman newStoreman = db.Weld_Storeman.FirstOrDefault(e => e.StoremanId == storemanId);
|
|
if (newStoreman != null)
|
|
{
|
|
newStoreman.MyFinger = myFinger;
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 验证代号是否存在
|
|
/// </summary>
|
|
/// <param name="code"></param>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
public static bool IsExitStoreName(string name, string id)
|
|
{
|
|
var q = Funs.DB.Weld_Storeman.FirstOrDefault(x => x.StoreName == name && x.StoremanId != id);
|
|
if (q != null)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取保管员列表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static ListItem[] GetStoremanList()
|
|
{
|
|
var q = (from x in Funs.DB.Weld_Storeman orderby x.StoreCode select x).ToList(); // where x.MyFinger != null 这个条件这里暂不用
|
|
ListItem[] lis = new ListItem[q.Count()];
|
|
|
|
for (int i = 0; i < q.Count(); i++)
|
|
{
|
|
lis[i] = new ListItem(q[i].StoreName ?? "", q[i].StoremanId.ToString());
|
|
}
|
|
|
|
return lis;
|
|
}
|
|
|
|
public static ListItem[] GetStoremanList(string projectId, string unitId)
|
|
{
|
|
var q = (from x in Funs.DB.Project_User
|
|
join y in Funs.DB.Sys_User on x.UserId equals y.UserId
|
|
where x.ProjectId == projectId && y.UnitId == unitId
|
|
&& x.RoleId == Const.StoreManRole
|
|
select new { x.UserId,y.UserName}).ToList();
|
|
ListItem[] lis = new ListItem[q.Count()];
|
|
|
|
for (int i = 0; i < q.Count(); i++)
|
|
{
|
|
lis[i] = new ListItem(q[i].UserName ?? "", q[i].UserId.ToString());
|
|
}
|
|
|
|
return lis;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据身份证号码id查询保管员信息
|
|
/// </summary>
|
|
/// <param name="groupId"></param>
|
|
/// <returns></returns>
|
|
public static Model.Weld_Storeman GetStoremanByIdentityCard(string identityCard)
|
|
{
|
|
return Funs.DB.Weld_Storeman.FirstOrDefault(e => e.IdentityCard == identityCard);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改保管员是否已人脸训练
|
|
/// </summary>
|
|
/// <param name="storeman"></param>
|
|
public static void UpdateStoreManIsFaceTrain(Weld_Storeman storeman)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.Weld_Storeman newStoreman = db.Weld_Storeman.FirstOrDefault(e => e.StoremanId == storeman.StoremanId);
|
|
if (newStoreman!=null)
|
|
{
|
|
newStoreman.IsFaceTrain = storeman.IsFaceTrain;
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
}
|