using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Certificate;
using Base;

public partial class Login_Register : nspBase.MemberBasePge
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!CheckCookies())
        {
            Response.Redirect("../../login/login.aspx");
            return;
        }
    }
    protected void btnServer_Click(object sender, EventArgs e)
    {
        try
        {
            TCertificate TCerti = new TCertificate();
            TCerti.UserID = int.Parse(Base.BasePage.GetCookie("UserID"));
             TCerti.Name = this.txtName.Text;
             TCerti.URL =Common.ProcessImageUrl(ImgUrl1.Value);
            TCerti.Organization = this.txtOrganization.Text;
            TCerti.LicenceDate = Convert.ToDateTime(this.txtLicenceDate.Text);
            TCerti.ExpiryDate = Convert.ToDateTime(this.txtExpiryDate.Text);
            TCerti.AddDate = Convert.ToDateTime(DateTime.Now.Date.ToShortDateString());
            ICertificate RCerti = new RCertificate();
            RCerti.Insert(TCerti);
            ShowMessage("证书添加成功！", "Certificate/Certificate.aspx");
        }
        catch (Exception ex)
        {
            ShowMessage("证书添加失败！", "Certificate/Certificate.aspx");
        }
       
    }

    protected void btnCancel_Click(object sender, EventArgs e)
    {
        Response.Redirect("Certificate.aspx");
    }
}
