예제 #1
0
        public int Add(OACalendarRemindSet model, OACalendarInfo model2, DateTime RDate)
        {
            publicDbOpClass.ExecSqlString(" delete OA_Calendar_Info where InfoGuid = '" + model.InfoGuid + "' ");
            StringBuilder builder = new StringBuilder();

            builder.Append(" begin");
            builder.Append(" delete OA_Calendar_RemindSet where InfoGuid = '" + model.InfoGuid + "' ");
            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(")");
            builder.Append(" end");
            DataTable table = publicDbOpClass.DataTableQuary("select * from OA_Calendar_Info where InfoGuid = '" + model.InfoGuid + "' ");

            for (int i = 0; i < table.Rows.Count; i++)
            {
                PublicInterface.PTDBSJDelete(table.Rows[i]["RecordID"].ToString(), "001");
                PublicInterface.PTDBSJTodayDelete(table.Rows[i]["RecordID"].ToString(), "001");
                PublicInterface.SMSLogDelete(table.Rows[i]["RecordID"].ToString(), "001");
                PublicInterface.SMSLogTodayDelete(table.Rows[i]["RecordID"].ToString(), "001");
            }
            this.SmsOrMessageAdd(model, model2, RDate);
            return(publicDbOpClass.ExecSqlString(builder.ToString()));
        }
예제 #2
0
        public OACalendarInfo GetModel(int RecordID)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("select ");
            builder.Append(" RecordID,UserCode,RecordDate,Title,Content,IsRemind,InfoGuid  ");
            builder.Append(" from OA_Calendar_Info ");
            builder.Append(" where RecordID=" + RecordID);
            OACalendarInfo info = new OACalendarInfo();
            DataSet        set  = publicDbOpClass.DataSetQuary(builder.ToString());

            if (set.Tables[0].Rows.Count <= 0)
            {
                return(null);
            }
            if (set.Tables[0].Rows[0]["RecordID"].ToString() != "")
            {
                info.RecordID = int.Parse(set.Tables[0].Rows[0]["RecordID"].ToString());
            }
            info.UserCode = set.Tables[0].Rows[0]["UserCode"].ToString();
            if (set.Tables[0].Rows[0]["RecordDate"].ToString() != "")
            {
                info.RecordDate = DateTime.Parse(set.Tables[0].Rows[0]["RecordDate"].ToString());
            }
            info.Title    = set.Tables[0].Rows[0]["Title"].ToString();
            info.Content  = set.Tables[0].Rows[0]["Content"].ToString();
            info.IsRemind = set.Tables[0].Rows[0]["IsRemind"].ToString();
            info.InfoGuid = (Guid)set.Tables[0].Rows[0]["InfoGuid"];
            return(info);
        }
예제 #3
0
        public int Add(OACalendarInfo model, OACalendarRemindSet model2)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(" begin");
            builder.Append(" insert into OA_Calendar_Info(");
            builder.Append("UserCode,RecordDate,Title,Content,IsRemind,InfoGuid");
            builder.Append(")");
            builder.Append(" values (");
            builder.Append("'" + model.UserCode + "',");
            builder.Append("'" + model.RecordDate + "',");
            builder.Append("'" + model.Title + "',");
            builder.Append("'" + model.Content + "',");
            builder.Append("'" + model.IsRemind + "',");
            builder.Append("'" + model.InfoGuid + "'");
            builder.Append(")");
            builder.Append(";select @@IDENTITY");
            builder.Append(" end");
            object obj2 = publicDbOpClass.ExecuteScalar(builder.ToString());

            if (obj2 == null)
            {
                return(0);
            }
            if (model.IsRemind == "1")
            {
                this.SmsOrMessageAdd(model2, Convert.ToInt32(obj2));
            }
            return(1);
        }
예제 #4
0
    private void PageBind()
    {
        OACalendarInfo model = this.cia.GetModel(this.RecordID);

        this.TxtRecordDate.Text = Convert.ToDateTime(model.RecordDate).ToString("yyyy-MM-dd");
        this.TxtContent.Text    = model.Content;
        this.TxtTitle.Text      = model.Title;
        userManageDb userManageDb = new userManageDb();

        this.TxtUserName.Text   = userManageDb.GetUserName(model.UserCode);
        this.CBIsRemind.Checked = (model.IsRemind == "1");
        if (!this.CBIsRemind.Checked)
        {
            this.CBIsSms.Enabled     = false;
            this.CBIsMessage.Enabled = false;
        }
        this.InfoGuid = model.InfoGuid;
        CalendarRemindSetaction calendarRemindSetaction = new CalendarRemindSetaction();
        OACalendarRemindSet     model2 = calendarRemindSetaction.GetModel(this.InfoGuid);

        if (model2 != null)
        {
            this.TxtHours.Text       = model2.RemindHour.ToString();
            this.TxtMinutes.Text     = model2.RemindMinute.ToString();
            this.CBIsMessage.Checked = (model2.IsMessage == "1");
            this.CBIsSms.Checked     = (model2.IsSms == "1");
            return;
        }
        this.CBIsMessage.Checked = false;
        this.CBIsSms.Checked     = false;
    }
예제 #5
0
    private void PageBind()
    {
        OACalendarInfo model = this.cia.GetModel(this.RecordID);

        if (model != null)
        {
            this.lbRecordDate.Text = Convert.ToDateTime(model.RecordDate).ToString("yyyy-MM-dd");
            this.lbContent.Text    = model.Content;
            this.lbTitle.Text      = model.Title;
            userManageDb userManageDb = new userManageDb();
            this.lbUserName.Text    = userManageDb.GetUserName(model.UserCode);
            this.CBIsRemind.Checked = (model.IsRemind == "1");
        }
    }
예제 #6
0
        public int Update(OACalendarInfo model, OACalendarRemindSet model2)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(" begin");
            builder.Append(" update OA_Calendar_Info set ");
            builder.Append("UserCode='" + model.UserCode + "',");
            builder.Append("Title='" + model.Title + "',");
            builder.Append("Content='" + model.Content + "',");
            builder.Append("IsRemind='" + model.IsRemind + "'");
            builder.Append(" where InfoGuid='" + model.InfoGuid + "'");
            builder.Append(" update OA_Calendar_RemindSet set ");
            builder.Append("IsMessage='" + model2.IsMessage + "',");
            builder.Append("RemindHour=" + model2.RemindHour + ",");
            builder.Append("RemindMinute=" + model2.RemindMinute + ",");
            builder.Append("EndDate='" + model2.EndDate + "'");
            builder.Append(" where InfoGuid='" + model2.InfoGuid + "'");
            builder.Append(" update OA_Calendar_RemindSet set ");
            builder.Append("IsSms='" + model2.IsSms + "',");
            builder.Append("RemindHour=" + model2.RemindHour + ",");
            builder.Append("RemindMinute=" + model2.RemindMinute + ",");
            builder.Append("EndDate='" + model2.EndDate + "'");
            builder.Append(" where InfoGuid='" + model2.InfoGuid + "'");
            DataTable table   = publicDbOpClass.DataTableQuary("select * from OA_Calendar_Info where InfoGuid='" + model.InfoGuid + "'");
            string    content = model.Content;

            if (model.Content.Length > 70)
            {
                content = model.Content.Substring(0, 60) + "...";
            }
            for (int i = 0; i < table.Rows.Count; i++)
            {
                builder.Append(" update PT_SMSLog set Message = '日程管理消息:" + content + "' where I_XGID = '" + table.Rows[i]["RecordID"].ToString() + "'");
                builder.Append(" update PT_SMSLog_Today set Message = '日程管理消息:" + content + "' where I_XGID = '" + table.Rows[i]["RecordID"].ToString() + "'");
                builder.Append(" update PT_DBSJ set V_Content = '" + content + "' where I_XGID = '" + table.Rows[i]["RecordID"].ToString() + "'");
                builder.Append(" update PT_DBSJ_Today set V_Content = '" + content + "' where I_XGID = '" + table.Rows[i]["RecordID"].ToString() + "'");
            }
            builder.Append(" end");
            return(publicDbOpClass.ExecSqlString(builder.ToString()));
        }
예제 #7
0
        private int CalendarInfoAdd(OACalendarInfo model, DateTime rdate)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into OA_Calendar_Info(");
            builder.Append("InfoGuid,UserCode,RecordDate,Title,Content,IsRemind");
            builder.Append(")");
            builder.Append(" values (");
            builder.Append("'" + model.InfoGuid + "',");
            builder.Append("'" + model.UserCode + "',");
            builder.Append("'" + rdate + "',");
            builder.Append("'" + model.Title + "',");
            builder.Append("'" + model.Content + "',");
            builder.Append("'" + model.IsRemind + "'");
            builder.Append(")");
            builder.Append(";select @@IDENTITY");
            object obj2 = publicDbOpClass.ExecuteScalar(builder.ToString());

            if (obj2 != null)
            {
                return(Convert.ToInt32(obj2));
            }
            return(0);
        }
예제 #8
0
        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++;
            }
        }