Example #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(KryptonAccessController.AccessDataBase.Model.EventStandardOperateProcedureGroup model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update EventStandardOperateProcedureGroup set ");
            strSql.Append("EventSOPGName=@EventSOPGName,");
            strSql.Append("EventSOPGEnable=@EventSOPGEnable,");
            strSql.Append("PointType=@PointType,");
            strSql.Append("PointID=@PointID,");
            strSql.Append("EventCodeID=@EventCodeID,");
            strSql.Append("SOPID=@SOPID");
            strSql.Append(" where EventSOPGID=@EventSOPGID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@EventSOPGName",   SqlDbType.NVarChar, 50),
                new SqlParameter("@EventSOPGEnable", SqlDbType.Bit,       1),
                new SqlParameter("@PointType",       SqlDbType.Int,       4),
                new SqlParameter("@PointID",         SqlDbType.Int,       4),
                new SqlParameter("@EventCodeID",     SqlDbType.Int,       4),
                new SqlParameter("@SOPID",           SqlDbType.Int,       4),
                new SqlParameter("@EventSOPGID",     SqlDbType.Int, 4)
            };
            parameters[0].Value = model.EventSOPGName;
            parameters[1].Value = model.EventSOPGEnable;
            parameters[2].Value = model.PointType;
            parameters[3].Value = model.PointID;
            parameters[4].Value = model.EventCodeID;
            parameters[5].Value = model.SOPID;
            parameters[6].Value = model.EventSOPGID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.AccessDataBase.Model.EventStandardOperateProcedureGroup DataRowToModel(DataRow row)
 {
     KryptonAccessController.AccessDataBase.Model.EventStandardOperateProcedureGroup model=new KryptonAccessController.AccessDataBase.Model.EventStandardOperateProcedureGroup();
     if (row != null)
     {
         if(row["EventSOPGID"]!=null && row["EventSOPGID"].ToString()!="")
         {
             model.EventSOPGID=int.Parse(row["EventSOPGID"].ToString());
         }
         if(row["EventSOPGName"]!=null)
         {
             model.EventSOPGName=row["EventSOPGName"].ToString();
         }
         if(row["EventSOPGEnable"]!=null && row["EventSOPGEnable"].ToString()!="")
         {
             if((row["EventSOPGEnable"].ToString()=="1")||(row["EventSOPGEnable"].ToString().ToLower()=="true"))
             {
                 model.EventSOPGEnable=true;
             }
             else
             {
                 model.EventSOPGEnable=false;
             }
         }
         if(row["PointType"]!=null && row["PointType"].ToString()!="")
         {
             model.PointType=int.Parse(row["PointType"].ToString());
         }
         if(row["PointID"]!=null && row["PointID"].ToString()!="")
         {
             model.PointID=int.Parse(row["PointID"].ToString());
         }
         if(row["EventCodeID"]!=null && row["EventCodeID"].ToString()!="")
         {
             model.EventCodeID=int.Parse(row["EventCodeID"].ToString());
         }
         if(row["SOPID"]!=null && row["SOPID"].ToString()!="")
         {
             model.SOPID=int.Parse(row["SOPID"].ToString());
         }
     }
     return model;
 }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KryptonAccessController.AccessDataBase.Model.EventStandardOperateProcedureGroup GetModel(int EventSOPGID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 EventSOPGID,EventSOPGName,EventSOPGEnable,PointType,PointID,EventCodeID,SOPID from EventStandardOperateProcedureGroup ");
            strSql.Append(" where EventSOPGID=@EventSOPGID ");
            SqlParameter[] parameters = {
                    new SqlParameter("@EventSOPGID", SqlDbType.Int,4)			};
            parameters[0].Value = EventSOPGID;

            KryptonAccessController.AccessDataBase.Model.EventStandardOperateProcedureGroup model=new KryptonAccessController.AccessDataBase.Model.EventStandardOperateProcedureGroup();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }
Example #4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.AccessDataBase.Model.EventStandardOperateProcedureGroup DataRowToModel(DataRow row)
 {
     KryptonAccessController.AccessDataBase.Model.EventStandardOperateProcedureGroup model = new KryptonAccessController.AccessDataBase.Model.EventStandardOperateProcedureGroup();
     if (row != null)
     {
         if (row["EventSOPGID"] != null && row["EventSOPGID"].ToString() != "")
         {
             model.EventSOPGID = int.Parse(row["EventSOPGID"].ToString());
         }
         if (row["EventSOPGName"] != null)
         {
             model.EventSOPGName = row["EventSOPGName"].ToString();
         }
         if (row["EventSOPGEnable"] != null && row["EventSOPGEnable"].ToString() != "")
         {
             if ((row["EventSOPGEnable"].ToString() == "1") || (row["EventSOPGEnable"].ToString().ToLower() == "true"))
             {
                 model.EventSOPGEnable = true;
             }
             else
             {
                 model.EventSOPGEnable = false;
             }
         }
         if (row["PointType"] != null && row["PointType"].ToString() != "")
         {
             model.PointType = int.Parse(row["PointType"].ToString());
         }
         if (row["PointID"] != null && row["PointID"].ToString() != "")
         {
             model.PointID = int.Parse(row["PointID"].ToString());
         }
         if (row["EventCodeID"] != null && row["EventCodeID"].ToString() != "")
         {
             model.EventCodeID = int.Parse(row["EventCodeID"].ToString());
         }
         if (row["SOPID"] != null && row["SOPID"].ToString() != "")
         {
             model.SOPID = int.Parse(row["SOPID"].ToString());
         }
     }
     return(model);
 }
Example #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KryptonAccessController.AccessDataBase.Model.EventStandardOperateProcedureGroup GetModel(int EventSOPGID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 EventSOPGID,EventSOPGName,EventSOPGEnable,PointType,PointID,EventCodeID,SOPID from EventStandardOperateProcedureGroup ");
            strSql.Append(" where EventSOPGID=@EventSOPGID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@EventSOPGID", SqlDbType.Int, 4)
            };
            parameters[0].Value = EventSOPGID;

            KryptonAccessController.AccessDataBase.Model.EventStandardOperateProcedureGroup model = new KryptonAccessController.AccessDataBase.Model.EventStandardOperateProcedureGroup();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }