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 System.Data.OleDb;
public partial class UserControl_putFile : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string type = this.FileUpload1.PostedFile.FileName.Substring(this.FileUpload1.PostedFile.FileName.LastIndexOf(".") + 1);
        if (type.ToLower() == "rar" || type.ToLower()=="zip")
        {
            try
            {
                MODEL.File getfile = new MODEL.File();
                getfile.FileFrom = BLL.BLLemployee.getMobile(Session["user"].ToString()).EmployeeID;
                getfile.FileTo = Convert.ToInt32(this.DropDownList1.SelectedValue);
                getfile.FileText = this.TextArea1.Value;
                getfile.FileTime = Convert.ToDateTime(DateTime.Now.ToString());
                getfile.FileName = "~/files/" + this.FileUpload1.FileName;

                BLL.BLLfile.Insert(getfile);
                this.FileUpload1.PostedFile.SaveAs(Server.MapPath("~/files/") + FileUpload1.FileName);

                msgBox.box("发送成功");
                this.FileUpload1.Dispose();
                this.TextArea1.Value = "";

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        else
        {
            msgBox.putMsg("只能上传rar或zip类型文件");
        }
    }
}
