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

            strSql.Append("insert into SMT_FACE_RECORD(");
            strSql.Append("FACEDEV_ID,FREC_SRC_ID,FREC_TIME,FREC_STAFF_NAME,FREC_VIDEO_IMAGE,FREC_FACE_IMAGE,FREC_FACE_LEVEL,FREC_AUTHORITY,FREC_STAFF_NO,FREC_STAFF_TYPE,FREC_PARAM3,FREC_PARAM4,FREC_STAFF_ID)");
            strSql.Append(" values (");
            strSql.Append("@FACEDEV_ID,@FREC_SRC_ID,@FREC_TIME,@FREC_STAFF_NAME,@FREC_VIDEO_IMAGE,@FREC_FACE_IMAGE,@FREC_FACE_LEVEL,@FREC_AUTHORITY,@FREC_STAFF_NO,@FREC_STAFF_TYPE,@FREC_PARAM3,@FREC_PARAM4,@FREC_STAFF_ID)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@FACEDEV_ID",       SqlDbType.Decimal,     9),
                new SqlParameter("@FREC_SRC_ID",      SqlDbType.NVarChar,  300),
                new SqlParameter("@FREC_TIME",        SqlDbType.DateTime),
                new SqlParameter("@FREC_STAFF_NAME",  SqlDbType.NVarChar,  100),
                new SqlParameter("@FREC_VIDEO_IMAGE", SqlDbType.Image),
                new SqlParameter("@FREC_FACE_IMAGE",  SqlDbType.Image),
                new SqlParameter("@FREC_FACE_LEVEL",  SqlDbType.Decimal,     5),
                new SqlParameter("@FREC_AUTHORITY",   SqlDbType.NVarChar,    8),
                new SqlParameter("@FREC_STAFF_NO",    SqlDbType.NVarChar,   80),
                new SqlParameter("@FREC_STAFF_TYPE",  SqlDbType.NVarChar,   80),
                new SqlParameter("@FREC_PARAM3",      SqlDbType.NVarChar,   80),
                new SqlParameter("@FREC_PARAM4",      SqlDbType.NVarChar,   80),
                new SqlParameter("@FREC_STAFF_ID",    SqlDbType.Decimal, 9)
            };
            parameters[0].Value  = model.FACEDEV_ID;
            parameters[1].Value  = model.FREC_SRC_ID;
            parameters[2].Value  = model.FREC_TIME;
            parameters[3].Value  = model.FREC_STAFF_NAME;
            parameters[4].Value  = model.FREC_VIDEO_IMAGE;
            parameters[5].Value  = model.FREC_FACE_IMAGE;
            parameters[6].Value  = model.FREC_FACE_LEVEL;
            parameters[7].Value  = model.FREC_AUTHORITY;
            parameters[8].Value  = model.FREC_STAFF_NO;
            parameters[9].Value  = model.FREC_STAFF_TYPE;
            parameters[10].Value = model.FREC_PARAM3;
            parameters[11].Value = model.FREC_PARAM4;
            parameters[12].Value = model.FREC_STAFF_ID;

            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.SMT_FACE_RECORD GetModel(decimal ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,FACEDEV_ID,FREC_SRC_ID,FREC_TIME,FREC_STAFF_NAME,FREC_VIDEO_IMAGE,FREC_FACE_IMAGE,FREC_FACE_LEVEL,FREC_AUTHORITY,FREC_STAFF_NO,FREC_STAFF_TYPE,FREC_PARAM3,FREC_PARAM4,FREC_STAFF_ID from SMT_FACE_RECORD ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Decimal)
            };
            parameters[0].Value = ID;

            Maticsoft.Model.SMT_FACE_RECORD model = new Maticsoft.Model.SMT_FACE_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
        //保存记录
        public void SaveRecord(decimal ctrlrId, List <Maticsoft.Model.BST.staff_log> records)
        {
            try
            {
                Dictionary <string, Maticsoft.Model.SMT_STAFF_FACEDEV> staffDevDic = new Dictionary <string, Maticsoft.Model.SMT_STAFF_FACEDEV>();
                Maticsoft.BLL.SMT_FACE_RECORD bllRecord = new Maticsoft.BLL.SMT_FACE_RECORD();
                foreach (var record in records)
                {
                    string strTime    = record.id.Substring(0, "2018/09/23_22:48:39".Length);
                    string staffdevId = record.id.Substring("2018/09/23_22:48:39".Length + 1);
                    Maticsoft.Model.SMT_STAFF_FACEDEV sfmodel = null;
                    if (staffDevDic.ContainsKey(staffdevId))
                    {
                        sfmodel = staffDevDic[staffdevId];
                    }
                    else
                    {
                        Maticsoft.BLL.SMT_STAFF_FACEDEV          ssfbll    = new Maticsoft.BLL.SMT_STAFF_FACEDEV();
                        List <Maticsoft.Model.SMT_STAFF_FACEDEV> modelSFDs = ssfbll.GetModelList("STAFF_DEV_ID='" + staffdevId + "'");
                        if (modelSFDs.Count == 0)
                        {
                            log.Warn("无此ID:" + staffdevId + " 授权注册!");
                            continue;
                        }
                        sfmodel = modelSFDs[0];
                        Maticsoft.BLL.SMT_STAFF_INFO sbll = new Maticsoft.BLL.SMT_STAFF_INFO();
                        sfmodel.STAFF_INFO = sbll.GetModel(sfmodel.STAFF_ID);
                        staffDevDic.Add(staffdevId, sfmodel);
                    }
                    Maticsoft.Model.SMT_FACE_RECORD modelRecord = new Maticsoft.Model.SMT_FACE_RECORD();
                    modelRecord.FACEDEV_ID      = ctrlrId;
                    modelRecord.FREC_AUTHORITY  = record.authority;
                    modelRecord.FREC_FACE_IMAGE = record.imagesql;
                    double dec = 0.8;
                    double.TryParse(record.info, out dec);
                    modelRecord.FREC_FACE_LEVEL  = (decimal)dec;
                    modelRecord.FREC_VIDEO_IMAGE = record.imagevideo;
                    DateTime now = DateTime.Now;
                    DateTime.TryParse(strTime.Replace("_", " "), out now);
                    modelRecord.FREC_TIME     = now;
                    modelRecord.ID            = -1;
                    modelRecord.FREC_PARAM3   = record.data_keepon3;
                    modelRecord.FREC_PARAM4   = record.data_keepon4;
                    modelRecord.FREC_SRC_ID   = record.id;
                    modelRecord.FREC_STAFF_ID = sfmodel.STAFF_ID;
                    if (sfmodel.STAFF_INFO == null)
                    {
                        modelRecord.FREC_STAFF_NAME = record.name;
                        modelRecord.FREC_STAFF_NO   = record.data_keepon1;
                        modelRecord.FREC_STAFF_TYPE = record.data_keepon4;
                    }
                    else
                    {
                        modelRecord.FREC_STAFF_NAME = sfmodel.STAFF_INFO.REAL_NAME;
                        modelRecord.FREC_STAFF_NO   = sfmodel.STAFF_INFO.STAFF_NO;
                        modelRecord.FREC_STAFF_TYPE = sfmodel.STAFF_INFO.STAFF_TYPE;
                    }

                    bllRecord.Add(modelRecord);
                }
            }
            catch (Exception ex)
            {
                log.Error("记录保存失败:CTRLID=" + ctrlrId, ex);
                throw ex;
            }
        }
Esempio n. 4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.SMT_FACE_RECORD DataRowToModel(DataRow row)
 {
     Maticsoft.Model.SMT_FACE_RECORD model = new Maticsoft.Model.SMT_FACE_RECORD();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = decimal.Parse(row["ID"].ToString());
         }
         if (row["FACEDEV_ID"] != null && row["FACEDEV_ID"].ToString() != "")
         {
             model.FACEDEV_ID = decimal.Parse(row["FACEDEV_ID"].ToString());
         }
         if (row["FREC_SRC_ID"] != null)
         {
             model.FREC_SRC_ID = row["FREC_SRC_ID"].ToString();
         }
         if (row["FREC_TIME"] != null && row["FREC_TIME"].ToString() != "")
         {
             model.FREC_TIME = DateTime.Parse(row["FREC_TIME"].ToString());
         }
         if (row["FREC_STAFF_NAME"] != null)
         {
             model.FREC_STAFF_NAME = row["FREC_STAFF_NAME"].ToString();
         }
         if (row["FREC_VIDEO_IMAGE"] != null && row["FREC_VIDEO_IMAGE"].ToString() != "")
         {
             model.FREC_VIDEO_IMAGE = (byte[])row["FREC_VIDEO_IMAGE"];
         }
         if (row["FREC_FACE_IMAGE"] != null && row["FREC_FACE_IMAGE"].ToString() != "")
         {
             model.FREC_FACE_IMAGE = (byte[])row["FREC_FACE_IMAGE"];
         }
         if (row["FREC_FACE_LEVEL"] != null && row["FREC_FACE_LEVEL"].ToString() != "")
         {
             model.FREC_FACE_LEVEL = decimal.Parse(row["FREC_FACE_LEVEL"].ToString());
         }
         if (row["FREC_AUTHORITY"] != null)
         {
             model.FREC_AUTHORITY = row["FREC_AUTHORITY"].ToString();
         }
         if (row["FREC_STAFF_NO"] != null)
         {
             model.FREC_STAFF_NO = row["FREC_STAFF_NO"].ToString();
         }
         if (row["FREC_STAFF_TYPE"] != null)
         {
             model.FREC_STAFF_TYPE = row["FREC_STAFF_TYPE"].ToString();
         }
         if (row["FREC_PARAM3"] != null)
         {
             model.FREC_PARAM3 = row["FREC_PARAM3"].ToString();
         }
         if (row["FREC_PARAM4"] != null)
         {
             model.FREC_PARAM4 = row["FREC_PARAM4"].ToString();
         }
         if (row["FREC_STAFF_ID"] != null && row["FREC_STAFF_ID"].ToString() != "")
         {
             model.FREC_STAFF_ID = decimal.Parse(row["FREC_STAFF_ID"].ToString());
         }
     }
     return(model);
 }
Esempio n. 5
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.SMT_FACE_RECORD model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update SMT_FACE_RECORD set ");
            strSql.Append("FACEDEV_ID=@FACEDEV_ID,");
            strSql.Append("FREC_SRC_ID=@FREC_SRC_ID,");
            strSql.Append("FREC_TIME=@FREC_TIME,");
            strSql.Append("FREC_STAFF_NAME=@FREC_STAFF_NAME,");
            strSql.Append("FREC_VIDEO_IMAGE=@FREC_VIDEO_IMAGE,");
            strSql.Append("FREC_FACE_IMAGE=@FREC_FACE_IMAGE,");
            strSql.Append("FREC_FACE_LEVEL=@FREC_FACE_LEVEL,");
            strSql.Append("FREC_AUTHORITY=@FREC_AUTHORITY,");
            strSql.Append("FREC_STAFF_NO=@FREC_STAFF_NO,");
            strSql.Append("FREC_STAFF_TYPE=@FREC_STAFF_TYPE,");
            strSql.Append("FREC_PARAM3=@FREC_PARAM3,");
            strSql.Append("FREC_PARAM4=@FREC_PARAM4,");
            strSql.Append("FREC_STAFF_ID=@FREC_STAFF_ID");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@FACEDEV_ID",       SqlDbType.Decimal,     9),
                new SqlParameter("@FREC_SRC_ID",      SqlDbType.NVarChar,  300),
                new SqlParameter("@FREC_TIME",        SqlDbType.DateTime),
                new SqlParameter("@FREC_STAFF_NAME",  SqlDbType.NVarChar,  100),
                new SqlParameter("@FREC_VIDEO_IMAGE", SqlDbType.Image),
                new SqlParameter("@FREC_FACE_IMAGE",  SqlDbType.Image),
                new SqlParameter("@FREC_FACE_LEVEL",  SqlDbType.Decimal,     5),
                new SqlParameter("@FREC_AUTHORITY",   SqlDbType.NVarChar,    8),
                new SqlParameter("@FREC_STAFF_NO",    SqlDbType.NVarChar,   80),
                new SqlParameter("@FREC_STAFF_TYPE",  SqlDbType.NVarChar,   80),
                new SqlParameter("@FREC_PARAM3",      SqlDbType.NVarChar,   80),
                new SqlParameter("@FREC_PARAM4",      SqlDbType.NVarChar,   80),
                new SqlParameter("@FREC_STAFF_ID",    SqlDbType.Decimal,     9),
                new SqlParameter("@ID",               SqlDbType.Decimal, 9)
            };
            parameters[0].Value  = model.FACEDEV_ID;
            parameters[1].Value  = model.FREC_SRC_ID;
            parameters[2].Value  = model.FREC_TIME;
            parameters[3].Value  = model.FREC_STAFF_NAME;
            parameters[4].Value  = model.FREC_VIDEO_IMAGE;
            parameters[5].Value  = model.FREC_FACE_IMAGE;
            parameters[6].Value  = model.FREC_FACE_LEVEL;
            parameters[7].Value  = model.FREC_AUTHORITY;
            parameters[8].Value  = model.FREC_STAFF_NO;
            parameters[9].Value  = model.FREC_STAFF_TYPE;
            parameters[10].Value = model.FREC_PARAM3;
            parameters[11].Value = model.FREC_PARAM4;
            parameters[12].Value = model.FREC_STAFF_ID;
            parameters[13].Value = model.ID;

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

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