Beispiel #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(PeiSongTypeModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into CORE.dbo.PeiSongType (");
            strSql.Append("PeiSongTime,PeiHuoTime,EndTimeForDay,BgTimeForDay,BranchId,PeiSongTypeName,MerId,DefaultPrice,FullPrice,PeiSongTypeMemo,OrderNo,PeiSongTeXing,SelDay");
            strSql.Append(") values (");
            strSql.Append("@PeiSongTime,@PeiHuoTime,@EndTimeForDay,@BgTimeForDay,@BranchId,@PeiSongTypeName,@MerId,@DefaultPrice,@FullPrice,@PeiSongTypeMemo,@OrderNo,@PeiSongTeXing,@SelDay");
            strSql.Append(") ");
            strSql.Append(";");
            SqlParameter[] parameters =
            {
                new SqlParameter("@PeiSongTime",     SqlDbType.Time,       5),
                new SqlParameter("@PeiHuoTime",      SqlDbType.Time,       5),
                new SqlParameter("@EndTimeForDay",   SqlDbType.Time,       5),
                new SqlParameter("@BgTimeForDay",    SqlDbType.Time,       5),
                new SqlParameter("@BranchId",        SqlDbType.VarChar,   50),
                new SqlParameter("@PeiSongTypeName", SqlDbType.VarChar,   50),
                new SqlParameter("@MerId",           SqlDbType.Decimal,    9),
                new SqlParameter("@DefaultPrice",    SqlDbType.Decimal,    9),
                new SqlParameter("@FullPrice",       SqlDbType.Decimal,    9),
                new SqlParameter("@PeiSongTypeMemo", SqlDbType.VarChar, 1000),
                new SqlParameter("@OrderNo",         SqlDbType.Int,        4),
                new SqlParameter("@PeiSongTeXing",   SqlDbType.Int,        4),
                new SqlParameter("@SelDay",          SqlDbType.Int, 4)
            };

            parameters[0].Value  = model.PeiSongTime;
            parameters[1].Value  = model.PeiHuoTime;
            parameters[2].Value  = model.EndTimeForDay;
            parameters[3].Value  = model.BgTimeForDay;
            parameters[4].Value  = model.BranchId;
            parameters[5].Value  = model.PeiSongTypeName;
            parameters[6].Value  = model.MerId;
            parameters[7].Value  = model.DefaultPrice;
            parameters[8].Value  = model.FullPrice;
            parameters[9].Value  = model.PeiSongTypeMemo;
            parameters[10].Value = model.OrderNo;
            parameters[11].Value = model.PeiSongTeXing;
            parameters[12].Value = model.SelDay;

            bool result = false;

            try
            {
                model.PeiSongTypeId = decimal.Parse(helper.ExecuteNonQueryBackId(strSql.ToString(), "PeiSongTypeId", parameters));


                result = true;
            }
            catch (Exception ex)
            {
                this.helper.Close();
                throw ex;
            }
            finally
            {
            }
            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public PeiSongTypeModel GetModel(decimal PeiSongTypeId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select PeiSongTypeId, PeiSongTime, PeiHuoTime, EndTimeForDay, BgTimeForDay, BranchId, PeiSongTypeName, MerId, DefaultPrice, FullPrice, PeiSongTypeMemo, OrderNo, PeiSongTeXing, SelDay  ");
            strSql.Append("  from CORE.dbo.PeiSongType ");
            strSql.Append(" where PeiSongTypeId=@PeiSongTypeId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@PeiSongTypeId", SqlDbType.Decimal)
            };
            parameters[0].Value = PeiSongTypeId;


            PeiSongTypeModel model = new PeiSongTypeModel();
            DataSet          ds    = helper.ExecSqlReDs(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["PeiSongTypeId"].ToString() != "")
                {
                    model.PeiSongTypeId = decimal.Parse(ds.Tables[0].Rows[0]["PeiSongTypeId"].ToString());
                }
                model.BranchId        = ds.Tables[0].Rows[0]["BranchId"].ToString();
                model.PeiSongTypeName = ds.Tables[0].Rows[0]["PeiSongTypeName"].ToString();
                if (ds.Tables[0].Rows[0]["MerId"].ToString() != "")
                {
                    model.MerId = decimal.Parse(ds.Tables[0].Rows[0]["MerId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["DefaultPrice"].ToString() != "")
                {
                    model.DefaultPrice = decimal.Parse(ds.Tables[0].Rows[0]["DefaultPrice"].ToString());
                }
                if (ds.Tables[0].Rows[0]["FullPrice"].ToString() != "")
                {
                    model.FullPrice = decimal.Parse(ds.Tables[0].Rows[0]["FullPrice"].ToString());
                }
                model.PeiSongTypeMemo = ds.Tables[0].Rows[0]["PeiSongTypeMemo"].ToString();
                if (ds.Tables[0].Rows[0]["OrderNo"].ToString() != "")
                {
                    model.OrderNo = int.Parse(ds.Tables[0].Rows[0]["OrderNo"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PeiSongTeXing"].ToString() != "")
                {
                    model.PeiSongTeXing = int.Parse(ds.Tables[0].Rows[0]["PeiSongTeXing"].ToString());
                }
                if (ds.Tables[0].Rows[0]["SelDay"].ToString() != "")
                {
                    model.SelDay = int.Parse(ds.Tables[0].Rows[0]["SelDay"].ToString());
                }

                return(model);
            }
            else
            {
                return(model);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(PeiSongTypeModel model)
        {
            bool          reValue = true;
            int           reCount = 0;
            StringBuilder strSql  = new StringBuilder();

            strSql.Append("update CORE.dbo.PeiSongType set ");

            strSql.Append(" PeiSongTime = @PeiSongTime , ");
            strSql.Append(" PeiHuoTime = @PeiHuoTime , ");
            strSql.Append(" EndTimeForDay = @EndTimeForDay , ");
            strSql.Append(" BgTimeForDay = @BgTimeForDay , ");
            strSql.Append(" BranchId = @BranchId , ");
            strSql.Append(" PeiSongTypeName = @PeiSongTypeName , ");
            strSql.Append(" MerId = @MerId , ");
            strSql.Append(" DefaultPrice = @DefaultPrice , ");
            strSql.Append(" FullPrice = @FullPrice , ");
            strSql.Append(" PeiSongTypeMemo = @PeiSongTypeMemo , ");
            strSql.Append(" OrderNo = @OrderNo , ");
            strSql.Append(" PeiSongTeXing = @PeiSongTeXing , ");
            strSql.Append(" SelDay = @SelDay  ");
            strSql.Append(" where PeiSongTypeId=@PeiSongTypeId ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@PeiSongTypeId",   SqlDbType.Decimal,    9),
                new SqlParameter("@PeiSongTime",     SqlDbType.Time,       5),
                new SqlParameter("@PeiHuoTime",      SqlDbType.Time,       5),
                new SqlParameter("@EndTimeForDay",   SqlDbType.Time,       5),
                new SqlParameter("@BgTimeForDay",    SqlDbType.Time,       5),
                new SqlParameter("@BranchId",        SqlDbType.VarChar,   50),
                new SqlParameter("@PeiSongTypeName", SqlDbType.VarChar,   50),
                new SqlParameter("@MerId",           SqlDbType.Decimal,    9),
                new SqlParameter("@DefaultPrice",    SqlDbType.Decimal,    9),
                new SqlParameter("@FullPrice",       SqlDbType.Decimal,    9),
                new SqlParameter("@PeiSongTypeMemo", SqlDbType.VarChar, 1000),
                new SqlParameter("@OrderNo",         SqlDbType.Int,        4),
                new SqlParameter("@PeiSongTeXing",   SqlDbType.Int,        4),
                new SqlParameter("@SelDay",          SqlDbType.Int, 4)
            };

            parameters[0].Value  = model.PeiSongTypeId;
            parameters[1].Value  = model.PeiSongTime;
            parameters[2].Value  = model.PeiHuoTime;
            parameters[3].Value  = model.EndTimeForDay;
            parameters[4].Value  = model.BgTimeForDay;
            parameters[5].Value  = model.BranchId;
            parameters[6].Value  = model.PeiSongTypeName;
            parameters[7].Value  = model.MerId;
            parameters[8].Value  = model.DefaultPrice;
            parameters[9].Value  = model.FullPrice;
            parameters[10].Value = model.PeiSongTypeMemo;
            parameters[11].Value = model.OrderNo;
            parameters[12].Value = model.PeiSongTeXing;
            parameters[13].Value = model.SelDay; try
            {//异常处理
                reCount = this.helper.ExecSqlReInt(strSql.ToString(), parameters);
            }
            catch (Exception ex)
            {
                this.helper.Close();
                throw ex;
            }
            if (reCount <= 0)
            {
                reValue = false;
            }
            return(reValue);
        }