Пример #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MobileSoft.Model.HSPR.Tb_HSPR_ParkingOpt GetModel(Guid SCode)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@SCode", SqlDbType.UniqueIdentifier)
            };
            parameters[0].Value = SCode;

            MobileSoft.Model.HSPR.Tb_HSPR_ParkingOpt model = new MobileSoft.Model.HSPR.Tb_HSPR_ParkingOpt();
            DataSet ds = DbHelperSQL.RunProcedure("Proc_Tb_HSPR_ParkingOpt_GetModel", parameters, "ds");

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["SCode"].ToString() != "")
                {
                    model.SCode = new Guid(ds.Tables[0].Rows[0]["SCode"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ParkID"].ToString() != "")
                {
                    model.ParkID = long.Parse(ds.Tables[0].Rows[0]["ParkID"].ToString());
                }
                model.OptUserCode = ds.Tables[0].Rows[0]["OptUserCode"].ToString();
                if (ds.Tables[0].Rows[0]["OptCode"].ToString() != "")
                {
                    model.OptCode = new Guid(ds.Tables[0].Rows[0]["OptCode"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Пример #2
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(MobileSoft.Model.HSPR.Tb_HSPR_ParkingOpt model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@SCode",       SqlDbType.UniqueIdentifier, 16),
                new SqlParameter("@ParkID",      SqlDbType.BigInt,            8),
                new SqlParameter("@OptUserCode", SqlDbType.NVarChar,         50),
                new SqlParameter("@OptCode",     SqlDbType.UniqueIdentifier, 16)
            };
            parameters[0].Value = model.SCode;
            parameters[1].Value = model.ParkID;
            parameters[2].Value = model.OptUserCode;
            parameters[3].Value = model.OptCode;

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