Пример #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Goods_ServiceDetailModel DataRowToModel(DataRow row)
        {
            Goods_ServiceDetailModel model = new Goods_ServiceDetailModel();

            if (row != null)
            {
                if (row["sysnumber"] != null)
                {
                    model.sysnumber = row["sysnumber"].ToString();
                }
                if (row["serviceId"] != null)
                {
                    model.serviceId = row["serviceId"].ToString();
                }
                if (row["value"] != null)
                {
                    model.value = row["value"].ToString();
                }
                if (row["Price"] != null && row["Price"].ToString() != "")
                {
                    model.Price = decimal.Parse(row["Price"].ToString());
                }
                if (row["Remark"] != null)
                {
                    model.Remark = row["Remark"].ToString();
                }
                if (row["IsDefault"] != null)
                {
                    model.IsDefault = int.Parse(row["IsDefault"].ToString());
                }
            }
            return(model);
        }
Пример #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Goods_ServiceDetailModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into T_Goods_ServiceDetail(");
            strSql.Append("sysnumber,serviceId,value,Price,Remark,isDefault)");
            strSql.Append(" values (");
            strSql.Append("@sysnumber,@serviceId,@value,@Price,@Remark,@isDefault)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@sysnumber", SqlDbType.VarChar,  50),
                new SqlParameter("@serviceId", SqlDbType.VarChar,  50),
                new SqlParameter("@value",     SqlDbType.VarChar,  50),
                new SqlParameter("@Price",     SqlDbType.Decimal,   9),
                new SqlParameter("@Remark",    SqlDbType.VarChar, 500),
                new SqlParameter("@isDefault", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.sysnumber;
            parameters[1].Value = model.serviceId;
            parameters[2].Value = model.value;
            parameters[3].Value = model.Price;
            parameters[4].Value = model.Remark;
            parameters[5].Value = model.IsDefault;
            int rows = adoHelper.ExecuteSqlNonQuery(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Goods_ServiceDetailModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update T_Goods_ServiceDetail set ");
            strSql.Append("serviceId=@serviceId,");
            strSql.Append("value=@value,");
            strSql.Append("Price=@Price,");
            strSql.Append("Remark=@Remark,");
            strSql.Append("isDefault=@isDefault");
            strSql.Append(" where sysnumber=@sysnumber ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@serviceId", SqlDbType.VarChar, 200),
                new SqlParameter("@value",     SqlDbType.VarChar,  50),
                new SqlParameter("@Price",     SqlDbType.Decimal,   9),
                new SqlParameter("@Remark",    SqlDbType.VarChar, 500),
                new SqlParameter("@isDefault", SqlDbType.Int,       4),
                new SqlParameter("@sysnumber", SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.serviceId;
            parameters[1].Value = model.value;
            parameters[2].Value = model.Price;
            parameters[3].Value = model.Remark;
            parameters[4].Value = model.IsDefault;
            parameters[5].Value = model.sysnumber;

            int rows = adoHelper.ExecuteSqlNonQuery(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Goods_ServiceDetailModel GetModel(string sysnumber)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 sysnumber,serviceId,value,Price,Remark,isDefault from T_Goods_ServiceDetail ");
            strSql.Append(" where sysnumber=@sysnumber ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@sysnumber", SqlDbType.VarChar, 50)
            };
            parameters[0].Value = sysnumber;

            Goods_ServiceDetailModel model = new Goods_ServiceDetailModel();
            DataSet ds = adoHelper.ExecuteSqlDataset(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Пример #5
0
        public Goods_ServiceDetailModel GetModel1(string serviceId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 * from T_Goods_ServiceDetail ");
            strSql.Append(" where serviceId=@serviceId ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@serviceId", SqlDbType.VarChar, 200)
            };
            parameters[0].Value = serviceId;

            Goods_ServiceDetailModel model = new Goods_ServiceDetailModel();
            DataSet ds = adoHelper.ExecuteSqlDataset(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Пример #6
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Goods_ServiceDetailModel model)
 {
     return(dal.Update(model));
 }
Пример #7
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(Goods_ServiceDetailModel model)
 {
     return(dal.Add(model));
 }