コード例 #1
0
        /// <summary>
        ///  实体转换
        /// <summary>
        private static Model.Remind TranEntity(DataRow dr)
        {
            if (dr != null)
            {
                Model.Remind model = new Model.Remind();

                if (!string.IsNullOrEmpty(dr["Id"].ToString()))
                {
                    model.Id = int.Parse(dr["Id"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["RType"].ToString()))
                {
                    model.RType = int.Parse(dr["RType"].ToString());
                }
                model.RTypeName = dr["RTypeName"].ToString();
                model.RemindMsg = dr["RemindMsg"].ToString();
                if (!string.IsNullOrEmpty(dr["State"].ToString()))
                {
                    model.State = int.Parse(dr["State"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
コード例 #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public static Hashtable Update(Model.Remind model, Hashtable MyHs)
        {
            string        guid   = Guid.NewGuid().ToString();
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Remind set ");

            strSql.Append(" RType = @RType , ");
            strSql.Append(" RTypeName = @RTypeName , ");
            strSql.Append(" RemindMsg = @RemindMsg , ");
            strSql.Append(" State = @State  ");
            strSql.Append(" where Id=@Id ");
            strSql.AppendFormat(" ;select '{0}'", guid);

            SqlParameter[] parameters =
            {
                new SqlParameter("@Id",        SqlDbType.Int,       4),
                new SqlParameter("@RType",     SqlDbType.Int,       4),
                new SqlParameter("@RTypeName", SqlDbType.VarChar, 150),
                new SqlParameter("@RemindMsg", SqlDbType.Text),
                new SqlParameter("@State",     SqlDbType.Int, 4)
            };

            parameters[0].Value = model.Id;
            parameters[1].Value = model.RType;
            parameters[2].Value = model.RTypeName;
            parameters[3].Value = model.RemindMsg;
            parameters[4].Value = model.State;
            MyHs.Add(strSql.ToString(), parameters);
            return(MyHs);
        }
コード例 #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public static Hashtable Insert(Model.Remind model, Hashtable MyHs)
        {
            string        guid   = Guid.NewGuid().ToString();
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Remind(");
            strSql.Append("RType,RTypeName,RemindMsg,State");
            strSql.Append(") values (");
            strSql.Append("@RType,@RTypeName,@RemindMsg,@State");
            strSql.Append(") ");
            strSql.AppendFormat(";select '{0}'", guid);
            SqlParameter[] parameters =
            {
                new SqlParameter("@RType",     SqlDbType.Int,       4),
                new SqlParameter("@RTypeName", SqlDbType.VarChar, 150),
                new SqlParameter("@RemindMsg", SqlDbType.Text),
                new SqlParameter("@State",     SqlDbType.Int, 4)
            };

            parameters[0].Value = model.RType;
            parameters[1].Value = model.RTypeName;
            parameters[2].Value = model.RemindMsg;
            parameters[3].Value = model.State;
            MyHs.Add(strSql.ToString(), parameters);
            return(MyHs);
        }
コード例 #4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static bool Insert(Model.Remind model)
 {
     return(DAL.CommonBase.RunHashtable(Insert(model, new Hashtable())));
 }
コード例 #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static bool Update(Model.Remind model)
 {
     return(DAL.CommonBase.RunHashtable(Update(model, new Hashtable())));
 }
コード例 #6
0
 public static bool Update(Model.Remind model)
 {
     return(WE_Project.DAL.Remind.Update(model));
 }
コード例 #7
0
 public static Hashtable Update(Model.Remind model, Hashtable MyHs)
 {
     return(WE_Project.DAL.Remind.Update(model, MyHs));
 }
コード例 #8
0
 public static bool Insert(Model.Remind model)
 {
     return(WE_Project.DAL.Remind.Insert(model));
 }
コード例 #9
0
 public static Hashtable Insert(Model.Remind model, Hashtable MyHs)
 {
     return(WE_Project.DAL.Remind.Insert(model, MyHs));
 }