Ejemplo n.º 1
0
    public int Delete(int m_id)
    {
        //連動刪除Member_card
        Member_cardInfo mcinfos = mcBLL.GetDataByMid(m_id);

        mcBLL.Delete(mcinfos.mc_id);
        return(db.Delete(m_id));
    }
Ejemplo n.º 2
0
    public Member_cardInfo GetDataByMid(int m_id)
    {
        Member_cardInfo info   = new Member_cardInfo();
        IDataReader     reader = db.GetDataByMId(m_id).CreateDataReader();

        if (reader.Read())
        {
            info = Member_cardInfo.Populate(reader);
        }
        return(info);
    }
Ejemplo n.º 3
0
    public static Member_cardInfo Populate(IDataReader reader)
    {
        Member_cardInfo info = new Member_cardInfo();

        for (int i = 0; i < reader.FieldCount; i++)
        {
            PropertyInfo property = info.GetType().GetProperty(reader.GetName(i));
            Type         propType = property.PropertyType;
            TypeConverters.ITypeConverter typeConverter = TypeConverters.TypeConverterFactory.GetConvertType(propType);
            property.SetValue(info, Convert.ChangeType(typeConverter.Convert(reader.GetValue(i)), propType), null);
        }
        return(info);
    }
Ejemplo n.º 4
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        Member_cardInfo info = mcBLL.GetDataByMid(int.Parse(Request.QueryString["id"].ToString()));

        info.mc_pass     = txtPass.Text.Trim().ToLower();
        info.mc_status   = int.Parse(ddlLevel.SelectedValue);
        info.mc_note     = txtContact.Text;
        info.mc_editdate = DateTime.Now;
        if (mcBLL.Update(info) > 0)
        {
            //SetSmtpArray();
            Response.Redirect("~/Manager/Member/List.aspx?header=" + Getmessage("30014"));
        }
    }
Ejemplo n.º 5
0
 protected void Bind()
 {
     if (Request.QueryString["id"] != null)
     {
         if (Tools.TryParseMethod(Request.QueryString["id"].ToString()) != 0)
         {
             Member_cardInfo info = mcBLL.GetDataByMid(int.Parse(Request.QueryString["id"].ToString()));
             lbCardNumber.Text      = info.mc_number;
             lbPAss.Text            = info.mc_pass;
             ddlLevel.SelectedValue = info.mc_status.ToString();
             txtContact.Text        = info.mc_note;
             lbCreateDate.Text      = info.mc_adddate.ToString("yyyy/MM/dd hh:mm");
             lbEditDate.Text        = info.mc_editdate.ToString("yyyy/MM/dd hh:mm");
         }
     }
 }
Ejemplo n.º 6
0
 protected void lkbtnCreateCard_Command(object sender, CommandEventArgs e)
 {
     if (mcBLL.GetDataByMid(int.Parse(e.CommandArgument.ToString())).m_id == 0)
     {
         MemberInfo      minfo = mBLL.GetDataById(int.Parse(e.CommandArgument.ToString()));
         Member_cardInfo info  = new Member_cardInfo();
         info.mc_number   = "MC" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + minfo.m_level + string.Format("{00000:00000}", mcBLL.Getall().Rows.Count + 1);
         info.mc_pass     = Tools.GetRandomString(12);
         info.mc_status   = 0;
         info.m_id        = int.Parse(e.CommandArgument.ToString());
         info.mc_adddate  = DateTime.Now;
         info.mc_editdate = DateTime.Now;
         if (mcBLL.Insert(info) > 0)
         {
             ShowMessage("創建會員卡成功");
         }
     }
     else
     {
         ShowMessage("此帳號已創建會員卡");
     }
 }
Ejemplo n.º 7
0
 public int Update(Member_cardInfo info)
 {
     return(db.Update(info.mc_number, info.mc_pass, info.mc_status, info.m_id, info.mc_note, info.mc_adddate, info.mc_editdate, info.mc_id));
 }
Ejemplo n.º 8
0
 public int Insert(Member_cardInfo info)
 {
     return(db.Insert(info.mc_number, info.mc_pass, info.mc_status, info.m_id, info.mc_note, info.mc_adddate, info.mc_editdate));
 }