Beispiel #1
0
    public static int appReMail(applications things)
    {
        int    result     = 0;
        string emailTitle = "";
        string finalState = "";
        string nextText   = "";

        if (things.deal == 1)
        {
            emailTitle = "您的众创空间使用申请已被同意"; finalState = "同意"; nextText = "。请使用器械时小心拿放,以免损坏。谢谢合作!";
        }
        else
        {
            emailTitle = "您的众创空间使用申请已被拒绝"; finalState = "拒绝"; nextText = "。请更换申请时间。谢谢合作!";
        }
        DateTime dt = new DateTime();

        TimeTrans.UnixTimestampToDateTime(dt, things.apptime);
        string appDate   = dt.ToString("yyyy年MM月dd日");
        string DateState = "";

        switch (things.state)
        {
        case 0: DateState = "上午"; break;

        case 1: DateState = "下午"; break;

        case 2: DateState = "晚上"; break;
        }
        string emailContent = things.stuname + "您好,您提出的于" + appDate + " " + DateState + "的申请已被" + finalState + nextText;

        result = Mail.SendEmail(myEmail, myPassword, things.email, emailTitle, emailContent, myHost);
        return(result);
    }
Beispiel #2
0
 public void Application1(object sender, EventArgs e)
 {
     try
     {
         using (var db = new ITStudioEntities())
         {
             applications ap = new applications();
             ap.name = takeMaxChar(HttpUtility.HtmlEncode(TxtName.Text.Trim()));
             ap.major = takeMaxChar(HttpUtility.HtmlEncode(TxtMajor.Text.Trim()));
             ap.time = DateTime.Now;
             ap.gender = Convert.ToBoolean(DdlGender.SelectedValue);
             ap.tel = takeMaxChar(HttpUtility.HtmlEncode(TxtTel.Text.Trim())); //####ToDo:验证格式
             ap.job = takeMaxChar(HttpUtility.HtmlEncode(DdlJob.SelectedItem.Text));
             ap.introduction = HttpUtility.HtmlEncode(TxtIntroduction.Value.Trim());
             db.applications.Add(ap);
             db.SaveChanges();
         }
         Response.Write("<script>alert('恭喜您,报名成功');window.window.location.href='index.aspx';</script> ");
     }
     catch
     {
         Response.Write("<script>alert('报名失败,请重试');window.window.location.href='index.aspx';</script> ");
     }
     finally
     {
     }
 }
Beispiel #3
0
    public static int appMail(applications things)
    {
        int      result     = 0;
        string   emailTitle = "您的众创空间使用申请已成功发出";
        DateTime dt         = new DateTime();

        TimeTrans.UnixTimestampToDateTime(dt, things.apptime);
        string appDate   = dt.ToString("yyyy年MM月dd日");
        string DateState = "";

        switch (things.state)
        {
        case 0: DateState = "上午"; break;

        case 1: DateState = "下午"; break;

        case 2: DateState = "晚上"; break;
        }
        string emailContent = things.stuname + "您好,您提出的于" + appDate + " " + DateState + "的申请已发出并且等待管理员审核。申请理由为:" + things.body + "\n如有特殊情况请联系爱特工作室";

        result = Mail.SendEmail(myEmail, myPassword, things.email, emailTitle, emailContent, myHost);
        return(result);
    }
Beispiel #4
0
    public static int teacherMail(applications things)
    {
        int      result     = 0;
        string   emailTitle = "一条新的众创空间申请已经被同意";
        DateTime dt         = new DateTime();

        TimeTrans.UnixTimestampToDateTime(dt, things.apptime);
        string appDate   = dt.ToString("yyyy年MM月dd日");
        string DateState = "";

        switch (things.state)
        {
        case 0: DateState = "上午"; break;

        case 1: DateState = "下午"; break;

        case 2: DateState = "晚上"; break;
        }
        using (var db = new Entities())
        {
            var teacherList = (from it in db.usercontact
                               where it.usclass == 0
                               select it).ToList();
            if (teacherList.Count == 0)
            {
                return(0);
            }
            for (int i = 0; i < teacherList.Count; i++)
            {
                usercontact my           = teacherList[i];
                string      emailContent = "尊敬的" + my.usname + ",由申请人:" + things.stuname + ",提出的于" + appDate + " " + DateState + "的申请已被同意。申请理由为:" + things.body + "\n如有安排请通知爱特工作室";
                Mail.SendEmail(myEmail, myPassword, my.usemail, emailTitle, emailContent, myHost);
                result++;
            }
        }
        return(result);
    }