Пример #1
0
        public void SentResult()
        {
            EmailInfo EInfo = InitializeEmailInfo();
            Email senter = new Email();
            string flag="";
            EmailRecordInfo record = new EmailRecordInfo(Listview.CheckedItems[0].SubItems[6].Text, "受听课教师", EInfo.Title, Listview.CheckedItems[0].SubItems[6].Text + DateTime.Now.ToShortTimeString(), "听课反馈结果", flag, FilePath);
            senter.Send(new Email { Type=2,EI=EInfo,ERI=record,id=0,count=0});

            //help.Insert(record,"Logs_Data");
            //MessageBox.Show(flag);
        }
Пример #2
0
        public void SentResult()
        {
            EmailInfo EInfo = InitializeEmailInfo();

            string flag="";
            EmailRecordInfo record = new EmailRecordInfo(Listview.CheckedItems[0].SubItems[6].Text, "受听课教师", EInfo.Title, Listview.CheckedItems[0].SubItems[6].Text + DateTime.Now.ToShortTimeString(), "听课反馈结果", flag, FilePath);

            AsynEmail EmailSendPoccess = new AsynEmail(EInfo, record, this.EmailResultCallBack);
            EmailSendPoccess.ThreadSend();
            Main.fm.SetStatusText("正在发送邮件", 0);
            //help.Insert(record,"Logs_Data");
            //MessageBox.Show(flag);
        }
Пример #3
0
        private void EmailResultCallBack(EmailRecordInfo info, string message)
        {
            recnuum++;
            Main.fm.SetStatusText(string.Format("已发送{0}封",recnuum), 0);
            SqlHelper help = new SqlHelper();
            help.Insert(info, "Logs_Data");
            if (message=="发送成功")
            {
                successnum++;
            }
            if(recnuum==sentnum){

                MessageBox.Show(string.Format("共发送{0}邮件,成功{1}封,失败{2}封,请查看记录",sentnum,successnum,sentnum-successnum));
                Main.fm.SetStatusText("发送完成", 0);
            }
        }
Пример #4
0
        private void buttonX2_Click(object sender, EventArgs e)
        {
            if (listView1.CheckedItems.Count == 1)
            {
                EmailInfo EInfo = InitializeEmailInfo();
                EmailRecordInfo RInfo = new EmailRecordInfo();
                RInfo.Email_Receiver = listView1.CheckedItems[0].SubItems[1].Text;
                RInfo.Email_Theme = listView1.CheckedItems[0].SubItems[3].Text;
                RInfo.Enclosure_Path = "";
                RInfo.Email_Type = listView1.CheckedItems[0].SubItems[5].Text;
                RInfo.File_State = "";
                RInfo.Time_Now = "";
                RInfo.Teacher_Identity = listView1.CheckedItems[0].SubItems[2].Text;
                AsynEmail EmailSendPoccess = new AsynEmail(EInfo, RInfo, this.EmailResultCallBack);
                EmailSendPoccess.ThreadSend();
                Main.fm.SetStatusText("正在发送邮件", 0);

            }
        }
Пример #5
0
        private ResultCallBack resultcallback; //实例化回调方法

        #endregion Fields

        #region Constructors

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="info">邮件信息</param>
        /// <param name="reinfo">邮件记录</param>
        /// <param name="resultcallback">回调函数</param>
        public AsynEmail(EmailInfo info,EmailRecordInfo reinfo,ResultCallBack resultcallback)
        {
            this.Info = info;
            this.resultcallback = resultcallback;
            this.ReInfo = reinfo;
        }
Пример #6
0
        private void MakeEmail(EmailInfo EInfo,List<string> ListFileName,List<string> ListAddress,SqlHelper help,List<string> ListSupervisor)
        {
            if (Common.Common.MailPassword !="")
            {
                EInfo.User = Common.Common.MailAddress;
                EInfo.PassWord = Common.Common.MailPassword;
                EmailRecordInfo ERecord;
                sentnum = ListFileName.Count;
                for (int i = 0; i < ListFileName.Count; i++)
                {
                    EInfo.AddFiles = ListFileName[i];
                    EInfo.Content = "";
                    EInfo.Receiver = ListAddress[i];
                    EInfo.Title = DateTime.Now + "听课安排";
                    string successflag = "";
                    ERecord = new EmailRecordInfo(ListSupervisor[i], "督导", EInfo.Title, ListSupervisor[i] + DateTime.Now.ToLongTimeString() + i, "听课安排", successflag, ListFileName[i]);

                    AsynEmail EmailSendPoccess = new AsynEmail(EInfo, ERecord, this.EmailResultCallBack);
                    EmailSendPoccess.ThreadSend();
                    //MessageBox.Show(successflag);
                    //help.Insert(ERecord,"Logs_Data");
                    Main.fm.SetStatusText("正在发送邮件", 0);
                }
            }
            else MessageBox.Show("发件人邮箱不能为空,请设置发件人邮箱!");
        }
Пример #7
0
        public int update(string tablename,Object ObjMember)
        {
            int SuccessFlag;
            switch (tablename)
            {
                case "Logs_Data":
                    record = (EmailRecordInfo)ObjMember;
                    string dtLog = string.Format(@"UPDATE " + tablename + " SET  Email_Receiver='{0}', Teacher_Identity='{1}',Email_Theme='{2}',Time_Now='{3}',Email_Type='{4}', File_State'{5}',Enclosure_Path='{6}' WHERE Time_Now='{7}'"
                   ,record.Email_Receiver,record.Teacher_Identity,record.Email_Receiver,record.Time_Now,record.Email_Type,record.File_State,record.Enclosure_Path,record.Time_Now);
                    SuccessFlag = Oledbcommand(dtLog);
                    return SuccessFlag;

                case "SpareTime_Data":
                    supervisor = (SupervisorInfo)ObjMember;
                    string dtSpareTime = string.Format(@"insert into " + tablename + " values('{0}','{1}','{2}' ,{3},{4},{5},{6})", supervisor.SpareID,
                        supervisor.SupervisorId, supervisor.SupervisorName, supervisor.SpareWeek, supervisor.SpareDay, supervisor.SpareNumber, supervisor.Isassigned);

                    SuccessFlag = Oledbcommand(dtSpareTime);
                    return SuccessFlag;
                case "Teachers_Data":
                    teacher = (TeacherInfo)ObjMember;
                    string dtTeacher = string.Format(@"UPDATE "+tablename+" SET Teacher_ID ='{0}', Teacher ='{1}', Email ='{2}', Phone ='{3}', Title ='{4}', IsSupervisor ={5}, Teaching_Section ='{6}', Accept_ClassNumber ={7}, Class_Totality ={8}, Class_WeekNumber ={9}, Class_DayNumber ={10} WHERE  Teacher ='{11}'"
                        , teacher.TeacherId.ToString(), teacher.TeacherName.ToString(), teacher.Email.ToString(), teacher.Phone.ToString(), teacher.Title.ToString(), teacher.IsSupervisor, teacher.TeachingSection.ToString(),
                        teacher.AcceptClassNumber, teacher.ClassTotality, teacher.ClassWeekNumber, teacher.ClassDayNumber,teacher.TeacherName
                        );

                    SuccessFlag = Oledbcommand(dtTeacher);
                    return SuccessFlag;
                case "Placement_Data":
                    placement = (PlacementInfo)ObjMember;
                    string dtPlacement = string.Format(@"UPDATE " + tablename + " SET Class_ID='{0}',Teacher_ID='{1}',Teacher='{2}',Class_week={3},Class_Day={4},Class_Number={5},Supervisor_Name='{6}',Class_Address='{7}',Class_Content='{8}',Class_Name='{9}',Class_Type='{10}',Spcialty='{11}',Grade={12} WHERE  Class_ID='{13}'"
                   , placement.ClassId, placement.TeacherId, placement.TeacherName, placement.ClassWeek, placement.ClassDay, placement.ClassNumber, placement.SupervisorsName,
                   placement.ClassAddress, placement.ClassContent, placement.ClassName, placement.ClassType, placement.Spcialty, placement.Grade,placement.ClassId
                  );
                    SuccessFlag = Oledbcommand(dtPlacement);
                    return SuccessFlag;

            }
            return 0;
        }
Пример #8
0
        public int Insert(Object ObjMember,string Flag)
        {
            int SuccessFlag;
            switch (Flag)
            {
                case "Classes_Data":
                    classes = (ClassInfo)ObjMember;
                    string dtClass = string.Format(@"insert into " + Flag +  " values('{0}','{1}','{2}' ,{3},{4},{5},'{6}','{7}','{8}','{9}','{10}')"
                    ,classes.ClassId,classes.TeacherId,classes.TeacherName,classes.ClassWeek,classes.ClassDay,classes.ClassNumber,classes.ClassName,
                    classes.ClassContent,classes.ClassType,classes.Spcialty);
                    SuccessFlag=Oledbcommand(dtClass);
                    return SuccessFlag;

                case "SpareTime_Data":
                    supervisor = (SupervisorInfo)ObjMember;
                    string dtSpareTime = string.Format(@"insert into " + Flag + " values('{0}','{1}','{2}',{3},{4},{5},{6})",supervisor.SpareID,
                        supervisor.SupervisorId,supervisor.SupervisorName,supervisor.SpareWeek,supervisor.SpareDay,supervisor.SpareNumber,supervisor.Isassigned);

                    SuccessFlag = Oledbcommand(dtSpareTime);
                    return SuccessFlag;
                case "Teachers_Data":
                    teacher = (TeacherInfo)ObjMember;
                    string dtTeacher = string.Format(@"insert into " + Flag + " values('{0}','{1}','{2}' ,'{3}','{4}',{5},'{6}',{7},{8},{9},{10})"
                        ,teacher.TeacherId.ToString(),teacher.TeacherName.ToString(),teacher.Email.ToString(),teacher.Phone.ToString(),teacher.Title.ToString(),teacher.IsSupervisor,teacher.TeachingSection.ToString(),
                        teacher.AcceptClassNumber,teacher.ClassTotality,teacher.ClassWeekNumber,teacher.ClassDayNumber
                        );

                    SuccessFlag = Oledbcommand(dtTeacher);
                    return SuccessFlag;
                case "Placement_Data":
                    placement = (PlacementInfo)ObjMember;
                    string dtPlacement = string.Format(@"insert into " + Flag + " values('{0}','{1}','{2}',{3},{4},'{5}','{6}','{7}','{8}','{9}','{10}','{11}',{12})"
                   ,placement.ClassId,placement.TeacherId,placement.TeacherName,placement.ClassWeek,placement.ClassDay,placement.ClassNumber,placement.SupervisorsName,
                   placement.ClassAddress,placement.ClassContent,placement.ClassName,placement.ClassType,placement.Spcialty,placement.Grade
                  );
                    SuccessFlag = Oledbcommand(dtPlacement);
                    return SuccessFlag;
                case "Logs_Data":
                    record = (EmailRecordInfo)ObjMember;
                    string dtLog = string.Format(@"insert into "+Flag+" values('{0}','{1}','{2}','{3}','{4}','{5}','{6}')",record.Email_Receiver,record.Teacher_Identity,record.Email_Theme
                        ,record.Time_Now,record.Email_Type,record.File_State,record.Enclosure_Path);
                    SuccessFlag = Oledbcommand(dtLog);
                    return SuccessFlag;

            }
            return 0;
        }
Пример #9
0
 private void MakeEmail(EmailInfo EInfo,List<string> ListFileName,List<string> ListAddress,Email senter,SqlHelper help,List<string> ListSupervisor)
 {
     EInfo.User = Common.Common.MailAddress;
     EInfo.PassWord = Common.Common.MailPassword;
     EmailRecordInfo ERecord;
     for (int i = 0; i < ListFileName.Count; i++)
     {
         EInfo.AddFiles = ListFileName[i];
         EInfo.Content = "";
         EInfo.Receiver = ListAddress[i];
         EInfo.Title = DateTime.Now + "听课安排";
         string successflag="";
         ERecord = new EmailRecordInfo(ListSupervisor[i], "督导", EInfo.Title, ListSupervisor[i] + DateTime.Now.ToLongTimeString()+i, "听课安排", successflag, ListFileName[i]);
         senter.Send(new Email {Type=0,EI= EInfo,ERI=ERecord,list=listView1,id=i,count=ListFileName.Count-1});
         //MessageBox.Show(successflag);
         //help.Insert(ERecord,"Logs_Data");
     }
 }