private void GetMail()
    {
        string receiveid = Request.Cookies["id"].Value.ToString();
        string mailtype  = "开题材料";

        Fannie.Mail ml = new Fannie.Mail();
        DataTable   dt = new DataTable();
        DataSet     ds = ml.GetMyMail(1, receiveid, mailtype);
        DataColumn  dc = new DataColumn();

        dc.ColumnName = "DataNo";
        ds.Tables[0].Columns.Add(dc);
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            ds.Tables[0].Rows[i]["DataNo"] = (i + 1).ToString();
        }
        MailList.DataKeyNames = new string[] { "MailNo" };
        MailList.DataSource   = ds;
        MailList.DataBind();
        dt = ds.Tables[0];
        if (dt.Rows.Count == 0)
        {
            Label1.Visible = true;
        }
        else
        {
            Label1.Visible = false;
        }
    }
    /// <summary>
    /// 删除所选文件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        int count = 0;
        int flag  = this.MailList.Rows.Count;

        Fannie.Mail ml2 = new Fannie.Mail();
        for (int i = 0; i < flag; i++)
        {
            CheckBox cb = (CheckBox)this.MailList.Rows[i].FindControl("CB1");
            if (cb.Checked == true)
            {
                ml2.DeleteMail(Convert.ToInt32(MailList.DataKeys[i].Value.ToString()));
            }
            else
            {
                count++;
            }
        }
        if (count == flag)
        {
            Response.Write("<script>alert('请先选择需要删除的记录');window.location.href='ReportOutbox.aspx';</script>");
        }
        else
        {
            Response.Write("<script>alert('已经删除所选记录');window.location.href='ReportOutbox.aspx';</script>");
        }
    }
Esempio n. 3
0
    protected void rblCheck_SelectedIndexChanged(object sender, EventArgs e)
    {
        int flag = 0;

        Fannie.Mail ml = new Fannie.Mail();
        if (rblCheck.SelectedValue == "审核通过")
        {
            flag = ml.UpdateMailContents(MailID, "审核通过");
            if (flag > 0)
            {
                Response.Write("<script>alert('论文已审核,状态为“审核通过”')</script>");
            }
            else
            {
                Response.Write("<script>alert('请重新审核!')</script>");
            }
        }
        else if (rblCheck.SelectedValue == "审核未通过")
        {
            flag = ml.UpdateMailContents(MailID, "审核未通过");
            if (flag > 0)
            {
                Response.Write("<script>alert('论文已审核,状态为“审核未通过”')</script>");
            }
            else
            {
                Response.Write("<script>alert('请重新审核!')</script>");
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //获取ID
        MailID = Convert.ToInt32(Request.QueryString["id"].ToString());
        Fannie.Mail ml = new Fannie.Mail();
        DataSet     ds = new DataSet();

        ds = ml.GetMyOneMail(typeid, MailID);
        DataTable dt1 = ds.Tables[0];

        if (dt1.Rows[0]["AccessoryPath"].ToString() == "")
        {
            IsAccessory.Visible = true;
            lnkdownfile.Visible = false;
        }
        else
        {
            IsAccessory.Visible = false;
            lnkdownfile.Visible = true;
        }
        if (!IsPostBack)
        {
            txt_theme.Text  = dt1.Rows[0]["Theme"].ToString();
            txt_sender.Text = dt1.Rows[0]["TeacherName"].ToString();
        }
    }
Esempio n. 5
0
    protected void DownloadBtn_Click(object sender, EventArgs e)
    {
        Fannie.Mail dz2 = new Fannie.Mail();
        DataTable   dt2 = new DataTable();
        ImageButton img = (ImageButton)sender;

        dt2 = dz2.GetOneMail(1, Convert.ToInt32(img.CommandArgument.ToString())).Tables[0];
        //dt2 = dz2.GetOneMail(1,8).Tables[0];
        //获取文件名
        string FileNameNoExtension = System.IO.Path.GetFileNameWithoutExtension(dt2.Rows[0]["AccessoryPath"].ToString()).ToLower();
        //获取文件后缀
        string FileExtension = System.IO.Path.GetExtension(dt2.Rows[0]["AccessoryPath"].ToString()).ToLower();
        string FileFullName  = FileNameNoExtension + FileExtension;
        string filepath      = Server.MapPath("~/") + "Mail\\" + FileFullName;

        if (dt2.Rows[0]["AccessoryPath"].ToString() != "")
        {
            Response.Clear();
            Response.Charset     = "utf-8";
            Response.Buffer      = true;
            this.EnableViewState = false;
            Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileFullName));
            //Response.Redirect(dt2.Rows[0]["filepath"].ToString());
            Response.ContentType = "application/unknown";
            Response.WriteFile(filepath);
            Response.Flush();
            Response.Close();
            Response.End();
        }
        else
        {
            Response.Write("<script>alert('该文件不存在!');window.history.back();</script>");
        }
    }
Esempio n. 6
0
    private void GetMail()
    {
        string senderid = Request.Cookies["id"].Value.ToString();
        string mailtype = "答疑";

        Fannie.Mail ml = new Fannie.Mail();
        DataTable   dt = new DataTable();
        DataSet     ds = ml.GetMyMail(2, senderid, mailtype);
        DataColumn  dc = new DataColumn();

        dc.ColumnName = "DataNo";
        ds.Tables[0].Columns.Add(dc);
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            ds.Tables[0].Rows[i]["DataNo"] = (i + 1).ToString();
        }
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            ds.Tables[0].Rows[i]["Theme"]    = SubStr(Convert.ToString(ds.Tables[0].Rows[i]["Theme"]), 40);
            ds.Tables[0].Rows[i]["Contents"] = SubStr(Convert.ToString(ds.Tables[0].Rows[i]["Contents"]), 50);
        }
        dt = ds.Tables[0];
        if (dt.Rows.Count == 0)
        {
            Label1.Visible = true;
        }
        else
        {
            Label1.Visible = false;
        }
        MailList.DataKeyNames = new string[] { "MailNo" };
        MailList.DataSource   = ds;
        MailList.DataBind();
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Cookies["id"] != null)
     {
         id = Request.Cookies["id"].Value.ToString();
     }
     Fannie.Mail mail = new Fannie.Mail();
     dt = mail.GetSendToTeacher(id).Tables[0];
     if (!IsPostBack)
     {
         GetTeacherName();
     }
 }
Esempio n. 8
0
    private void GetStuName()
    {
        Fannie.Mail mail = new Fannie.Mail();
        DataTable   dt   = mail.GetSendToStu(1, id).Tables[0];

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            ListItem li = new ListItem();
            li.Text = dt.Rows[i][1].ToString();
            ddlTeacher.Items.Add(li);
            li = null;
        }
    }
    //删除本条记录
    protected void Delete_Click(object sender, EventArgs e)
    {
        Fannie.Mail ml   = new Fannie.Mail();
        int         flag = ml.DeleteMail(MailID);

        if (flag > 0)
        {
            Response.Write("<script>alert('此信息已被删除!');window.location='ReportOutbox.aspx';</script>");
        }
        else
        {
            Response.Write("<script>alert('信息未被删除!');window.location='ReportOutboxRead.aspx';</script>");
        }
    }
Esempio n. 10
0
    protected void btByTea_Click(object sender, EventArgs e)
    {
        Fannie.Mail mail = new Fannie.Mail();
        DataSet     ds   = mail.GetMailByTea(Request.Cookies["id"].Value.ToString(), "归档材料");
        DataColumn  dc   = new DataColumn();

        dc.ColumnName = "AID";
        ds.Tables[0].Columns.Add(dc);
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            ds.Tables[0].Rows[i]["AID"] = (i + 1).ToString();
        }
        gvDataFile.DataSource = ds;
        gvDataFile.DataBind();
    }
Esempio n. 11
0
    private void GetFileBind()
    {
        Fannie.Mail mail = new Fannie.Mail();
        DataSet     ds   = mail.GetMail("1", Request.Cookies["id"].Value.ToString(), "归档材料");
        DataColumn  dc   = new DataColumn();

        dc.ColumnName = "AID";
        ds.Tables[0].Columns.Add(dc);
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            ds.Tables[0].Rows[i]["AID"] = (i + 1).ToString();
        }
        gvDataFile.DataSource = ds;
        gvDataFile.DataBind();
    }
Esempio n. 12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Cookies["id"] != null)
     {
         id = Request.Cookies["id"].Value.ToString();
     }
     Fannie.Mail mail = new Fannie.Mail();
     dt = mail.GetSendToTeacher(id).Tables[0];
     if (!IsPostBack)
     {
         GetTeacherName();
     }
     //if (Request.QueryString["tid"] != null)
     //{
     //    tid = Request.QueryString["tid"].ToString();
     //    txt_theme.Text = "关于‘" + Request.QueryString["title"].ToString() + "’的回复";
     //    Fannie.Users user = new Fannie.Users();
     //    tbSendTo.Text = user.GetUserName(tid, 1);
     //    ddlTeacher.Visible = false;
     //}
 }
Esempio n. 13
0
    //protected void Delete_Click(object sender, EventArgs e)
    //{
    //    Fannie.Mail ml = new Fannie.Mail();
    //    int flag = ml.DeleteMail(MailID);
    //    if (flag > 0)
    //    {
    //        Response.Write("<script>alert('此信息已被删除!');window.location='PaperManage.aspx';</script>");
    //    }
    //    else
    //    {
    //        Response.Write("<script>alert('信息未被删除!');window.location='PaperRead.aspx';</script>");
    //    }
    //}
    protected void lnkdownfile_Click(object sender, EventArgs e)
    {
        Fannie.Mail ml = new Fannie.Mail();
        DataSet     ds = new DataSet();

        ds = ml.GetOneMail(typeid, MailID);
        DataTable dt = ds.Tables[0];

        if (dt.Rows[0]["AccessoryPath"].ToString() != "")
        {
            //if (!File.Exists(dt.Rows[0]["AccessoryPath"].ToString()))
            //{
            //    Response.Write("<script>alert('附件不存在!')<script>");
            //}
            //else
            //{
            //获取文件名
            string FileNameNoExtension = System.IO.Path.GetFileNameWithoutExtension(dt.Rows[0]["AccessoryPath"].ToString()).ToLower();
            //获取文件后缀
            string FileExtension = System.IO.Path.GetExtension(dt.Rows[0]["AccessoryPath"].ToString()).ToLower();
            string FileFullName  = FileNameNoExtension + FileExtension;
            string filepath      = Server.MapPath("~/") + "Mail\\" + FileFullName;
            Response.Clear();
            Response.Charset     = "UTF-8";
            Response.Buffer      = true;
            this.EnableViewState = false;
            Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileFullName));
            //Response.Redirect(dt.Rows[0]["filepath"].ToString());
            Response.ContentType = "application/unknown";
            Response.WriteFile(filepath);
            Response.Flush();
            Response.Close();
            Response.End();
            //}
        }
        else
        {
            Response.Write("<script>alert('文件不存在!');window.history.back();</script>");
        }
    }
Esempio n. 14
0
    /// <summary>
    /// 提交上传的文件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_Commit_Click(object sender, EventArgs e)
    {
        #region 属性
        int      flag1;
        string   mailtheme;
        string   mailcontent;
        string   filepath;
        DateTime sendertime = DateTime.Now;
        string   signdate   = DateTime.Now.ToString("yyyyMMddHHmm");

        Fannie.Mail ml = new Fannie.Mail();
        #endregion

        if (FileUploadMain.HasFile)
        {
            #region 判断控件内添加的文件是否属于规定类型,否则警告
            if (FileUploadMain.HasFile)
            {
                bool     fileOK            = false;
                string   fileExtension     = System.IO.Path.GetExtension(FileUploadMain.FileName).ToLower();
                String[] allowedExtensions = { ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".rar", ".zip" };
                for (int i = 0; i < allowedExtensions.Length; i++)
                {
                    if (fileExtension == allowedExtensions[i])
                    {
                        fileOK = true;
                    }
                }
                if (fileOK == false)
                {
                    Response.Write("<script>alert('上传的材料只能是.doc、.docx、.xls、.xlsx、.ppt、.pptx、.rar、zip类型!请重新上传。')</script>");
                    return;
                }
            }
            #endregion

            #region 判断上传的文件是否大于50MB
            if (FileUploadMain.HasFile)
            {
                int filesize = (FileUploadMain.PostedFile.ContentLength);
                if (filesize > 50000000)
                {
                    Response.Write("<script>alert('您上传的文件大于50MB,请重新选择')<script>");
                    return;
                }
            }
            #endregion

            //获取文件名
            string FileNameNoExtension = System.IO.Path.GetFileNameWithoutExtension(FileUploadMain.FileName).ToLower();
            //获取文件后缀
            string FileExtension = System.IO.Path.GetExtension(FileUploadMain.FileName).ToLower();

            #region 判断服务器是否存在同名文件,如是则要求更改,否则上传成功
            filepath = Server.MapPath("~/") + "Mail\\" + signdate + "-" + FileUploadMain.FileName;
            if (File.Exists(filepath))
            {
                Response.Write("<script>alert('您即将上传的材料已存在,请重新选择文件或者更改文件名')<script>");
            }
            FileUploadMain.SaveAs(filepath);
        }
        else
        {
            filepath = "";
        }
        mailtheme   = txt_theme.Text;
        mailcontent = "";
        if (ViewState["tid1"] == null)
        {
            tid1 = "";
        }
        else
        {
            tid1 = ViewState["tid1"].ToString();
        }
        if (ViewState["tid2"] == null)
        {
            tid2 = "";
        }
        else
        {
            tid2 = ViewState["tid2"].ToString();
        }
        if (tid2 == "")
        {
            flag1 = ml.AddMail(id, tid1, mailtheme, mailcontent, sendertime, mailtype, filepath);
        }
        else
        {
            flag1 = ml.AddMail(id, tid1, mailtheme, mailcontent, sendertime, mailtype, filepath);
            ml.AddMail(id, tid2, mailtheme, mailcontent, sendertime, mailtype, filepath);
        }
        if (flag1 > 0)
        {
            Response.Write("<script language='javascript'>alert('上传材料成功!');window.location.href='ReportSend.aspx';</script>");
        }
        else
        {
            Response.Write("<script language='javascript'>alert('上传材料失败!');window.location.href='ReportSend.aspx';</script>");
        }
        #endregion
    }
    /// <summary>
    /// 提交上传的文件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_Commit_Click(object sender, EventArgs e)
    {
        #region 属性
        int      flag1 = 0;
        string   mailtheme;
        string   mailcontent;
        string   filepath;
        string   mailtype   = "归档材料";
        DateTime sendertime = DateTime.Now;
        string   signdate   = DateTime.Now.ToString("yyyyMMddHHmm");

        Fannie.Mail ml = new Fannie.Mail();
        #endregion

        #region 判断控件内添加的文件是否属于规定类型,否则警告
        if (FileUploadMain.HasFile)
        {
            bool     fileOK            = false;
            string   fileExtension     = System.IO.Path.GetExtension(FileUploadMain.FileName).ToLower();
            String[] allowedExtensions = { ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".rar", ".zip" };
            for (int i = 0; i < allowedExtensions.Length; i++)
            {
                if (fileExtension == allowedExtensions[i])
                {
                    fileOK = true;
                }
            }
            if (fileOK == false)
            {
                Response.Write("<script>alert('上传的附件只能是.doc、.docx、.xls、.xlsx、.ppt、.pptx、.rar、zip类型!请重新上传。')</script>");
                return;
            }
            int filesize = (FileUploadMain.PostedFile.ContentLength);
            if (filesize > 200000000)
            {
                Response.Write("<script>alert('您上传的文件大于200MB,请重新选择')<script>");
                return;
            }
            else
            {
                //获取文件名
                string FileNameNoExtension = System.IO.Path.GetFileNameWithoutExtension(FileUploadMain.FileName).ToLower();
                //获取文件后缀
                string FileExtension = System.IO.Path.GetExtension(FileUploadMain.FileName).ToLower();
                filepath = Server.MapPath("~/") + "Mail\\" + signdate + "-" + FileUploadMain.FileName;
                if (File.Exists(filepath))
                {
                    Response.Write("<script>alert('您即将上传的附件已存在,请重新选择文件或者更改文件名')<script>");
                }
                FileUploadMain.SaveAs(filepath);
            }
        }
        else
        {
            filepath = "";
        }
        #endregion
        string[] name = tbSendTo.Text.Split(',');
        mailtheme   = txt_theme.Text;
        mailcontent = "";
        Fannie.Manager man   = new Fannie.Manager();
        string         admin = man.GetAdminID().Tables[0].Rows[0][0].ToString();
        if (tbSendTo.Text != "")
        {
            flag1 = ml.AddMail(id, admin, mailtheme, mailcontent, sendertime, mailtype, filepath);
        }
        if (flag1 > 0)
        {
            Response.Write("<script language='javascript'>alert('发送成功!');window.location.href='FinalDataOutbox.aspx';</script>");
        }
        else
        {
            Response.Write("<script language='javascript'>alert('发送失败!');window.location.href='SendFinalData.aspx';</script>");
        }
    }
Esempio n. 16
0
    /// <summary>
    /// 提交上传的文件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_Commit_Click(object sender, EventArgs e)
    {
        #region 属性
        int      flag1 = 0;
        string   mailtheme;
        string   mailcontent;
        string   filepath;
        string   mailtype   = "答疑";
        DateTime sendertime = DateTime.Now;
        string   signdate   = DateTime.Now.ToString("yyyyMMddHHmm");

        Fannie.Mail ml = new Fannie.Mail();
        #endregion

        #region 判断控件内添加的文件是否属于规定类型,否则警告
        if (FileUploadMain.HasFile)
        {
            bool     fileOK            = false;
            string   fileExtension     = System.IO.Path.GetExtension(FileUploadMain.FileName).ToLower();
            String[] allowedExtensions = { ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".rar", ".zip" };
            for (int i = 0; i < allowedExtensions.Length; i++)
            {
                if (fileExtension == allowedExtensions[i])
                {
                    fileOK = true;
                }
            }
            if (fileOK == false)
            {
                Response.Write("<script>alert('上传的附件只能是.doc、.docx、.xls、.xlsx、.ppt、.pptx、.rar、zip类型!请重新上传。')</script>");
                return;
            }
            int filesize = (FileUploadMain.PostedFile.ContentLength);
            if (filesize > 50000000)
            {
                Response.Write("<script>alert('您上传的文件大于50MB,请重新选择')<script>");
                return;
            }
            else
            {
                //获取文件名
                string FileNameNoExtension = System.IO.Path.GetFileNameWithoutExtension(FileUploadMain.FileName).ToLower();
                //获取文件后缀
                string FileExtension = System.IO.Path.GetExtension(FileUploadMain.FileName).ToLower();
                filepath = Server.MapPath("~/") + "Mail\\" + signdate + "-" + FileUploadMain.FileName;
                if (File.Exists(filepath))
                {
                    Response.Write("<script>alert('您即将上传的附件已存在,请重新选择文件或者更改文件名')<script>");
                }
                FileUploadMain.SaveAs(filepath);
            }
        }
        else
        {
            filepath = "";
        }
        #endregion
        string[] name = tbSendTo.Text.Split(',');
        mailtheme   = txt_theme.Text;
        mailcontent = txt_contents.Text;
        if (tbSendTo.Text != "")
        {
            if (ddlTeacher.Visible)
            {
                Fannie.Mail mail = new Fannie.Mail();
                DataTable   dt   = mail.GetSendToStu(2, Request.Cookies["id"].Value.ToString()).Tables[0];
                for (int i = 0; i < name.Length; i++)
                {
                    for (int j = 0; j < dt.Rows.Count; j++)
                    {
                        if (name[i] == dt.Rows[j][1].ToString())
                        {
                            flag1 = ml.AddMail(id, dt.Rows[j][0].ToString(), mailtheme, mailcontent, sendertime, mailtype, filepath);
                        }
                    }
                }
            }
            else
            {
                flag1 = ml.AddMail(id, sid, mailtheme, mailcontent, sendertime, mailtype, filepath);
            }
        }
        if (flag1 > 0)
        {
            Response.Write("<script language='javascript'>alert('回复答疑成功!');window.location.href='MailManage.aspx';</script>");
        }
        else
        {
            Response.Write("<script language='javascript'>alert('回复答疑失败!');window.location.href='SendMail.aspx';</script>");
        }
    }