Ejemplo n.º 1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MobileSoft.Model.System.Tb_System_Province GetModel(int ProvinceID, string ProvinceName)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@ProvinceID",   SqlDbType.Int,      4),
                new SqlParameter("@ProvinceName", SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = ProvinceID;
            parameters[1].Value = ProvinceName;

            MobileSoft.Model.System.Tb_System_Province model = new MobileSoft.Model.System.Tb_System_Province();
            DataSet ds = DbHelperSQL.RunProcedure("Proc_Tb_System_Province_GetModel", parameters, "ds");

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ProvinceID"].ToString() != "")
                {
                    model.ProvinceID = int.Parse(ds.Tables[0].Rows[0]["ProvinceID"].ToString());
                }
                model.ProvinceName = ds.Tables[0].Rows[0]["ProvinceName"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(MobileSoft.Model.System.Tb_System_Province model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@ProvinceID",   SqlDbType.Int,      4),
                new SqlParameter("@ProvinceName", SqlDbType.NVarChar, 30)
            };
            parameters[0].Value = model.ProvinceID;
            parameters[1].Value = model.ProvinceName;

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