Exemple #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MobileSoft.Model.Resources.Tb_Resources_Attr GetModel(long AttrID)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@AttrID", SqlDbType.BigInt)
            };
            parameters[0].Value = AttrID;

            MobileSoft.Model.Resources.Tb_Resources_Attr model = new MobileSoft.Model.Resources.Tb_Resources_Attr();
            DataSet ds = DbHelperSQL.RunProcedure("Proc_Tb_Resources_Attr_GetModel", parameters, "ds");

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["AttrID"].ToString() != "")
                {
                    model.AttrID = long.Parse(ds.Tables[0].Rows[0]["AttrID"].ToString());
                }
                model.AttrName = ds.Tables[0].Rows[0]["AttrName"].ToString();
                if (ds.Tables[0].Rows[0]["AttrIndex"].ToString() != "")
                {
                    model.AttrIndex = int.Parse(ds.Tables[0].Rows[0]["AttrIndex"].ToString());
                }
                model.AttrType  = ds.Tables[0].Rows[0]["AttrType"].ToString();
                model.AttrColor = ds.Tables[0].Rows[0]["AttrColor"].ToString();
                if (ds.Tables[0].Rows[0]["BussId"].ToString() != "")
                {
                    model.BussId = long.Parse(ds.Tables[0].Rows[0]["BussId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["IsDelete"].ToString() != "")
                {
                    model.IsDelete = int.Parse(ds.Tables[0].Rows[0]["IsDelete"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemple #2
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(MobileSoft.Model.Resources.Tb_Resources_Attr model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@AttrID",    SqlDbType.BigInt,     8),
                new SqlParameter("@AttrName",  SqlDbType.NVarChar, 100),
                new SqlParameter("@AttrIndex", SqlDbType.SmallInt,   2),
                new SqlParameter("@AttrType",  SqlDbType.NVarChar,  50),
                new SqlParameter("@AttrColor", SqlDbType.NVarChar,  50),
                new SqlParameter("@BussId",    SqlDbType.BigInt,     8),
                new SqlParameter("@IsDelete",  SqlDbType.SmallInt, 2)
            };
            parameters[0].Value = model.AttrID;
            parameters[1].Value = model.AttrName;
            parameters[2].Value = model.AttrIndex;
            parameters[3].Value = model.AttrType;
            parameters[4].Value = model.AttrColor;
            parameters[5].Value = model.BussId;
            parameters[6].Value = model.IsDelete;

            DbHelperSQL.RunProcedure("Proc_Tb_Resources_Attr_Update", parameters, out rowsAffected);
        }