00001: 'Выходные параметры контрола. Считываются как свойства. 00002: Dim Schedule_start_date As Long 00003: Dim Schedule_end_date As Long 00004: Dim Schedule_start_time As Long 00005: Dim Schedule_end_time As Long 00006: Dim Schedule_freq_type As SQL_freq_type 00007: Dim Schedule_freq_interval As Long 00008: Dim Schedule_freq_subday_type As SQL_freq_subday_type 00009: Dim Schedule_freq_subday_interval As Long 00010: Dim Schedule_freq_relative_interval As SQL_freq_relative_interval 00011: Dim Schedule_freq_recurrence_factor As Long 00012: ' 00013: 'Входные (заданные юзером) параметры. Отображаются по Refresh(). 00014: Dim Set_start_date As Long 00015: Dim Set_end_date As Long 00016: Dim Set_start_time As Long 00017: Dim Set_end_time As Long 00018: Dim Set_freq_type As SQL_freq_type 00019: Dim Set_freq_interval As Long 00020: Dim Set_freq_subday_type As SQL_freq_subday_type 00021: Dim Set_freq_subday_interval As Long 00022: Dim Set_freq_relative_interval As SQL_freq_relative_interval 00023: Dim Set_freq_recurrence_factor As Long 00024: ' 00025: ' 00026: Enum SQL_freq_type 00027: SQL_freq_type_Once = 1 00028: SQL_freq_type_Daily = 4 00029: SQL_freq_type_Weekly = 8 00030: SQL_freq_type_Monthly = 16 00031: SQL_freq_type_Monthly_relative_to_freq_interval = 32 00032: SQL_freq_type_when_SQLServerAgent_starts = 64 00033: SQL_freq_type_when_computer_idle = 128 00034: End Enum 00035: ' 00036: Enum SQL_freq_interval_for_weekly 00037: SQL_freq_interval_for_weekly_Sunday = 1 00038: SQL_freq_interval_for_weekly_Monday = 2 00039: SQL_freq_interval_for_weekly_Tuesday = 4 00040: SQL_freq_interval_for_weekly_Wednesday = 8 00041: SQL_freq_interval_for_weekly_Thursday = 16 00042: SQL_freq_interval_for_weekly_Friday = 32 00043: SQL_freq_interval_for_weekly_Saturday = 64 00044: End Enum 00045: ' 00046: Enum SQL_freq_interval_for_monthly_relative 00047: SQL_freq_interval_for_monthly_relative_Sunday = 1 00048: SQL_freq_interval_for_monthly_relative_Monday = 2 00049: SQL_freq_interval_for_monthly_relative_Tuesday = 3 00050: SQL_freq_interval_for_monthly_relative_Wednesday = 4 00051: SQL_freq_interval_for_monthly_relative_Thursday = 5 00052: SQL_freq_interval_for_monthly_relative_Friday = 6 00053: SQL_freq_interval_for_monthly_relative_Saturday = 7 00054: SQL_freq_interval_for_monthly_relative_Day = 8 00055: SQL_freq_interval_for_monthly_relative_Weekday = 9 00056: SQL_freq_interval_for_monthly_relative_Weekend_Day = 10 00057: End Enum 00058: ' 00059: Enum SQL_freq_subday_type 00060: SQL_freq_subday_type_At_the_specified_time = &H1 00061: SQL_freq_subday_type_Minutes = &H4 00062: SQL_freq_subday_type_Hours = &H8 00063: End Enum 00064: ' 00065: Enum SQL_freq_relative_interval 00066: SQL_freq_relative_interval_First = 1 00067: SQL_freq_relative_interval_Second = 2 00068: SQL_freq_relative_interval_Third = 4 00069: SQL_freq_relative_interval_Fourth = 8 00070: SQL_freq_relative_interval_Last = 16 00071: End Enum 00072: ' 00073: Enum tType 00074: tOne = 1 00075: tSomeDay = 2 00076: tSomeWeek = 3 00077: tSomeMonth = 4 00078: End Enum 00079: ' 00080: Enum oType 00081: oWhenCpuIdle = 1 00082: oWhenAgentStart = 2 00083: oAtDate = 3 00084: End Enum 00085: ' 00086: Event Changed() 00087: Dim Load1 As Boolean 00088: ' 00089: Public Property Get Start_date() As Long 00090: Start_date = Schedule_start_date 00091: End Property 00092: ' 00093: Public Property Let Start_date(ByVal New_start_date As Long) 00094: Set_start_date = New_start_date 00095: End Property 00096: ' 00097: Public Property Get End_date() As Long 00098: End_date = Schedule_end_date 00099: End Property 00100: ' 00101: Public Property Let End_date(ByVal New_end_date As Long) 00102: Set_end_date = New_end_date 00103: End Property 00104: ' 00105: Public Property Get Start_time() As Long 00106: Start_time = Schedule_start_time 00107: End Property 00108: ' 00109: Public Property Let Start_time(ByVal New_start_time As Long) 00110: Set_start_time = New_start_time 00111: End Property 00112: ' 00113: Public Property Get End_time() As Long 00114: End_time = Schedule_end_time 00115: End Property 00116: ' 00117: Public Property Let End_time(ByVal New_end_time As Long) 00118: Set_end_time = New_end_time 00119: End Property 00120: ' 00121: Public Property Get Freq_type() As Long 00122: Freq_type = Schedule_freq_type 00123: End Property 00124: ' 00125: Public Property Let Freq_type(ByVal New_freq_type As Long) 00126: Set_freq_type = New_freq_type 00127: End Property 00128: ' 00129: Public Property Get Freq_interval() As Long 00130: Freq_interval = Schedule_freq_interval 00131: End Property 00132: ' 00133: Public Property Let Freq_interval(ByVal New_freq_interval As Long) 00134: Set_freq_interval = New_freq_interval 00135: End Property 00136: ' 00137: Public Property Get Freq_subday_type() As Long 00138: Freq_subday_type = Schedule_freq_subday_type 00139: End Property 00140: ' 00141: Public Property Let Freq_subday_type(ByVal New_freq_subday_type As Long) 00142: Set_freq_subday_type = New_freq_subday_type 00143: End Property 00144: ' 00145: Public Property Get Freq_subday_interval() As Long 00146: Freq_subday_interval = Schedule_freq_subday_interval 00147: End Property 00148: ' 00149: Public Property Let Freq_subday_interval(ByVal New_freq_subday_interval As Long) 00150: Set_freq_subday_interval = New_freq_subday_interval 00151: End Property 00152: ' 00153: Public Property Get Freq_relative_interval() As Long 00154: Freq_relative_interval = Schedule_freq_relative_interval 00155: End Property 00156: ' 00157: Public Property Let Freq_relative_interval(ByVal New_freq_relative_interval As Long) 00158: Set_freq_relative_interval = New_freq_relative_interval 00159: End Property 00160: ' 00161: Public Property Get Freq_recurrence_factor() As Long 00162: Freq_recurrence_factor = Schedule_freq_recurrence_factor 00163: End Property 00164: ' 00165: Public Property Let Freq_recurrence_factor(ByVal New_freq_recurrence_factor As Long) 00166: Set_freq_recurrence_factor = New_freq_recurrence_factor 00167: End Property 00168: ' 00169: 00170: Public Sub Refresh() 00171: 'иначе скачок в комбешнике Schedule_start_time сразу сбросит переменную в другом комбешнике Schedule_start_date 00172: 00173: Load1 = True 00174: Select Case Set_freq_type 00175: 00176: Case SQL_freq_type.SQL_freq_type_when_computer_idle 00177: cbType.ListIndex = FindIndexByItemData(cbType, tType.tOne) 00178: 'во фрейме Единоразово 00179: cbOne.ListIndex = FindIndexByItemData(cbOne, oType.oWhenCpuIdle) 00180: 00181: Case SQL_freq_type.SQL_freq_type_when_SQLServerAgent_starts 00182: cbType.ListIndex = FindIndexByItemData(cbType, tType.tOne) 00183: 'во фрейме Единоразово 00184: cbOne.ListIndex = FindIndexByItemData(cbOne, oType.oWhenAgentStart) 00185: 00186: Case SQL_freq_type.SQL_freq_type_Once 00187: cbType.ListIndex = FindIndexByItemData(cbType, tType.tOne) 00188: 'во фрейме Единоразово 00189: cbOne.ListIndex = FindIndexByItemData(cbOne, oType.oAtDate) 00190: OneTime.Value = SQLFormatOfTimeDecode(Set_start_time) 00191: OneDate.Value = SQLFormatOfDateDecode(Set_start_date) 00192: 00193: Case SQL_freq_type.SQL_freq_type_Daily 00194: cbType.ListIndex = FindIndexByItemData(cbType, tType.tSomeDay) 00195: 'во фрейме даты запуска 00196: FromDate.Value = SQLFormatOfDateDecode(Set_start_date) 00197: If Set_end_date = 99991231 Then 00198: NoToDate.Value = 1 00199: Else 00200: ToDate.Value = SQLFormatOfDateDecode(Set_end_date) 00201: End If 00202: 'во фрейме времени запуска 00203: If Set_freq_subday_type = SQL_freq_subday_type_At_the_specified_time Then 00204: Time1.Value = True 00205: TimeOne.Value = SQLFormatOfTimeDecode(Set_start_time) 00206: Else 00207: Time2.Value = True 00208: TimeType.ListIndex = FindIndexByItemData(TimeType, Set_freq_subday_type) 00209: TimeCount.Value = Set_freq_subday_interval 00210: TimeFrom.Value = SQLFormatOfTimeDecode(Set_start_time) 00211: TimeTo.Value = SQLFormatOfTimeDecode(Set_end_time) 00212: End If 00213: 'во фрейме цикла запуска 00214: cNum.Value = Set_freq_interval 00215: 00216: Case SQL_freq_type.SQL_freq_type_Weekly 00217: cbType.ListIndex = FindIndexByItemData(cbType, tType.tSomeWeek) 00218: 'во фрейме даты запуска 00219: FromDate.Value = SQLFormatOfDateDecode(Set_start_date) 00220: If Set_end_date = 99991231 Then 00221: NoToDate.Value = 1 00222: Else 00223: ToDate.Value = SQLFormatOfDateDecode(Set_end_date) 00224: End If 00225: 'во фрейме времени запуска 00226: If Set_freq_subday_type = SQL_freq_subday_type_At_the_specified_time Then 00227: Time1.Value = True 00228: TimeOne.Value = SQLFormatOfTimeDecode(Set_start_time) 00229: Else 00230: Time2.Value = True 00231: TimeType.ListIndex = FindIndexByItemData(TimeType, Set_freq_subday_type) 00232: TimeCount.Value = Set_freq_subday_interval 00233: TimeFrom.Value = SQLFormatOfTimeDecode(Set_start_time) 00234: TimeTo.Value = SQLFormatOfTimeDecode(Set_end_time) 00235: End If 00236: 'во фрейме цикла запуска 00237: cNum.Value = Set_freq_recurrence_factor 00238: Dim Temp1 As Long 00239: Temp1 = Set_freq_interval 00240: If Temp1 \ SQL_freq_interval_for_weekly_Saturday > 0 Then 00241: Check6.Value = 1 00242: Temp1 = Temp1 - SQL_freq_interval_for_weekly_Saturday 00243: Else 00244: Check6.Value = 0 00245: End If 00246: If Temp1 \ SQL_freq_interval_for_weekly_Friday > 0 Then 00247: Check5.Value = 1 00248: Temp1 = Temp1 - SQL_freq_interval_for_weekly_Friday 00249: Else 00250: Check5.Value = 0 00251: End If 00252: If Temp1 \ SQL_freq_interval_for_weekly_Thursday > 0 Then 00253: Check4.Value = 1 00254: Temp1 = Temp1 - SQL_freq_interval_for_weekly_Thursday 00255: Else 00256: Check4.Value = 0 00257: End If 00258: If Temp1 \ SQL_freq_interval_for_weekly_Wednesday > 0 Then 00259: Check3.Value = 1 00260: Temp1 = Temp1 - SQL_freq_interval_for_weekly_Wednesday 00261: Else 00262: Check3.Value = 0 00263: End If 00264: If Temp1 \ SQL_freq_interval_for_weekly_Tuesday > 0 Then 00265: Check2.Value = 1 00266: Temp1 = Temp1 - SQL_freq_interval_for_weekly_Tuesday 00267: Else 00268: Check2.Value = 0 00269: End If 00270: If Temp1 \ SQL_freq_interval_for_weekly_Monday > 0 Then 00271: Check1.Value = 1 00272: Temp1 = Temp1 - SQL_freq_interval_for_weekly_Monday 00273: Else 00274: Check1.Value = 0 00275: End If 00276: Check7.Value = IIf(Temp1 > 0, 1, 0) 00277: 00278: Case SQL_freq_type.SQL_freq_type_Monthly 00279: cbType.ListIndex = FindIndexByItemData(cbType, tType.tSomeMonth) 00280: 'во фрейме даты запуска 00281: FromDate.Value = SQLFormatOfDateDecode(Set_start_date) 00282: If Set_end_date = 99991231 Then 00283: NoToDate.Value = 1 00284: Else 00285: ToDate.Value = SQLFormatOfDateDecode(Set_end_date) 00286: End If 00287: 'во фрейме времени запуска 00288: If Set_freq_subday_type = SQL_freq_subday_type_At_the_specified_time Then 00289: Time1.Value = True 00290: TimeOne.Value = SQLFormatOfTimeDecode(Set_start_time) 00291: Else 00292: Time2.Value = True 00293: TimeType.ListIndex = FindIndexByItemData(TimeType, Set_freq_subday_type) 00294: TimeCount.Value = Set_freq_subday_interval 00295: TimeFrom.Value = SQLFormatOfTimeDecode(Set_start_time) 00296: TimeTo.Value = SQLFormatOfTimeDecode(Set_end_time) 00297: End If 00298: 'во фрейме цикла запуска 00299: C1.Value = True 00300: cNum.Value = Set_freq_recurrence_factor 00301: cNum2.Value = Set_freq_interval 00302: 00303: Case SQL_freq_type.SQL_freq_type_Monthly_relative_to_freq_interval 00304: 'во фрейме даты запуска 00305: cbType.ListIndex = FindIndexByItemData(cbType, tType.tSomeMonth) 00306: FromDate.Value = SQLFormatOfDateDecode(Set_start_date) 00307: If Scet_end_date = 99991231 Then 00308: NoToDate.Value = 1 00309: Else 00310: ToDate.Value = SQLFormatOfDateDecode(Set_end_date) 00311: End If 00312: 'во фрейме времени запуска 00313: If Set_freq_subday_type = SQL_freq_subday_type_At_the_specified_time Then 00314: Time1.Value = True 00315: TimeOne.Value = SQLFormatOfTimeDecode(Set_start_time) 00316: Else 00317: Time2.Value = True 00318: TimeType.ListIndex = FindIndexByItemData(TimeType, Set_freq_subday_type) 00319: TimeCount.Value = Set_freq_subday_interval 00320: TimeFrom.Value = SQLFormatOfTimeDecode(Set_start_time) 00321: TimeTo.Value = SQLFormatOfTimeDecode(Set_end_time) 00322: End If 00323: 'во фрейме цикла запуска 00324: C2.Value = True 00325: cNum.Value = Set_freq_recurrence_factor 00326: cLast.ListIndex = FindIndexByItemData(cLast, Set_freq_relative_interval) 00327: cWeekDay.ListIndex = FindIndexByItemData(cWeekDay, Set_freq_interval) 00328: 00329: End Select 00330: Call cbType_Click 00331: Load1 = False 00332: End Sub 00333: 00334: Private Sub UserControl_Initialize() 00335: Load1 = True 00336: Nochange = False 00337: ' 00338: FromDate = Now 00339: OneDate = Now 00340: ToDate = DateAdd("yyyy", 1, Now) 00341: ' 00342: cbOne.AddItem ("В заданное время"): cbOne.ItemData(cbOne.NewIndex) = oType.oAtDate 00343: cbOne.AddItem ("При простое SQL-сервера"): cbOne.ItemData(cbOne.NewIndex) = oType.oWhenCpuIdle 00344: cbOne.AddItem ("При старте SQL-агента"): cbOne.ItemData(cbOne.NewIndex) = oType.oWhenAgentStart 00345: cbOne.ListIndex = 0 00346: Schedule_freq_type = SQL_freq_type_when_computer_idle 'oType.oWhenCpuIdle 00347: ' 00348: cbType.AddItem ("Один раз"): cbType.ItemData(cbType.NewIndex) = tType.tOne 00349: cbType.AddItem ("Ежедневно"): cbType.ItemData(cbType.NewIndex) = tType.tSomeDay 00350: cbType.AddItem ("Еженедельно"): cbType.ItemData(cbType.NewIndex) = tType.tSomeWeek 00351: cbType.AddItem ("Ежемесячно"): cbType.ItemData(cbType.NewIndex) = tType.tSomeMonth 00352: cbType.ListIndex = 0 00353: ' 00354: TimeType.AddItem ("час"): TimeType.ItemData(0) = SQL_freq_subday_type.SQL_freq_subday_type_Hours 00355: TimeType.AddItem ("мин"): TimeType.ItemData(1) = SQL_freq_subday_type.SQL_freq_subday_type_Minutes 00356: TimeType.ListIndex = 0 00357: ' 00358: cLast.AddItem ("1-й"): cLast.ItemData(cLast.NewIndex) = SQL_freq_relative_interval.SQL_freq_relative_interval_First 00359: cLast.AddItem ("2-й"): cLast.ItemData(cLast.NewIndex) = SQL_freq_relative_interval.SQL_freq_relative_interval_Second 00360: cLast.AddItem ("3-й"): cLast.ItemData(cLast.NewIndex) = SQL_freq_relative_interval.SQL_freq_relative_interval_Third 00361: cLast.AddItem ("4-й"): cLast.ItemData(cLast.NewIndex) = SQL_freq_relative_interval.SQL_freq_relative_interval_Fourth 00362: cLast.AddItem ("последний"): cLast.ItemData(cLast.NewIndex) = SQL_freq_relative_interval.SQL_freq_relative_interval_Last 00363: cLast.ListIndex = 0 00364: ' 00365: cWeekDay.AddItem ("день"): cWeekDay.ItemData(cWeekDay.NewIndex) = SQL_freq_interval_for_monthly_relative.SQL_freq_interval_for_monthly_relative_Day 00366: cWeekDay.AddItem ("рабочий день"): cWeekDay.ItemData(cWeekDay.NewIndex) = SQL_freq_interval_for_monthly_relative.SQL_freq_interval_for_monthly_relative_Weekday 00367: cWeekDay.AddItem ("выходной день"): cWeekDay.ItemData(cWeekDay.NewIndex) = SQL_freq_interval_for_monthly_relative.SQL_freq_interval_for_monthly_relative_Weekend_Day 00368: cWeekDay.AddItem ("понедельник"): cWeekDay.ItemData(cWeekDay.NewIndex) = SQL_freq_interval_for_monthly_relative.SQL_freq_interval_for_monthly_relative_Monday 00369: cWeekDay.AddItem ("вторник"): cWeekDay.ItemData(cWeekDay.NewIndex) = SQL_freq_interval_for_monthly_relative.SQL_freq_interval_for_monthly_relative_Tuesday 00370: cWeekDay.AddItem ("среда"): cWeekDay.ItemData(cWeekDay.NewIndex) = SQL_freq_interval_for_monthly_relative.SQL_freq_interval_for_monthly_relative_Wednesday 00371: cWeekDay.AddItem ("четверг"): cWeekDay.ItemData(cWeekDay.NewIndex) = SQL_freq_interval_for_monthly_relative.SQL_freq_interval_for_monthly_relative_Thursday 00372: cWeekDay.AddItem ("пятница"): cWeekDay.ItemData(cWeekDay.NewIndex) = SQL_freq_interval_for_monthly_relative.SQL_freq_interval_for_monthly_relative_Friday 00373: cWeekDay.AddItem ("суббота"): cWeekDay.ItemData(cWeekDay.NewIndex) = SQL_freq_interval_for_monthly_relative.SQL_freq_interval_for_monthly_relative_Saturday 00374: cWeekDay.AddItem ("воскресенье"): cWeekDay.ItemData(cWeekDay.NewIndex) = SQL_freq_interval_for_monthly_relative.SQL_freq_interval_for_monthly_relative_Sunday 00375: cWeekDay.ListIndex = 0 00376: 00377: ReSizeCombo2 cWeekDay, 20 00378: 00379: Load1 = False 00380: End Sub 00381: 00382: Public Sub Refresh_Nochange() 00383: Load1 = True 00384: If cbType.ItemData(cbType.ListIndex) = tType.tOne Then 00385: 'Доступность по фреймам в целом 00386: Call ControlEnable(UserControl.FrameOne, True) 00387: Call ControlEnable(UserControl.Frame1, False) 00388: Call ControlEnable(UserControl.Frame2, False) 00389: Call ControlEnable(UserControl.Frame3, False) 00390: 'Внутри фрейме одного запуска 00391: If cbOne.ItemData(cbOne.ListIndex) = oType.oAtDate Then 00392: OneDate.Enabled = True 00393: OneTime.Enabled = True 00394: 'одноразовый запуск по дате 00395: Else 00396: OneDate.Enabled = False 00397: OneTime.Enabled = False 00398: End If 00399: Else 00400: 'Доступность по фреймам в целом 00401: Call ControlEnable(UserControl.FrameOne, False) 00402: Call ControlEnable(UserControl.Frame1, True) 00403: Call ControlEnable(UserControl.Frame2, True) 00404: Call ControlEnable(UserControl.Frame3, True) 00405: ' 00406: ' фрейм дат 00407: If NoToDate.Value = 0 Then 00408: ToDate.Enabled = True 00409: Else 00410: ToDate.Enabled = False 00411: End If 00412: ' 00413: 'фрейм времени 00414: If Time1.Value = True Then 00415: TimeOne.Enabled = True 00416: 'Label6.Enabled = True 00417: Label3.Enabled = False 00418: Label8.Enabled = False 00419: 'Label1.Enabled = False 00420: TimeCount.Enabled = False 00421: TimeType.Enabled = False 00422: TimeFrom.Enabled = False 00423: TimeTo.Enabled = False 00424: Else 00425: TimeOne.Enabled = False 00426: 'Label6.Enabled = False 00427: Label3.Enabled = True 00428: Label8.Enabled = True 00429: 'Label1.Enabled = True 00430: TimeCount.Enabled = True 00431: TimeType.Enabled = True 00432: TimeFrom.Enabled = True 00433: TimeTo.Enabled = True 00434: End If 00435: ' 00436: 'Фрейм цикла 00437: Label2.Enabled = True 00438: cNum.Enabled = True 00439: c1Type.Enabled = True 00440: Check1.Enabled = False 00441: Check2.Enabled = False 00442: Check3.Enabled = False 00443: Check4.Enabled = False 00444: Check5.Enabled = False 00445: Check6.Enabled = False 00446: Check7.Enabled = False 00447: C1.Enabled = False 00448: C2.Enabled = False 00449: cNum2.Enabled = False 00450: cLast.Enabled = False 00451: lb2.Enabled = False 00452: cWeekDay.Enabled = False 00453: Select Case cbType.ItemData(cbType.ListIndex) 00454: Case tType.tSomeDay 00455: ' 00456: Case tType.tSomeWeek 00457: Check1.Enabled = True 00458: Check2.Enabled = True 00459: Check3.Enabled = True 00460: Check4.Enabled = True 00461: Check5.Enabled = True 00462: Check6.Enabled = True 00463: Check7.Enabled = True 00464: ' 00465: Case tType.tSomeMonth 00466: C1.Enabled = True 00467: C2.Enabled = True 00468: 'а месячный тип запуска - разный 00469: If C1.Value = True Then 00470: cNum2.Enabled = True 00471: lb2.Enabled = True 00472: cLast.Enabled = False 00473: cWeekDay.Enabled = False 00474: Else 00475: cNum2.Enabled = False 00476: lb2.Enabled = False 00477: cLast.Enabled = True 00478: cWeekDay.Enabled = True 00479: End If 00480: End Select 00481: End If 00482: ' 00483: Load1 = False 00484: End Sub 00485: 00486: Private Sub cbType_Click() 00487: If Not Load1 Then RaiseEvent Changed 00488: ' 00489: 'Frame3.Caption = LCase(cbType.Text) 00490: If cbType.ItemData(cbType.ListIndex) = tType.tOne Then 00491: 'Доступность по фреймам в целом 00492: Call ControlEnable(UserControl.FrameOne, True) 00493: Call ControlEnable(UserControl.Frame1, False) 00494: Call ControlEnable(UserControl.Frame2, False) 00495: Call ControlEnable(UserControl.Frame3, False) 00496: 'Во фрейме одного запуска 00497: Call cbOne_Click 00498: Else 00499: 'Доступность по фреймам в целом 00500: Call ControlEnable(UserControl.FrameOne, False) 00501: Call ControlEnable(UserControl.Frame1, True) 00502: Call ControlEnable(UserControl.Frame2, True) 00503: Call ControlEnable(UserControl.Frame3, True) 00504: 'взяли даты из фрейм дат 00505: Call FromDate_DateChanged 00506: Call NoToDate_Click 00507: 'Во фрейме времени 00508: If Time1.Value = True Then Call Time1_Click Else Call Time2_Click 00509: 'Во фрейме цикла 00510: Label2.Enabled = True 00511: cNum.Enabled = True 00512: c1Type.Enabled = True 00513: Check1.Enabled = False 00514: Check2.Enabled = False 00515: Check3.Enabled = False 00516: Check4.Enabled = False 00517: Check5.Enabled = False 00518: Check6.Enabled = False 00519: Check7.Enabled = False 00520: C1.Enabled = False 00521: C2.Enabled = False 00522: cNum2.Enabled = False 00523: cLast.Enabled = False 00524: lb2.Enabled = False 00525: cWeekDay.Enabled = False 00526: Select Case cbType.ItemData(cbType.ListIndex) 00527: Case tType.tSomeDay 00528: Schedule_freq_type = SQL_freq_type_Daily 00529: Call cNum_Changed 00530: ' 00531: Case tType.tSomeWeek 00532: Check1.Enabled = True 00533: Check2.Enabled = True 00534: Check3.Enabled = True 00535: Check4.Enabled = True 00536: Check5.Enabled = True 00537: Check6.Enabled = True 00538: Check7.Enabled = True 00539: Schedule_freq_type = SQL_freq_type_Weekly 00540: Call cNum_Changed 00541: Call CheckWeek 00542: ' 00543: Case tType.tSomeMonth 00544: C1.Enabled = True 00545: C2.Enabled = True 00546: 'а месячный тип запуска - разный 00547: If C1.Value = True Then Call C1_Click Else Call C2_Click 00548: End Select 00549: End If 00550: 'Метка во фрейме цикла 00551: Select Case cbType.ItemData(cbType.ListIndex) 00552: Case tType.tSomeDay: c1Type.Caption = "день" 00553: Case tType.tSomeMonth: c1Type.Caption = "месяц" 00554: Case tType.tSomeWeek: c1Type.Caption = "неделю" 00555: End Select 00556: ' 00557: End Sub 00558: 00559: Private Sub ControlEnable(MyFrame As VB.Frame, MyEnable As Boolean) 00560: Dim x As VB.Control, i As String 00561: Select Case MyFrame.Name 00562: Case "Frame1", "Frame2" 00563: 'сам фрейм и все внутри - ENABLE/DISABLE 00564: MyFrame.Enabled = MyEnable 00565: For Each x In UserControl.Controls 00566: If Not (x.Container Is Nothing) And TypeName(x) <> "Frame" And x.Name <> "cbType" Then 00567: If (x.Container.Name = MyFrame.Name) Then 00568: x.Enabled = MyEnable 00569: End If 00570: End If 00571: Next 00572: Case Else 00573: MyFrame.Visible = MyEnable 00574: End Select 00575: End Sub 00576: 00577: Private Sub cbOne_Click() 00578: If Not Load1 Then RaiseEvent Changed 00579: ' 00580: If cbOne.ItemData(cbOne.ListIndex) = oType.oAtDate Then 00581: OneDate.Enabled = True 00582: OneTime.Enabled = True 00583: ' Label7.Enabled = True 00584: 'одноразовый запуск по дате 00585: Schedule_freq_type = SQL_freq_type_Once 00586: Schedule_freq_subday_type = SQL_freq_subday_type_At_the_specified_time 00587: Call OneDate_DateChanged 00588: Call OneTime_Changed(True) 00589: Else 00590: OneDate.Enabled = False 00591: OneTime.Enabled = False 00592: ' Label7.Enabled = False 00593: 'одноразовый без даты 00594: If cbOne.ItemData(cbOne.ListIndex) = oType.oWhenAgentStart Then 00595: Schedule_freq_type = SQL_freq_type_when_SQLServerAgent_starts 00596: Else 00597: Schedule_freq_type = SQL_freq_type_when_computer_idle 00598: End If 00599: End If 00600: End Sub 00601: 00602: Private Sub Time1_Click() 00603: If Not Load1 Then RaiseEvent Changed 00604: ' 00605: TimeOne.Enabled = True 00606: 'Label6.Enabled = True 00607: Label3.Enabled = False 00608: Label8.Enabled = False 00609: 'Label1.Enabled = False 00610: TimeCount.Enabled = False 00611: TimeType.Enabled = False 00612: TimeFrom.Enabled = False 00613: TimeTo.Enabled = False 00614: 'одноразовый запуск 00615: Call TimeOne_Changed(True) 00616: End Sub 00617: 00618: Private Sub Time2_Click() 00619: If Not Load1 Then RaiseEvent Changed 00620: ' 00621: TimeOne.Enabled = False 00622: 'Label6.Enabled = False 00623: Label3.Enabled = True 00624: Label8.Enabled = True 00625: 'Label1.Enabled = True 00626: TimeCount.Enabled = True 00627: TimeType.Enabled = True 00628: TimeFrom.Enabled = True 00629: TimeTo.Enabled = True 00630: 'циклический запуск внутри суток 00631: Call TimeType_Click 00632: Call TimeCount_Changed 00633: Call TimeFrom_Changed(True) 00634: Call TimeTo_Changed(True) 00635: End Sub 00636: 00637: Private Sub C1_Click() 00638: If Not Load1 Then RaiseEvent Changed 00639: ' 00640: cNum2.Enabled = True 00641: lb2.Enabled = True 00642: cLast.Enabled = False 00643: cWeekDay.Enabled = False 00644: Schedule_freq_type = SQL_freq_type_Monthly 00645: Call cNum_Changed 00646: Call cNum2_Changed 00647: End Sub 00648: 00649: Private Sub C2_Click() 00650: If Not Load1 Then RaiseEvent Changed 00651: ' 00652: cNum2.Enabled = False 00653: lb2.Enabled = False 00654: cLast.Enabled = True 00655: cWeekDay.Enabled = True 00656: Schedule_freq_type = SQL_freq_type_Monthly_relative_to_freq_interval 00657: Call cNum_Changed 00658: Call cLast_Click 00659: Call cWeekDay_Click 00660: End Sub 00661: 00662: Private Sub OneDate_DateChanged() 00663: If Not Load1 Then RaiseEvent Changed 00664: ' 00665: Schedule_start_date = SQLFormatOfDate(OneDate.Value) 00666: End Sub 00667: 00668: Private Sub OneTime_Changed(ListClick As Boolean) 00669: If Not Load1 Then RaiseEvent Changed 00670: ' 00671: Schedule_start_time = SQLFormatOfTime(OneTime.Value) 00672: End Sub 00673: 00674: Private Sub FromDate_DateChanged() 00675: If Not Load1 Then RaiseEvent Changed 00676: ' 00677: Schedule_start_date = SQLFormatOfDate(FromDate.Value) 00678: End Sub 00679: 00680: Private Sub ToDate_DateChanged() 00681: If Not Load1 Then RaiseEvent Changed 00682: ' 00683: Schedule_end_date = SQLFormatOfDate(ToDate.Value) 00684: End Sub 00685: 00686: Private Sub NoToDate_Click() 00687: If Not Load1 Then RaiseEvent Changed 00688: ' 00689: If NoToDate.Value = 0 Then 00690: ToDate.Enabled = True 00691: Call ToDate_DateChanged 00692: Else 00693: ToDate.Enabled = False 00694: Schedule_end_date = 99991231 00695: End If 00696: End Sub 00697: 00698: Private Sub TimeOne_Changed(ListClick As Boolean) 00699: If Not Load1 Then RaiseEvent Changed 00700: ' 00701: Schedule_freq_subday_type = SQL_freq_subday_type_At_the_specified_time 00702: Schedule_start_time = SQLFormatOfTime(TimeOne.Value) 00703: End Sub 00704: 00705: Private Sub TimeType_Click() 00706: If Not Load1 Then RaiseEvent Changed 00707: ' 00708: If TimeType.ItemData(TimeType.ListIndex) = 0 Then 00709: Schedule_freq_subday_type = SQL_freq_subday_type_Hours 00710: Else 00711: Schedule_freq_subday_type = SQL_freq_subday_type_Minutes 00712: End If 00713: End Sub 00714: 00715: Private Sub TimeCount_Changed() 00716: If Not Load1 Then RaiseEvent Changed 00717: ' 00718: Schedule_freq_subday_interval = TimeCount.Value 00719: End Sub 00720: 00721: Private Sub TimeFrom_Changed(ListClick As Boolean) 00722: If Not Load1 Then RaiseEvent Changed 00723: ' 00724: Schedule_start_time = SQLFormatOfTime(TimeFrom.Value) 00725: End Sub 00726: 00727: Private Sub TimeTo_Changed(ListClick As Boolean) 00728: If Not Load1 Then RaiseEvent Changed 00729: ' 00730: Schedule_end_time = SQLFormatOfTime(TimeTo.Value) 00731: End Sub 00732: 00733: Private Sub cNum_Changed() 00734: If Not Load1 Then RaiseEvent Changed 00735: ' 00736: If Schedule_freq_type = SQL_freq_type_Daily Then 00737: Schedule_freq_interval = cNum.Value 00738: Else 'для трех режимов SQL_freq_type_Monthly,SQL_freq_type_Weekly,SQL_freq_type_Monthly_relative_to_freq_interval 00739: Schedule_freq_recurrence_factor = cNum.Value 00740: End If 00741: End Sub 00742: 00743: Private Sub cNum2_Changed() 00744: If Not Load1 Then RaiseEvent Changed 00745: ' 00746: If Schedule_freq_type = SQL_freq_type_Monthly Then Schedule_freq_interval = cNum2.Value 00747: End Sub 00748: 00749: Private Sub Check1_Click() 00750: If Not Load1 Then RaiseEvent Changed 00751: ' 00752: If cbType.ItemData(cbType.ListIndex) = tType.tSomeWeek Then Call CheckWeek 00753: End Sub 00754: 00755: Private Sub Check2_Click() 00756: If cbType.ItemData(cbType.ListIndex) = tType.tSomeWeek Then Call CheckWeek 00757: End Sub 00758: 00759: Private Sub Check3_Click() 00760: If Not Load1 Then RaiseEvent Changed 00761: ' 00762: If cbType.ItemData(cbType.ListIndex) = tType.tSomeWeek Then Call CheckWeek 00763: End Sub 00764: 00765: Private Sub Check4_Click() 00766: If Not Load1 Then RaiseEvent Changed 00767: ' 00768: If cbType.ItemData(cbType.ListIndex) = tType.tSomeWeek Then Call CheckWeek 00769: End Sub 00770: 00771: Private Sub Check5_Click() 00772: If Not Load1 Then RaiseEvent Changed 00773: ' 00774: If cbType.ItemData(cbType.ListIndex) = tType.tSomeWeek Then Call CheckWeek 00775: End Sub 00776: 00777: Private Sub Check6_Click() 00778: If Not Load1 Then RaiseEvent Changed 00779: ' 00780: If cbType.ItemData(cbType.ListIndex) = tType.tSomeWeek Then Call CheckWeek 00781: End Sub 00782: 00783: Private Sub Check7_Click() 00784: If Not Load1 Then RaiseEvent Changed 00785: ' 00786: If cbType.ItemData(cbType.ListIndex) = tType.tSomeWeek Then Call CheckWeek 00787: End Sub 00788: 00789: Private Sub CheckWeek() 00790: If Not Load1 Then RaiseEvent Changed 00791: ' 00792: Schedule_freq_interval = _ 00793: Check1.Value * SQL_freq_interval_for_weekly_Monday Or _ 00794: Check2.Value * SQL_freq_interval_for_weekly_Tuesday Or _ 00795: Check3.Value * SQL_freq_interval_for_weekly_Wednesday Or _ 00796: Check4.Value * SQL_freq_interval_for_weekly_Thursday Or _ 00797: Check5.Value * SQL_freq_interval_for_weekly_Friday Or _ 00798: Check6.Value * SQL_freq_interval_for_weekly_Saturday Or _ 00799: Check7.Value * SQL_freq_interval_for_weekly_Sunday 00800: End Sub 00801: 00802: Private Sub cLast_Click() 00803: If Not Load1 Then RaiseEvent Changed 00804: ' 00805: Schedule_freq_relative_interval = cLast.ItemData(cLast.ListIndex) 00806: End Sub 00807: 00808: Private Sub cWeekDay_Click() 00809: If Not Load1 Then RaiseEvent Changed 00810: ' 00811: Schedule_freq_interval = cWeekDay.ItemData(cWeekDay.ListIndex) 00812: End Sub 00813: 00814: 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! 00815: 'MappingInfo=UserControl,UserControl,-1,Enabled 00816: Public Property Get Enabled() As Boolean 00817: Enabled = UserControl.Enabled 00818: End Property 00819: 00820: Public Property Let Enabled(ByVal New_Enabled As Boolean) 00821: UserControl.Enabled() = New_Enabled 00822: PropertyChanged "Enabled" 00823: Dim x As Object 00824: For Each x In UserControl.Controls 00825: x.Enabled = New_Enabled 00826: Next 00827: End Property 00828: 00829: 'Load property values from storage 00830: Private Sub UserControl_ReadProperties(PropBag As PropertyBag) 00831: UserControl.Enabled = PropBag.ReadProperty("Enabled", True) 00832: End Sub 00833: 00834: 'Write property values to storage 00835: Private Sub UserControl_WriteProperties(PropBag As PropertyBag) 00836: Call PropBag.WriteProperty("Enabled", UserControl.Enabled, True) 00837: End Sub
Comments (
)
Link to this page:
//www.vb-net.com/dotnet/tour21/shed.htm
|