/// <summary> /// ��������ƻ����� /// </summary> private void CreateInvitationSchedule() { ScheduleConfigInfo sci = ScheduleConfigs.GetConfig(); //�����¼��Ƿ���� foreach (Discuz.Config.Event ev1 in sci.Events) { if (ev1.Key == "InvitationEvent") return; } //�����µ�����ƻ����� Discuz.Config.Event ev = new Discuz.Config.Event(); ev.Key = "InvitationEvent"; ev.Enabled = true; ev.IsSystemEvent = true; ev.ScheduleType = "Discuz.Event.InvitationEvent, Discuz.Event"; ev.TimeOfDay = 2; ev.Minutes = 1; ScheduleConfigs.SaveConfig(sci); }
/// <summary> /// 建立邀请计划任务 /// </summary> private void CreateInvitationSchedule() { ScheduleConfigInfo sci = ScheduleConfigs.GetConfig(); //检查该事件是否存在 foreach (Discuz.Config.Event ev1 in sci.Events) { if (ev1.Key == "InvitationEvent") { return; } } //建立新的邀请计划任务 Discuz.Config.Event ev = new Discuz.Config.Event(); ev.Key = "InvitationEvent"; ev.Enabled = true; ev.IsSystemEvent = true; ev.ScheduleType = "Discuz.Event.InvitationEvent, Discuz.Event"; ev.TimeOfDay = 2; ev.Minutes = 1; ScheduleConfigs.SaveConfig(sci); }
protected void savepassportinfo_Click(object sender, EventArgs e) { ScheduleConfigInfo sci = ScheduleConfigs.GetConfig(); if (key.Text.Trim() == "") { base.RegisterStartupScript("PAGE", "alert('计划任务名称不能为空!');"); return; } if (scheduletype.Text.Trim() == "") { base.RegisterStartupScript("PAGE", "alert('计划任务类型不能为空!');"); return; } if (type2.Checked && (timeserval.Text == "" || !Utils.IsNumeric(timeserval.Text))) { base.RegisterStartupScript("PAGE", "alert('周期执行时间必须为数值!');"); return; } if (DNTRequest.GetString("keyid") == "") { foreach (Discuz.Config.Event ev1 in sci.Events) { if (ev1.Key == key.Text.Trim()) { base.RegisterStartupScript("PAGE", "alert('计划任务名称已经存在!');"); return; } } Discuz.Config.Event ev = new Discuz.Config.Event(); ev.Key = key.Text; ev.Enabled = true; ev.IsSystemEvent = false; ev.ScheduleType = scheduletype.Text.Trim() ; if (type1.Checked) { ev.TimeOfDay = int.Parse(hour.Text) * 60 + int.Parse(minute.Text); ev.Minutes = sci.TimerMinutesInterval; } else { ev.Minutes = int.Parse(timeserval.Text.Trim()); ev.TimeOfDay = -1; } Discuz.Config.Event[] es = new Discuz.Config.Event[sci.Events.Length + 1]; for (int i = 0; i < sci.Events.Length; i++) { es[i] = sci.Events[i]; } es[es.Length - 1] = ev; sci.Events = es; } else { foreach (Discuz.Config.Event ev1 in sci.Events) { if (key.Text.Trim() != oldkey.Value && ev1.Key == key.Text.Trim()) { base.RegisterStartupScript("PAGE", "alert('计划任务名称已经存在!');"); return; } } foreach (Discuz.Config.Event ev1 in sci.Events) { if (ev1.Key == oldkey.Value) { ev1.Key = key.Text.Trim(); ev1.ScheduleType = scheduletype.Text.Trim(); if (type1.Checked) { ev1.TimeOfDay = int.Parse(hour.Text) * 60 + int.Parse(minute.Text); ev1.Minutes = sci.TimerMinutesInterval; } else { if (int.Parse(timeserval.Text.Trim()) < sci.TimerMinutesInterval) ev1.Minutes = sci.TimerMinutesInterval; else ev1.Minutes = int.Parse(timeserval.Text.Trim()); ev1.TimeOfDay = -1; } if (!ev1.IsSystemEvent) { if (eventenable.Items[0].Selected) ev1.Enabled = true; else ev1.Enabled = false; } break; } } } ScheduleConfigs.SaveConfig(sci); Response.Redirect("global_schedulemanage.aspx"); }
protected void savepassportinfo_Click(object sender, EventArgs e) { ScheduleConfigInfo sci = ScheduleConfigs.GetConfig(); if (key.Text.Trim() == "") { base.RegisterStartupScript("PAGE", "alert('计划任务名称不能为空!');"); return; } if (scheduletype.Text.Trim() == "") { base.RegisterStartupScript("PAGE", "alert('计划任务类型不能为空!');"); return; } if (type2.Checked && (timeserval.Text == "" || !Utils.IsNumeric(timeserval.Text))) { base.RegisterStartupScript("PAGE", "alert('周期执行时间必须为数值!');"); return; } if (DNTRequest.GetString("keyid") == "") { foreach (Discuz.Config.Event ev1 in sci.Events) { if (ev1.Key == key.Text.Trim()) { base.RegisterStartupScript("PAGE", "alert('计划任务名称已经存在!');"); return; } } Discuz.Config.Event ev = new Discuz.Config.Event(); ev.Key = key.Text; ev.Enabled = true; ev.IsSystemEvent = false; ev.ScheduleType = scheduletype.Text.Trim() ; if (type1.Checked) { ev.TimeOfDay = int.Parse(hour.Text) * 60 + int.Parse(minute.Text); ev.Minutes = sci.TimerMinutesInterval; } else { ev.Minutes = int.Parse(timeserval.Text.Trim()); ev.TimeOfDay = -1; } Discuz.Config.Event[] es = new Discuz.Config.Event[sci.Events.Length + 1]; for (int i = 0; i < sci.Events.Length; i++) { es[i] = sci.Events[i]; } es[es.Length - 1] = ev; sci.Events = es; } else { foreach (Discuz.Config.Event ev1 in sci.Events) { if (key.Text.Trim() != oldkey.Value && ev1.Key == key.Text.Trim()) { base.RegisterStartupScript("PAGE", "alert('计划任务名称已经存在!');"); return; } } foreach (Discuz.Config.Event ev1 in sci.Events) { if (ev1.Key == oldkey.Value) { ev1.Key = key.Text.Trim(); ev1.ScheduleType = scheduletype.Text.Trim(); if (type1.Checked) { ev1.TimeOfDay = int.Parse(hour.Text) * 60 + int.Parse(minute.Text); ev1.Minutes = sci.TimerMinutesInterval; } else { if (int.Parse(timeserval.Text.Trim()) < sci.TimerMinutesInterval) ev1.Minutes = sci.TimerMinutesInterval; else ev1.Minutes = int.Parse(timeserval.Text.Trim()); ev1.TimeOfDay = -1; } if (!ev1.IsSystemEvent) { if (eventenable.Items[0].Selected) ev1.Enabled = true; else ev1.Enabled = false; } break; } } } ScheduleConfigs.SaveConfig(sci); Response.Redirect("global_schedulemanage.aspx"); #region /*if (appname.Text.Trim() == "") { base.RegisterStartupScript("PAGE", "alert('整合程序名称不能为空!');"); return; } if (appurl.Text.Trim() == "") { base.RegisterStartupScript("PAGE", "alert('整合程序 Url 地址不能为空!');"); return; } if (callbackurl.Text.Trim() == "") { base.RegisterStartupScript("PAGE", "alert('登录完成后返回地址不能为空!');"); return; } if (ipaddresses.Text.Trim() != "") { foreach (string ip in ipaddresses.Text.Replace("\r\n","").Replace(" ","").Split(',')) { if (!Utils.IsIP(ip)) { base.RegisterStartupScript("PAGE", "alert('IP地址格式错误!');"); return; } } } if (apikeyhidd.Value == "") //增加 { ApplicationInfo ai = new ApplicationInfo(); ai.AppName = appname.Text; ai.AppUrl = appurl.Text; ai.APIKey = Utils.MD5(System.Guid.NewGuid().ToString()); ai.Secret = Utils.MD5(System.Guid.NewGuid().ToString()); ai.CallbackUrl = callbackurl.Text; ai.IPAddresses = ipaddresses.Text.Replace("\r\n","").Replace(" ",""); APIConfigInfo aci = APIConfigs.GetConfig(); if (aci.AppCollection == null) aci.AppCollection = new ApplicationInfoCollection(); aci.AppCollection.Add(ai); APIConfigs.SaveConfig(aci); } else //修改 { APIConfigInfo aci = APIConfigs.GetConfig(); foreach (ApplicationInfo ai in aci.AppCollection) { if (ai.APIKey == apikeyhidd.Value) { ai.AppName = appname.Text; ai.AppUrl = appurl.Text; ai.CallbackUrl = callbackurl.Text; ai.IPAddresses = ipaddresses.Text.Replace("\r\n","").Replace(" ",""); break; } } APIConfigs.SaveConfig(aci); } Response.Redirect("global_passportmanage.aspx");*/ #endregion }
protected void savepassportinfo_Click(object sender, EventArgs e) { ScheduleConfigInfo sci = ScheduleConfigs.GetConfig(); if (key.Text.Trim() == "") { base.RegisterStartupScript("PAGE", "alert('计划任务名称不能为空!');"); return; } if (scheduletype.Text.Trim() == "") { base.RegisterStartupScript("PAGE", "alert('计划任务类型不能为空!');"); return; } if (type2.Checked && (timeserval.Text == "" || !Utils.IsNumeric(timeserval.Text))) { base.RegisterStartupScript("PAGE", "alert('周期执行时间必须为数值!');"); return; } if (DNTRequest.GetString("keyid") == "") { foreach (Discuz.Config.Event ev1 in sci.Events) { if (ev1.Key == key.Text.Trim()) { base.RegisterStartupScript("PAGE", "alert('计划任务名称已经存在!');"); return; } } Discuz.Config.Event ev = new Discuz.Config.Event(); ev.Key = key.Text; ev.Enabled = true; ev.IsSystemEvent = false; ev.ScheduleType = scheduletype.Text.Trim(); if (type1.Checked) { ev.TimeOfDay = int.Parse(hour.Text) * 60 + int.Parse(minute.Text); ev.Minutes = sci.TimerMinutesInterval; } else { ev.Minutes = int.Parse(timeserval.Text.Trim()); ev.TimeOfDay = -1; } Discuz.Config.Event[] es = new Discuz.Config.Event[sci.Events.Length + 1]; for (int i = 0; i < sci.Events.Length; i++) { es[i] = sci.Events[i]; } es[es.Length - 1] = ev; sci.Events = es; } else { foreach (Discuz.Config.Event ev1 in sci.Events) { if (key.Text.Trim() != oldkey.Value && ev1.Key == key.Text.Trim()) { base.RegisterStartupScript("PAGE", "alert('计划任务名称已经存在!');"); return; } } foreach (Discuz.Config.Event ev1 in sci.Events) { if (ev1.Key == oldkey.Value) { ev1.Key = key.Text.Trim(); ev1.ScheduleType = scheduletype.Text.Trim(); if (type1.Checked) { ev1.TimeOfDay = int.Parse(hour.Text) * 60 + int.Parse(minute.Text); ev1.Minutes = sci.TimerMinutesInterval; } else { if (int.Parse(timeserval.Text.Trim()) < sci.TimerMinutesInterval) { ev1.Minutes = sci.TimerMinutesInterval; } else { ev1.Minutes = int.Parse(timeserval.Text.Trim()); } ev1.TimeOfDay = -1; } if (!ev1.IsSystemEvent) { if (eventenable.Items[0].Selected) { ev1.Enabled = true; } else { ev1.Enabled = false; } } break; } } } ScheduleConfigs.SaveConfig(sci); Response.Redirect("global_schedulemanage.aspx"); }
protected void savepassportinfo_Click(object sender, EventArgs e) { ScheduleConfigInfo sci = ScheduleConfigs.GetConfig(); if (key.Text.Trim() == "") { base.RegisterStartupScript("PAGE", "alert('计划任务名称不能为空!');"); return; } if (scheduletype.Text.Trim() == "") { base.RegisterStartupScript("PAGE", "alert('计划任务类型不能为空!');"); return; } if (type2.Checked && (timeserval.Text == "" || !Utils.IsNumeric(timeserval.Text))) { base.RegisterStartupScript("PAGE", "alert('周期执行时间必须为数值!');"); return; } if (DNTRequest.GetString("keyid") == "") { foreach (Discuz.Config.Event ev1 in sci.Events) { if (ev1.Key == key.Text.Trim()) { base.RegisterStartupScript("PAGE", "alert('计划任务名称已经存在!');"); return; } } Discuz.Config.Event ev = new Discuz.Config.Event(); ev.Key = key.Text; ev.Enabled = true; ev.IsSystemEvent = false; ev.ScheduleType = scheduletype.Text.Trim(); if (type1.Checked) { ev.TimeOfDay = int.Parse(hour.Text) * 60 + int.Parse(minute.Text); ev.Minutes = sci.TimerMinutesInterval; } else { ev.Minutes = int.Parse(timeserval.Text.Trim()); ev.TimeOfDay = -1; } Discuz.Config.Event[] es = new Discuz.Config.Event[sci.Events.Length + 1]; for (int i = 0; i < sci.Events.Length; i++) { es[i] = sci.Events[i]; } es[es.Length - 1] = ev; sci.Events = es; } else { foreach (Discuz.Config.Event ev1 in sci.Events) { if (key.Text.Trim() != oldkey.Value && ev1.Key == key.Text.Trim()) { base.RegisterStartupScript("PAGE", "alert('计划任务名称已经存在!');"); return; } } foreach (Discuz.Config.Event ev1 in sci.Events) { if (ev1.Key == oldkey.Value) { ev1.Key = key.Text.Trim(); ev1.ScheduleType = scheduletype.Text.Trim(); if (type1.Checked) { ev1.TimeOfDay = int.Parse(hour.Text) * 60 + int.Parse(minute.Text); ev1.Minutes = sci.TimerMinutesInterval; } else { if (int.Parse(timeserval.Text.Trim()) < sci.TimerMinutesInterval) { ev1.Minutes = sci.TimerMinutesInterval; } else { ev1.Minutes = int.Parse(timeserval.Text.Trim()); } ev1.TimeOfDay = -1; } if (!ev1.IsSystemEvent) { if (eventenable.Items[0].Selected) { ev1.Enabled = true; } else { ev1.Enabled = false; } } break; } } } ScheduleConfigs.SaveConfig(sci); Response.Redirect("global_schedulemanage.aspx"); #region /*if (appname.Text.Trim() == "") * { * base.RegisterStartupScript("PAGE", "alert('整合程序名称不能为空!');"); * return; * } * if (appurl.Text.Trim() == "") * { * base.RegisterStartupScript("PAGE", "alert('整合程序 Url 地址不能为空!');"); * return; * } * if (callbackurl.Text.Trim() == "") * { * base.RegisterStartupScript("PAGE", "alert('登录完成后返回地址不能为空!');"); * return; * } * if (ipaddresses.Text.Trim() != "") * { * foreach (string ip in ipaddresses.Text.Replace("\r\n","").Replace(" ","").Split(',')) * { * if (!Utils.IsIP(ip)) * { * base.RegisterStartupScript("PAGE", "alert('IP地址格式错误!');"); * return; * } * } * } * if (apikeyhidd.Value == "") //增加 * { * ApplicationInfo ai = new ApplicationInfo(); * ai.AppName = appname.Text; * ai.AppUrl = appurl.Text; * ai.APIKey = Utils.MD5(System.Guid.NewGuid().ToString()); * ai.Secret = Utils.MD5(System.Guid.NewGuid().ToString()); * ai.CallbackUrl = callbackurl.Text; * ai.IPAddresses = ipaddresses.Text.Replace("\r\n","").Replace(" ",""); * APIConfigInfo aci = APIConfigs.GetConfig(); * if (aci.AppCollection == null) * aci.AppCollection = new ApplicationInfoCollection(); * aci.AppCollection.Add(ai); * APIConfigs.SaveConfig(aci); * } * else //修改 * { * APIConfigInfo aci = APIConfigs.GetConfig(); * foreach (ApplicationInfo ai in aci.AppCollection) * { * if (ai.APIKey == apikeyhidd.Value) * { * ai.AppName = appname.Text; * ai.AppUrl = appurl.Text; * ai.CallbackUrl = callbackurl.Text; * ai.IPAddresses = ipaddresses.Text.Replace("\r\n","").Replace(" ",""); * break; * } * } * APIConfigs.SaveConfig(aci); * } * Response.Redirect("global_passportmanage.aspx");*/ #endregion }