Beispiel #1
0
 /// <summary>
 /// 實體物件取得DataRow資料
 /// </summary>
 private Models.MEDM SetModel(DataRow dr)
 {
     Models.MEDM mod = new Models.MEDM();
     mod.MemberID = dr["MemberID"].ToString();
     mod.NameC    = dr["NameC"].ToString();
     mod.Email    = dr["Email"].ToString();
     mod.IsSend   = bool.Parse(dr["IsSend"].ToString());
     return(mod);
 }
Beispiel #2
0
        /// <summary>
        /// 修改資料
        /// <summary>
        public bool Edit(Models.MEDM mod)
        {
            SqlCommand cmd = new SqlCommand("STP_EDMEdit");

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@MemberID", SqlDbType.NVarChar).Value = mod.MemberID;
            cmd.Parameters.Add("@NameC", SqlDbType.NVarChar).Value    = mod.NameC;
            cmd.Parameters.Add("@Email", SqlDbType.NVarChar).Value    = mod.Email;
            cmd.Parameters.Add("@IsSend", SqlDbType.Bit).Value        = mod.IsSend;
            return(SQLUtil.ExecuteSql(cmd) > 0);
        }
Beispiel #3
0
 /// <summary>
 /// 實體物件取得DataReader資料
 /// </summary>
 private Models.MEDM SetModel(SqlDataReader dr)
 {
     Models.MEDM mod = new Models.MEDM();
     while (dr.Read())
     {
         mod.MemberID = dr["MemberID"].ToString();
         mod.NameC    = dr["NameC"].ToString();
         mod.Email    = dr["Email"].ToString();
         mod.IsSend   = bool.Parse(dr["IsSend"].ToString());
     }
     return(mod);
 }
Beispiel #4
0
        /// <summary>
        /// 新增資料
        /// </summary>
        public string Add(Models.MEDM mod)
        {
            SqlCommand cmd = new SqlCommand("STP_EDMAdd");

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@MemberID", SqlDbType.NVarChar).Value = mod.MemberID;
            cmd.Parameters.Add("@NameC", SqlDbType.NVarChar).Value    = mod.NameC;
            cmd.Parameters.Add("@Email", SqlDbType.NVarChar).Value    = mod.Email;
            cmd.Parameters.Add("@IsSend", SqlDbType.Bit).Value        = mod.IsSend;
            if (SQLUtil.ExecuteSql(cmd) > 0)
            {
                return(mod.MemberID);
            }
            else
            {
                return(null);
            }
        }
Beispiel #5
0
        /// <summary>
        /// 取得單筆資料
        /// <summary>
        public Models.MEDM GetModel(string strMemberID)
        {
            SqlCommand cmd = new SqlCommand("STP_EDMGetByPK");

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@MemberID", SqlDbType.NVarChar).Value = strMemberID;
            SqlDataReader dr        = SQLUtil.QueryDR(cmd);
            bool          isHasRows = dr.HasRows;

            Models.MEDM mod = SetModel(dr);
            dr.Close();
            if (isHasRows)
            {
                return(mod);
            }
            else
            {
                return(null);
            }
        }
Beispiel #6
0
 /// <summary>
 /// 修改資料
 /// </summary>
 public bool Edit(Models.MEDM mod)
 {
     return(new DAL.DEDM().Edit(mod));
 }
Beispiel #7
0
 /// <summary>
 /// 新增資料
 /// </summary>
 public string Add(Models.MEDM mod)
 {
     return(new DAL.DEDM().Add(mod));
 }