Пример #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(LumluxSSYDB.Model.tJurisdiction model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tJurisdiction set ");
            strSql.Append("sJurisdictionType=@sJurisdictionType,");
            strSql.Append("sJurisdictionContent=@sJurisdictionContent,");
            strSql.Append("sPrjectGUID=@sPrjectGUID,");
            strSql.Append("sDesc=@sDesc,");
            strSql.Append("dCreateTime=@dCreateTime,");
            strSql.Append("dUpdateTime=@dUpdateTime");
            strSql.Append(" where sGUID=@sGUID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@sJurisdictionType",    SqlDbType.Int,         4),
                new SqlParameter("@sJurisdictionContent", SqlDbType.NVarChar,  100),
                new SqlParameter("@sPrjectGUID",          SqlDbType.Char,       36),
                new SqlParameter("@sDesc",                SqlDbType.NVarChar,  500),
                new SqlParameter("@dCreateTime",          SqlDbType.DateTime),
                new SqlParameter("@dUpdateTime",          SqlDbType.DateTime),
                new SqlParameter("@sGUID",                SqlDbType.Char, 36)
            };
            parameters[0].Value = model.sJurisdictionType;
            parameters[1].Value = model.sJurisdictionContent;
            parameters[2].Value = model.sPrjectGUID;
            parameters[3].Value = model.sDesc;
            parameters[4].Value = model.dCreateTime;
            parameters[5].Value = model.dUpdateTime;
            parameters[6].Value = model.sGUID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(LumluxSSYDB.Model.tJurisdiction model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tJurisdiction(");
            strSql.Append("sGUID,sJurisdictionType,sJurisdictionContent,sPrjectGUID,sDesc,dCreateTime,dUpdateTime)");
            strSql.Append(" values (");
            strSql.Append("@sGUID,@sJurisdictionType,@sJurisdictionContent,@sPrjectGUID,@sDesc,@dCreateTime,@dUpdateTime)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@sGUID",                SqlDbType.Char,       36),
                new SqlParameter("@sJurisdictionType",    SqlDbType.Int,         4),
                new SqlParameter("@sJurisdictionContent", SqlDbType.NVarChar,  100),
                new SqlParameter("@sPrjectGUID",          SqlDbType.Char,       36),
                new SqlParameter("@sDesc",                SqlDbType.NVarChar,  500),
                new SqlParameter("@dCreateTime",          SqlDbType.DateTime),
                new SqlParameter("@dUpdateTime",          SqlDbType.DateTime)
            };
            parameters[0].Value = model.sGUID;
            parameters[1].Value = model.sJurisdictionType;
            parameters[2].Value = model.sJurisdictionContent;
            parameters[3].Value = model.sPrjectGUID;
            parameters[4].Value = model.sDesc;
            parameters[5].Value = model.dCreateTime;
            parameters[6].Value = model.dUpdateTime;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public LumluxSSYDB.Model.tJurisdiction DataRowToModel(DataRow row)
 {
     LumluxSSYDB.Model.tJurisdiction model = new LumluxSSYDB.Model.tJurisdiction();
     if (row != null)
     {
         if (row["sGUID"] != null)
         {
             model.sGUID = row["sGUID"].ToString();
         }
         if (row["sJurisdictionType"] != null && row["sJurisdictionType"].ToString() != "")
         {
             model.sJurisdictionType = int.Parse(row["sJurisdictionType"].ToString());
         }
         if (row["sJurisdictionContent"] != null)
         {
             model.sJurisdictionContent = row["sJurisdictionContent"].ToString();
         }
         if (row["sPrjectGUID"] != null)
         {
             model.sPrjectGUID = row["sPrjectGUID"].ToString();
         }
         if (row["sDesc"] != null)
         {
             model.sDesc = row["sDesc"].ToString();
         }
         if (row["dCreateTime"] != null && row["dCreateTime"].ToString() != "")
         {
             model.dCreateTime = DateTime.Parse(row["dCreateTime"].ToString());
         }
         if (row["dUpdateTime"] != null && row["dUpdateTime"].ToString() != "")
         {
             model.dUpdateTime = DateTime.Parse(row["dUpdateTime"].ToString());
         }
     }
     return(model);
 }
Пример #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public LumluxSSYDB.Model.tJurisdiction GetModel(string sGUID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 sGUID,sJurisdictionType,sJurisdictionContent,sPrjectGUID,sDesc,dCreateTime,dUpdateTime from tJurisdiction ");
            strSql.Append(" where sGUID=@sGUID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@sGUID", SqlDbType.Char, 36)
            };
            parameters[0].Value = sGUID;

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

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