Exemple #1
0
        private void SmsOrMessageAdd(OACalendarRemindSet model, int recordid)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(" insert into OA_Calendar_RemindSet(");
            builder.Append("InfoGuid,IsSms,IsMessage,RemindType,RemindHour,RemindMinute,EndDate");
            builder.Append(")");
            builder.Append(" values (");
            builder.Append("'" + model.InfoGuid + "',");
            builder.Append("'" + model.IsSms + "',");
            builder.Append("'" + model.IsMessage + "',");
            builder.Append(model.RemindType + ",");
            builder.Append(model.RemindHour + ",");
            builder.Append(model.RemindMinute + ",");
            builder.Append("'" + model.EndDate + "'");
            builder.Append(")");
            PublicInterface.PTDBSJDelete(recordid.ToString(), "001");
            PublicInterface.PTDBSJTodayDelete(recordid.ToString(), "001");
            PublicInterface.SMSLogDelete(recordid.ToString(), "001");
            PublicInterface.SMSLogTodayDelete(recordid.ToString(), "001");
            if (model.IsSms == "1")
            {
                SMSLog log;
                log = new SMSLog {
                    SendUser    = HttpContext.Current.Session["yhdm"].ToString(),
                    SendTime    = model.EndDate.Date.AddHours((double)model.RemindHour).AddMinutes((double)model.RemindMinute),
                    ReceiveUser = HttpContext.Current.Session["yhdm"].ToString(),
                    Message     = this.strMessage(recordid),
                    V_LXBM      = "001",
                    I_XGID      = recordid.ToString()
                };
                PublicInterface.SendSmsMsg(log);
            }
            if (model.IsMessage == "1")
            {
                PTDBSJ ptdbsj = new PTDBSJ {
                    V_LXBM    = "001",
                    I_XGID    = recordid.ToString(),
                    DTM_DBSJ  = model.EndDate.Date.AddHours((double)model.RemindHour).AddMinutes((double)model.RemindMinute),
                    V_Content = this.strMessage(recordid),
                    V_DBLJ    = "?rid=" + recordid,
                    V_YHDM    = HttpContext.Current.Session["yhdm"].ToString()
                };
                PublicInterface.SendSysMsg(ptdbsj);
            }
            publicDbOpClass.ExecSqlString(builder.ToString());
        }
        private void SmsOrMessageAdd(OACalendarRemindSet model, OACalendarInfo model2, DateTime RDate)
        {
            double num4;
            int    num5;
            int    num = 0;

            switch (model.RemindType)
            {
            case 2:
            {
                TimeSpan span = model.EndDate.Date.Subtract(RDate);
                for (int i = 0; i <= span.Days; i++)
                {
                    num = this.CalendarInfoAdd(model2, RDate.AddDays(Convert.ToDouble(i)).Date.AddHours((double)model.RemindHour).AddMinutes((double)model.RemindMinute));
                    if (model.IsSms == "1")
                    {
                        SMSLog log;
                        log = new SMSLog {
                            SendUser    = HttpContext.Current.Session["yhdm"].ToString(),
                            SendTime    = RDate.AddDays(Convert.ToDouble(i)).Date.AddHours((double)model.RemindHour).AddMinutes((double)model.RemindMinute),
                            ReceiveUser = HttpContext.Current.Session["yhdm"].ToString(),
                            Message     = "日程管理消息:" + model2.Content,
                            V_LXBM      = "001",
                            I_XGID      = num.ToString()
                        };
                        PublicInterface.SendSmsMsg(log);
                    }
                    if (model.IsMessage == "1")
                    {
                        PTDBSJ ptdbsj = new PTDBSJ {
                            V_LXBM     = "001",
                            I_XGID     = num.ToString(),
                            C_OpenFlag = "0",
                            DTM_DBSJ   = RDate.AddDays(Convert.ToDouble(i)).Date.AddHours((double)model.RemindHour).AddMinutes((double)model.RemindMinute),
                            V_Content  = model2.Content,
                            V_TPLJ     = "",
                            V_DBLJ     = "?rid=" + num,
                            V_YHDM     = HttpContext.Current.Session["yhdm"].ToString()
                        };
                        PublicInterface.SendSysMsg(ptdbsj);
                    }
                }
                return;
            }

            case 3:
            {
                TimeSpan span2 = model.EndDate.Date.Subtract(RDate);
                for (int j = 0; j <= span2.Days; j++)
                {
                    if (Convert.ToInt32(RDate.AddDays(Convert.ToDouble(j)).DayOfWeek) == Convert.ToInt32(RDate.DayOfWeek))
                    {
                        num = this.CalendarInfoAdd(model2, RDate.AddDays(Convert.ToDouble(j)).Date.AddHours((double)model.RemindHour).AddMinutes((double)model.RemindMinute));
                        if (model.IsSms == "1")
                        {
                            SMSLog log2;
                            log2 = new SMSLog {
                                SendUser    = HttpContext.Current.Session["yhdm"].ToString(),
                                SendTime    = RDate.AddDays(Convert.ToDouble(j)).Date.AddHours((double)model.RemindHour).AddMinutes((double)model.RemindMinute),
                                ReceiveUser = HttpContext.Current.Session["yhdm"].ToString(),
                                Message     = "日程管理消息:" + model2.Content,
                                V_LXBM      = "001",
                                I_XGID      = num.ToString()
                            };
                            PublicInterface.SendSmsMsg(log2);
                        }
                        if (model.IsMessage == "1")
                        {
                            PTDBSJ ptdbsj2 = new PTDBSJ {
                                V_LXBM     = "001",
                                I_XGID     = num.ToString(),
                                C_OpenFlag = "0",
                                DTM_DBSJ   = RDate.AddDays(Convert.ToDouble(j)).Date.AddHours((double)model.RemindHour).AddMinutes((double)model.RemindMinute),
                                V_Content  = model2.Content,
                                V_TPLJ     = "",
                                V_DBLJ     = "?rid=" + num.ToString(),
                                V_YHDM     = HttpContext.Current.Session["yhdm"].ToString()
                            };
                            PublicInterface.SendSysMsg(ptdbsj2);
                        }
                    }
                }
                return;
            }

            case 4:
                num4 = this.MonthEquals(RDate, model.EndDate);
                num5 = 0;
                break;

            default:
                return;
            }
            while (num5 <= num4)
            {
                num = this.CalendarInfoAdd(model2, RDate.AddMonths(num5).Date.AddHours((double)model.RemindHour).AddMinutes((double)model.RemindMinute));
                if (model.IsSms == "1")
                {
                    SMSLog log3;
                    log3 = new SMSLog {
                        SendUser    = HttpContext.Current.Session["yhdm"].ToString(),
                        SendTime    = RDate.AddMonths(num5).Date.AddHours((double)model.RemindHour).AddMinutes((double)model.RemindMinute),
                        ReceiveUser = HttpContext.Current.Session["yhdm"].ToString(),
                        Message     = "日程管理消息:" + model2.Content,
                        V_LXBM      = "001",
                        I_XGID      = num.ToString()
                    };
                    PublicInterface.SendSmsMsg(log3);
                }
                if (model.IsMessage == "1")
                {
                    PTDBSJ ptdbsj3 = new PTDBSJ {
                        V_LXBM     = "001",
                        I_XGID     = num.ToString(),
                        C_OpenFlag = "0",
                        DTM_DBSJ   = RDate.AddMonths(num5).Date.AddHours((double)model.RemindHour).AddMinutes((double)model.RemindMinute),
                        V_Content  = model2.Content,
                        V_TPLJ     = "",
                        V_DBLJ     = "?rid=" + num.ToString(),
                        V_YHDM     = HttpContext.Current.Session["yhdm"].ToString()
                    };
                    PublicInterface.SendSysMsg(ptdbsj3);
                }
                num5++;
            }
        }