Esempio n. 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public decimal Add(Maticsoft.Model.IMS_PEOPLE_RECORD model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into IMS_PEOPLE_RECORD(");
            strSql.Append("CardType,CardNo,Name,Depart,AccessChannel,ThroughForward,ThroughTime,ThroughResult,CapturePic,OriginPic,CompareResult,Similarity,FacePosition)");
            strSql.Append(" values (");
            strSql.Append("@CardType,@CardNo,@Name,@Depart,@AccessChannel,@ThroughForward,@ThroughTime,@ThroughResult,@CapturePic,@OriginPic,@CompareResult,@Similarity,@FacePosition)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CardType",       SqlDbType.TinyInt,     1),
                new SqlParameter("@CardNo",         SqlDbType.VarChar,   100),
                new SqlParameter("@Name",           SqlDbType.NVarChar,  100),
                new SqlParameter("@Depart",         SqlDbType.NVarChar,  100),
                new SqlParameter("@AccessChannel",  SqlDbType.NVarChar,  100),
                new SqlParameter("@ThroughForward", SqlDbType.TinyInt,     1),
                new SqlParameter("@ThroughTime",    SqlDbType.DateTime),
                new SqlParameter("@ThroughResult",  SqlDbType.TinyInt,     1),
                new SqlParameter("@CapturePic",     SqlDbType.VarChar,   500),
                new SqlParameter("@OriginPic",      SqlDbType.VarChar,   500),
                new SqlParameter("@CompareResult",  SqlDbType.TinyInt,     1),
                new SqlParameter("@Similarity",     SqlDbType.Decimal,     9),
                new SqlParameter("@FacePosition",   SqlDbType.NVarChar, 100)
            };
            parameters[0].Value  = model.CardType;
            parameters[1].Value  = model.CardNo;
            parameters[2].Value  = model.Name;
            parameters[3].Value  = model.Depart;
            parameters[4].Value  = model.AccessChannel;
            parameters[5].Value  = model.ThroughForward;
            parameters[6].Value  = model.ThroughTime;
            parameters[7].Value  = model.ThroughResult;
            parameters[8].Value  = model.CapturePic;
            parameters[9].Value  = model.OriginPic;
            parameters[10].Value = model.CompareResult;
            parameters[11].Value = model.Similarity;
            parameters[12].Value = model.FacePosition;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToDecimal(obj));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.IMS_PEOPLE_RECORD GetModel(decimal ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,CardType,CardNo,Name,Depart,AccessChannel,ThroughForward,ThroughTime,ThroughResult,CapturePic,OriginPic,CompareResult,Similarity,FacePosition from IMS_PEOPLE_RECORD ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Decimal)
            };
            parameters[0].Value = ID;

            Maticsoft.Model.IMS_PEOPLE_RECORD model = new Maticsoft.Model.IMS_PEOPLE_RECORD();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.IMS_PEOPLE_RECORD DataRowToModel(DataRow row)
 {
     Maticsoft.Model.IMS_PEOPLE_RECORD model = new Maticsoft.Model.IMS_PEOPLE_RECORD();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = decimal.Parse(row["ID"].ToString());
         }
         if (row["CardType"] != null && row["CardType"].ToString() != "")
         {
             model.CardType = int.Parse(row["CardType"].ToString());
         }
         if (row["CardNo"] != null)
         {
             model.CardNo = row["CardNo"].ToString();
         }
         if (row["Name"] != null)
         {
             model.Name = row["Name"].ToString();
         }
         if (row["Depart"] != null)
         {
             model.Depart = row["Depart"].ToString();
         }
         if (row["AccessChannel"] != null)
         {
             model.AccessChannel = row["AccessChannel"].ToString();
         }
         if (row["ThroughForward"] != null && row["ThroughForward"].ToString() != "")
         {
             model.ThroughForward = int.Parse(row["ThroughForward"].ToString());
         }
         if (row["ThroughTime"] != null && row["ThroughTime"].ToString() != "")
         {
             model.ThroughTime = DateTime.Parse(row["ThroughTime"].ToString());
         }
         if (row["ThroughResult"] != null && row["ThroughResult"].ToString() != "")
         {
             model.ThroughResult = int.Parse(row["ThroughResult"].ToString());
         }
         if (row["CapturePic"] != null)
         {
             model.CapturePic = row["CapturePic"].ToString();
         }
         if (row["OriginPic"] != null)
         {
             model.OriginPic = row["OriginPic"].ToString();
         }
         if (row["CompareResult"] != null && row["CompareResult"].ToString() != "")
         {
             model.CompareResult = int.Parse(row["CompareResult"].ToString());
         }
         if (row["Similarity"] != null && row["Similarity"].ToString() != "")
         {
             model.Similarity = decimal.Parse(row["Similarity"].ToString());
         }
         if (row["FacePosition"] != null)
         {
             model.FacePosition = row["FacePosition"].ToString();
         }
     }
     return(model);
 }
Esempio n. 4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.IMS_PEOPLE_RECORD model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update IMS_PEOPLE_RECORD set ");
            strSql.Append("CardType=@CardType,");
            strSql.Append("CardNo=@CardNo,");
            strSql.Append("Name=@Name,");
            strSql.Append("Depart=@Depart,");
            strSql.Append("AccessChannel=@AccessChannel,");
            strSql.Append("ThroughForward=@ThroughForward,");
            strSql.Append("ThroughTime=@ThroughTime,");
            strSql.Append("ThroughResult=@ThroughResult,");
            strSql.Append("CapturePic=@CapturePic,");
            strSql.Append("OriginPic=@OriginPic,");
            strSql.Append("CompareResult=@CompareResult,");
            strSql.Append("Similarity=@Similarity,");
            strSql.Append("FacePosition=@FacePosition");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CardType",       SqlDbType.TinyInt,     1),
                new SqlParameter("@CardNo",         SqlDbType.VarChar,   100),
                new SqlParameter("@Name",           SqlDbType.NVarChar,  100),
                new SqlParameter("@Depart",         SqlDbType.NVarChar,  100),
                new SqlParameter("@AccessChannel",  SqlDbType.NVarChar,  100),
                new SqlParameter("@ThroughForward", SqlDbType.TinyInt,     1),
                new SqlParameter("@ThroughTime",    SqlDbType.DateTime),
                new SqlParameter("@ThroughResult",  SqlDbType.TinyInt,     1),
                new SqlParameter("@CapturePic",     SqlDbType.VarChar,   500),
                new SqlParameter("@OriginPic",      SqlDbType.VarChar,   500),
                new SqlParameter("@CompareResult",  SqlDbType.TinyInt,     1),
                new SqlParameter("@Similarity",     SqlDbType.Decimal,     9),
                new SqlParameter("@FacePosition",   SqlDbType.NVarChar,  100),
                new SqlParameter("@ID",             SqlDbType.Decimal, 9)
            };
            parameters[0].Value  = model.CardType;
            parameters[1].Value  = model.CardNo;
            parameters[2].Value  = model.Name;
            parameters[3].Value  = model.Depart;
            parameters[4].Value  = model.AccessChannel;
            parameters[5].Value  = model.ThroughForward;
            parameters[6].Value  = model.ThroughTime;
            parameters[7].Value  = model.ThroughResult;
            parameters[8].Value  = model.CapturePic;
            parameters[9].Value  = model.OriginPic;
            parameters[10].Value = model.CompareResult;
            parameters[11].Value = model.Similarity;
            parameters[12].Value = model.FacePosition;
            parameters[13].Value = model.ID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }