ZHJA_HJGL/HJGL_ZH/FineUIPro.Web/FingerMark/AddFinger.aspx.cs

131 lines
5.0 KiB
C#
Raw Permalink Normal View History

2024-05-08 17:17:11 +08:00
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
namespace FineUIPro.Web.FingerMark
{
public partial class AddFinger : System.Web.UI.Page
{
protected string RegisterTemplate = "";
protected string NumFinger = "";
protected string userId = "";
protected string username = "";//接收用户名
protected string flag = "";
protected string[] NumId = new String[10];//第n根手指
protected string[] fingers = new String[10];//注册指纹模板
protected string result = "";//提示信息
protected int isExit = 0;//
protected StreamReader SR;
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Form["userId"].Trim() != null)//判断页面请求用户名是否为空
{
userId = Request.Form["userId"].Trim();
}
if (Request.Form["username"].Trim() != null) //用户名
{
username = Request.Form["username"].Trim();
}
if (Request.Form["flag"].Trim() != null) //标记1-焊工2-保管员
{
flag = Request.Form["flag"].Trim();
}
if (Request.Form["hiddenObj"] != null)//判断页面请求指纹模板是否为空
{
RegisterTemplate = Request.Form["hiddenObj"];
}
if (Request.Form["finghidden"] != null) //判断页面请求手指id是否为空
{
NumFinger = Request.Form["finghidden"];
}
NumId = NumFinger.Split(',');//将获取的手指id分割成数组存入NumId
fingers = RegisterTemplate.Split(',');//将获取的指纹模板分割成数组存入fingers
string myFinger = string.Empty;
if (flag == "1")
{
//var welder = BLL.HJGL_PersonManageService.GetBSWelderByTeamWEDID(userId);
//myFinger = welder.MyFinger;
string strSql = "SELECT MyFinger FROM dbo.HJGL_BS_Welder WHERE WED_ID=@WED_ID";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@WED_ID", userId));
SqlParameter[] parameter = listStr.ToArray();
myFinger = BLL.SQLHelper.getStr(strSql, parameter);
if (myFinger != null && myFinger != "")
{
string[] tmpGroup = myFinger.Split('@');
for (int n = 0; n < tmpGroup.Length; n++)
{
if (tmpGroup[n].Substring(tmpGroup[n].IndexOf('#') + 1, 1).Equals(NumId[0]))//在用户名相同的情况下判断用户登记的手指是否相同
{
isExit = 1;
}
}
}
}
else
{
//var storeman = BLL.StoremanInfoService.GetStoremanById(userId);
//myFinger = storeman.MyFinger;
string strSql = "SELECT MyFinger FROM dbo.Weld_Storeman WHERE StoremanId=@StoremanId";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@StoremanId", userId));
SqlParameter[] parameter = listStr.ToArray();
myFinger = BLL.SQLHelper.getStr(strSql, parameter);
if (myFinger != null && myFinger != "")
{
string[] tmpGroup = myFinger.Split('@');
for (int n = 0; n < tmpGroup.Length; n++)
{
if (tmpGroup[n].Substring(tmpGroup[n].IndexOf('#') + 1, 1).Equals(NumId[0]))//在用户名相同的情况下判断用户登记的手指是否相同
{
isExit = 1;
}
}
}
}
if (isExit == 1)
{
result = "该用户名的该指纹已经存在";
}
else
{
if(string.IsNullOrEmpty(myFinger))
{
myFinger = fingers[0] + "#" + NumId[0];
}
else
{
myFinger = myFinger + "@" + fingers[0] + "#" + NumId[0];
}
if (flag == "1")
{
BLL.HJGL_PersonManageService.WelderFinger(userId, myFinger);
}
else
{
BLL.StoremanInfoService.StoremanFinger(userId, myFinger);
}
result = "指纹已成功保存到服务器!";
}
}
}
}