Exemple #1
0
 public LeaveMsg(LeaveMsg info)
 {
     this.id      = info.id;
     this.name    = info.name;
     this.theme   = info.theme;
     this.info    = info.info;
     this.time    = info.time;
     this.link    = info.link;
     this.isReply = info.isReply;
 }
Exemple #2
0
 public bool Insert(LeaveMsg leaveMsg)
 {
     string sql = "insert into LeaveMsg (Name,Tel,Qq,Email,Company,Industry,Interest,AddDate) values(?,?,?,?,?,?,?,?)";
     OleDbParameter[] oleDbParameters = { new OleDbParameter("@Name",leaveMsg.Name),
                                            new OleDbParameter("@Tel",leaveMsg.Tel),
                                            new OleDbParameter("@Qq",leaveMsg.Qq),
                                            new OleDbParameter("@Email",leaveMsg.Email),
                                            new OleDbParameter("@Company",leaveMsg.Company),
                                            new OleDbParameter("@Industry",leaveMsg.Industry),
                                            new OleDbParameter("@Interest",leaveMsg.Interest),
                                        new OleDbParameter("@AddDate",DateTime.Now)};
     if (SQLHelper.ExecuteSql(sql, oleDbParameters) > 0)
         return true;
     return false;
 }
Exemple #3
0
 public bool Insert(string name,string tel,string qq,string email,string company,string industry,string interest)
 {
     LeaveMsg leaveMsg = new LeaveMsg();
     leaveMsg.Name = name;
     leaveMsg.Tel = tel;
     leaveMsg.Qq = qq;
     leaveMsg.Email = email;
     leaveMsg.Company = company;
     leaveMsg.Industry = industry;
     leaveMsg.Interest = interest;
     DaoLeaveMsg dao = new DaoLeaveMsg();
     try
     {
         return dao.Insert(leaveMsg);
     }
     catch
     {
         return false;
     }
 }
Exemple #4
0
    protected void EmailSubmitBtn_Click(object sender, EventArgs e)
    {
        Model.LeaveMsg info = new Model.LeaveMsg();
        int            i    = 0;

        if (nameText.Value.Equals(""))
        {
            nameTextLbl.Text = "* 请填写昵称^_^";
        }
        else
        {
            nameTextLbl.Text = "";
            info.Name        = nameText.Value;
            i++;
        }
        if (themeText.Value.Equals(""))
        {
            themeTextLbl.Text = "* 请填写话题^_^";
        }
        else
        {
            themeTextLbl.Text = "";
            info.Theme        = themeText.Value;
            i++;
        }
        if (!linkInfoText.Value.Equals(""))
        {
            switch (linkTypeText.Value)
            {
            case "QQ":
                if (Comment.IsQQNumber(linkInfoText.Value))
                {
                    info.Link = "QQ:" + linkInfoText.Value;
                    i++;
                }
                else
                {
                    linkLbl.Text = "* 请填写正确的QQ号码^_^";
                }
                break;

            case "邮箱":
                if (Comment.IsEmail(linkInfoText.Value))
                {
                    info.Link = "邮箱:" + linkInfoText.Value;
                    i++;
                }
                else
                {
                    linkLbl.Text = "* 请填写正确的邮箱^_^";
                }
                break;

            case "手机":
                if (Comment.IsPhone(linkInfoText.Value))
                {
                    info.Link = "手机:" + linkInfoText.Value;
                    i++;
                }
                else
                {
                    linkLbl.Text = "* 请填写正确的手机号码^_^";
                }
                break;

            default:
                info.Link = "微信:" + linkInfoText.Value;
                i++;
                break;
            }
        }
        if (msgInfoBox.Text.Equals(""))
        {
            msgInfoBox.Msg = "* 请填写内容^_^";
        }
        else
        {
            msgInfoBox.Msg = "";
            info.Info      = msgInfoBox.Text;
            i++;
        }

        if (i > 3)
        {
            string emailInfo = "昵称:" + info.Name + "<br/>"
                               + "联系方式:" + info.Link + "<br/>"
                               + "内容:<br/>" + info.Info;
            if (Comment.sendEmail("*****@*****.**" /*[email protected]"*/, info.Theme, emailInfo))
            {
                Response.Write("<script language='javascript'>alert('发送成功!')</script>");
                nameText.Value     = "";
                themeText.Value    = "";
                linkInfoText.Value = "";
                msgInfoBox.Text    = "";
            }
            else
            {
                Response.Write("<script language='javascript'>alert('发送失败!')</script>");
            }
        }
    }
Exemple #5
0
    protected void MsgSubmitBtn_Click(object sender, EventArgs e)
    {
        Model.LeaveMsg info = new Model.LeaveMsg();
        int            i    = 0;

        if (nameText.Value.Equals(""))
        {
            nameTextLbl.Text = "* 请填写昵称^_^";
        }
        else
        {
            nameTextLbl.Text = "";
            info.Name        = nameText.Value;
            i++;
        }
        if (themeText.Value.Equals(""))
        {
            themeTextLbl.Text = "* 请填写话题^_^";
        }
        else
        {
            themeTextLbl.Text = "";
            info.Theme        = themeText.Value;
            i++;
        }
        if (!linkInfoText.Value.Equals(""))
        {
            switch (linkTypeText.Value)
            {
            case "QQ":
                if (Comment.IsQQNumber(linkInfoText.Value))
                {
                    info.Link = "QQ:" + linkInfoText.Value;
                    i++;
                }
                else
                {
                    linkLbl.Text = "* 请填写正确的QQ号码^_^";
                }
                break;

            case "邮箱":
                if (Comment.IsEmail(linkInfoText.Value))
                {
                    info.Link = "邮箱:" + linkInfoText.Value;
                    i++;
                }
                else
                {
                    linkLbl.Text = "* 请填写正确的邮箱^_^";
                }
                break;

            case "手机":
                if (Comment.IsPhone(linkInfoText.Value))
                {
                    info.Link = "手机:" + linkInfoText.Value;
                    i++;
                }
                else
                {
                    linkLbl.Text = "* 请填写正确的手机号码^_^";
                }
                break;

            default:
                info.Link = "微信:" + linkInfoText.Value;
                i++;
                break;
            }
        }
        if (msgInfoBox.Text.Equals(""))
        {
            msgInfoBox.Msg = "* 请填写内容^_^";
        }
        else
        {
            msgInfoBox.Msg = "";
            info.Info      = msgInfoBox.Text;
            i++;
        }
        if (!VerifyImage1.Text.Equals(YanZhengText.Value))
        {
            VerifyTextLbl.Text = "请填写正确验证码^_^";
            return;
        }
        else
        {
            VerifyTextLbl.Text = "";
        }
        if (i >= 3)
        {
            if (new DAL.DLeaveMsg().Insert(info))
            {
                Response.Write("<script language='javascript'>alert('留言成功!')</script>");
                PageList = new Paging(new DAL.DLeaveMsg().GetAll().ToList <Object>(), 4);
                RefreshList();
                nameText.Value     = "";
                themeText.Value    = "";
                linkInfoText.Value = "";
                msgInfoBox.Text    = "";
                YanZhengText.Value = "";
            }
            else
            {
                Response.Write("<script language='javascript'>alert('留言失败!')</script>");
            }
        }
    }