/// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BWJS.Model.NL_ConsultStatusChangeLog GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Id, ConsultId, BusinessType, Status, PrevStatus, CreateDate  ");
            strSql.Append("  from dbo.[NL_ConsultStatusChangeLog] ");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = Id;


            BWJS.Model.NL_ConsultStatusChangeLog model = new BWJS.Model.NL_ConsultStatusChangeLog();
            DataSet ds = BWJSHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(BWJS.Model.NL_ConsultStatusChangeLog model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update dbo.[NL_ConsultStatusChangeLog] set ");

            strSql.Append(" ConsultId = @ConsultId , ");
            strSql.Append(" BusinessType = @BusinessType , ");
            strSql.Append(" Status = @Status , ");
            strSql.Append(" PrevStatus = @PrevStatus , ");
            strSql.Append(" CreateDate = @CreateDate  ");
            strSql.Append(" where Id=@Id ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@Id",           model.Id),
                new SqlParameter("@ConsultId",    model.ConsultId),
                new SqlParameter("@BusinessType", model.BusinessType),
                new SqlParameter("@Status",       model.Status),
                new SqlParameter("@PrevStatus",   model.PrevStatus),
                new SqlParameter("@CreateDate",   model.CreateDate)
            };

            int rows = BWJSHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(BWJS.Model.NL_ConsultStatusChangeLog model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into dbo.[NL_ConsultStatusChangeLog](");
            strSql.Append("ConsultId,BusinessType,Status,PrevStatus,CreateDate");
            strSql.Append(") values (");
            strSql.Append("@ConsultId,@BusinessType,@Status,@PrevStatus,@CreateDate");
            strSql.Append(") ");
            strSql.Append(";select SCOPE_IDENTITY()");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ConsultId",    model.ConsultId),
                new SqlParameter("@BusinessType", model.BusinessType),
                new SqlParameter("@Status",       model.Status),
                new SqlParameter("@PrevStatus",   model.PrevStatus),
                new SqlParameter("@CreateDate",   model.CreateDate)
            };


            object obj = BWJSHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
        /// <summary>
        /// datarow转成对象实体
        /// </summary>
        public BWJS.Model.NL_ConsultStatusChangeLog DataRowToModel(DataRow row)
        {
            BWJS.Model.NL_ConsultStatusChangeLog model = new BWJS.Model.NL_ConsultStatusChangeLog();

            if (row != null)
            {
                if (row["Id"].ToString() != "")
                {
                    model.Id = int.Parse(row["Id"].ToString());
                }
                if (row["ConsultId"].ToString() != "")
                {
                    model.ConsultId = int.Parse(row["ConsultId"].ToString());
                }
                if (row["BusinessType"].ToString() != "")
                {
                    model.BusinessType = int.Parse(row["BusinessType"].ToString());
                }
                if (row["Status"].ToString() != "")
                {
                    model.Status = int.Parse(row["Status"].ToString());
                }
                if (row["PrevStatus"].ToString() != "")
                {
                    model.PrevStatus = int.Parse(row["PrevStatus"].ToString());
                }
                if (row["CreateDate"].ToString() != "")
                {
                    model.CreateDate = DateTime.Parse(row["CreateDate"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemple #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(BWJS.Model.NL_ConsultStatusChangeLog model)
 {
     return(dal.Update(model));
 }
Exemple #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(BWJS.Model.NL_ConsultStatusChangeLog model)
 {
     return(dal.Add(model));
 }