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())); }
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()); }