示例#1
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (txtTitle.Text == "" || txtName.Text == "" || txtPhone.Text.Trim() == "")
        {
            MojoCube.Api.UI.Script.ScriptMessage(this, "请填写完整");
            return;
        }

        //判断是否存在用户名及验证码是否正确
        if (Session["SiteCheckCode"] == null)
        {
            MojoCube.Api.UI.Script.ScriptMessage(this, "请填写验证码");
            return;
        }
        if (Session["SiteCheckCode"] != null && Session["SiteCheckCode"].ToString().ToLower() != txtCode.Text.Trim().ToLower())
        {
            MojoCube.Api.UI.Script.ScriptMessage(this, "验证码错误");
            return;
        }

        MojoCube.Web.Comment.List list = new MojoCube.Web.Comment.List();
        list.Title        = txtTitle.Text.Trim();
        list.Subtitle     = string.Empty;
        list.Description  = CreateTemplate();
        list.Feedback     = string.Empty;
        list.Visual       = string.Empty;
        list.Author       = txtName.Text.Trim();
        list.Email        = txtEmail.Text.Trim();
        list.Phone        = txtPhone.Text.Trim();
        list.Address      = string.Empty;
        list.Website      = string.Empty;
        list.IPAddress    = MojoCube.Web.IP.Get();
        list.Browser      = MojoCube.Web.String.GetBrowserInfo();
        list.Issue        = true;
        list.IsComment    = false;
        list.IsRecommend  = false;
        list.IsRead       = false;
        list.ReadDate     = DateTime.Now.ToString();
        list.Clicks       = 0;
        list.fk_ID        = 0;
        list.SortID       = 0;
        list.TypeID       = 0;
        list.StatusID     = 0;
        list.Score        = 0;
        list.ScoreIn      = 0;
        list.CreateDate   = DateTime.Now.ToString();
        list.CreateUserID = 0;
        list.ModifyDate   = DateTime.Now.ToString();
        list.ModifyUserID = 0;
        list.Language     = MojoCube.Api.UI.Language.GetLanguage();
        list.InsertData();

        MojoCube.Api.UI.Script.ScriptMessage(this, "您的留言已提交,我们会尽快阅读!");
        btnSubmit.Enabled = false;
    }
示例#2
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        MojoCube.Web.Order.List order = new MojoCube.Web.Order.List();
        order.GetData(int.Parse(ViewState["pk_Order"].ToString()));

        order.IsComment = true;
        order.UpdateData(order.pk_Order);

        if (GridView1.Rows.Count > 0)
        {
            MojoCube.Web.Member.List member = new MojoCube.Web.Member.List();
            member.GetData(int.Parse(Session["Member_UserID"].ToString()));

            MojoCube.Web.Comment.List list = new MojoCube.Web.Comment.List();

            for (int i = 0; i < GridView1.Rows.Count; i++)
            {
                if (((TextBox)GridView1.Rows[i].FindControl("txtComment")).Text.Trim() != "")
                {
                    list.Title        = ((Label)GridView1.Rows[i].FindControl("lblTitle")).Text;
                    list.Subtitle     = string.Empty;
                    list.Description  = ((TextBox)GridView1.Rows[i].FindControl("txtComment")).Text.Trim();
                    list.Feedback     = string.Empty;
                    list.Visual       = string.Empty;
                    list.Author       = member.LastName + member.FirstName;
                    list.Email        = member.Email;
                    list.Phone        = member.Phone1;
                    list.Address      = member.Address;
                    list.Website      = string.Empty;
                    list.IPAddress    = MojoCube.Web.IP.Get();
                    list.Browser      = MojoCube.Web.String.GetBrowserInfo();
                    list.Issue        = true;
                    list.IsComment    = false;
                    list.IsRecommend  = false;
                    list.IsRead       = false;
                    list.ReadDate     = DateTime.Now.ToString();
                    list.Clicks       = 0;
                    list.fk_ID        = int.Parse(((Label)GridView1.Rows[i].FindControl("lblfkID")).Text);
                    list.SortID       = 0;
                    list.TypeID       = 1;
                    list.StatusID     = 0;
                    list.Score        = int.Parse(((DropDownList)GridView1.Rows[i].FindControl("ddlScore")).SelectedValue);
                    list.ScoreIn      = list.Score;
                    list.CreateDate   = DateTime.Now.ToString();
                    list.CreateUserID = member.pk_Member;
                    list.ModifyDate   = DateTime.Now.ToString();
                    list.ModifyUserID = 0;
                    list.Language     = MojoCube.Api.UI.Language.GetLanguage();
                    list.InsertData();
                }
            }
        }

        Response.Redirect(MojoCube.Web.Site.Cache.GetUrlExtension("OrderDetail", MojoCube.Api.UI.Language.GetLanguage()) + "?id=" + MojoCube.Api.Text.Security.EncryptString(ViewState["pk_Order"].ToString()));
    }