public void BuildList() { PcisdataGridViewExs.Rows.Clear(); if (this.home != null) { string result = XenAPI.Host.call_plugin(home.Connection.Session, home.opaque_ref, "pvusbinfo.py", "list", null); UsbDeviceInfoConfig.PVUsbListResult pvusbresult = null; try { pvusbresult = (UsbDeviceInfoConfig.PVUsbListResult)HalsignUtil.JsonToObject(result, typeof(UsbDeviceInfoConfig.PVUsbListResult)); } catch { return; } for (int i = 0; i < pvusbresult.returnvalue.Count; i++) { PcisdataGridViewExs.Rows.Add(); PcisdataGridViewExs.Rows[i].Tag = pvusbresult.returnvalue[i].id; PcisdataGridViewExs.Rows[i].Cells[0].Value = string.Concat("Bus ", pvusbresult.returnvalue[i].busid); PcisdataGridViewExs.Rows[i].Cells[0].Tag = pvusbresult.returnvalue[i].pciid; PcisdataGridViewExs.Rows[i].Cells[1].Value = pvusbresult.returnvalue[i].shortname + " (" + pvusbresult.returnvalue[i].longname + " )"; if (pvusbresult.returnvalue[i].vm != null) { string vmuuid = pvusbresult.returnvalue[i].vm; VM bindvm = home.Connection.Cache.VMs.First(vm => vm.uuid == vmuuid); PcisdataGridViewExs.Rows[i].Cells[2].Value = bindvm.name_label; PcisdataGridViewExs.Rows[i].Cells[2].Tag = pvusbresult.returnvalue[i].vm; PcisdataGridViewExs.Rows[i].Cells[3].Value = "pvusb"; PcisdataGridViewExs.Rows[i].Cells[3].ReadOnly = true; ((DataGridViewButtonCellEx)(PcisdataGridViewExs.Rows[i].Cells[4])).Bind = false; ((DataGridViewButtonCellEx)(PcisdataGridViewExs.Rows[i].Cells[4])).Enabled = true; } else { VM findvm = home.Connection.Cache.VMs.FirstOrDefault(vm => vm.uuid != null && vm.is_a_real_vm && HalsignHelpers.IsVMShow(vm) && vm.other_config.ContainsKey("pci") && vm.other_config["pci"].Contains(string.Concat("0000:", pvusbresult.returnvalue[i].pciid)) && vm.Home().Equals(home)); if (findvm == null) { PcisdataGridViewExs.Rows[i].Cells[3].Value = "pvusb"; ((DataGridViewButtonCellEx)(PcisdataGridViewExs.Rows[i].Cells[4])).Bind = true; ((DataGridViewButtonCellEx)(PcisdataGridViewExs.Rows[i].Cells[4])).Enabled = true; } else { PcisdataGridViewExs.Rows[i].Cells[2].Value = findvm.name_label; PcisdataGridViewExs.Rows[i].Cells[2].Tag = findvm.uuid; PcisdataGridViewExs.Rows[i].Cells[3].Value = "vt-d"; PcisdataGridViewExs.Rows[i].Cells[3].ReadOnly = true; ((DataGridViewButtonCellEx)(PcisdataGridViewExs.Rows[i].Cells[4])).Bind = false; ((DataGridViewButtonCellEx)(PcisdataGridViewExs.Rows[i].Cells[4])).Enabled = true; } } } } }
void worker_DoWork(object sender, DoWorkEventArgs e) { lock (lockobj) { dtTable.Rows.Clear(); if (this.home != null) { string result = XenAPI.Host.call_plugin(home.Connection.Session, home.opaque_ref, "pvusbinfo.py", "list", null); var ret = (UsbDeviceInfoConfig.PVUsbListResult)HalsignUtil.JsonToObject(result, typeof(UsbDeviceInfoConfig.PVUsbListResult)); foreach (UsbDeviceInfoConfig.USBInfo usbinfo in ret.returnvalue) { DataRow row = dtTable.NewRow(); row["id"] = usbinfo.id; row["pciid"] = usbinfo.pciid; row["bus"] = string.Concat("Bus ", usbinfo.busid); row["devices"] = usbinfo.shortname + " (" + usbinfo.longname + " )"; if (usbinfo.vm != null) { XenRef <VM> vmRef = VM.get_by_uuid(home.Connection.Session, usbinfo.vm); VM bindvm = VM.get_record(home.Connection.Session, vmRef); row["vm_name"] = bindvm.name_label; row["vm_uuid"] = usbinfo.vm; row["usbmode"] = "pvusb"; row["bind"] = false; row["enabled"] = true; } else { VM findvm = home.Connection.Cache.VMs.FirstOrDefault(vm => vm.uuid != null && vm.is_a_real_vm && HalsignHelpers.IsVMShow(vm) && vm.other_config.ContainsKey("pci") && vm.other_config["pci"].Contains(string.Concat("0000:", usbinfo.pciid)) && vm.Home().Equals(home)); if (findvm == null) { row["usbmode"] = "pvusb"; row["bind"] = true; row["enabled"] = true; } else { row["vm_name"] = findvm.name_label; row["vm_uuid"] = findvm.uuid; row["usbmode"] = "vt-d"; row["bind"] = false; row["enabled"] = true; } } dtTable.Rows.Add(row); } } } }
public void ReplicationEditWizard() { VM vm = this._xenModelObject as VM; this.repChoseVmPage.VmCheckedList.Add(vm); BackupRestoreConfig.BrSchedule schedule = (BackupRestoreConfig.BrSchedule)HalsignUtil.JsonToObject(vm.other_config["halsign_rep_rules"], typeof(BackupRestoreConfig.BrSchedule)); jobs = (BackupRestoreConfig.Job)HalsignUtil.JsonToObject(vm.other_config["halsign_br_job_r"], typeof(BackupRestoreConfig.Job)); base.RemovePage(this.repChoseVmPage); base.RemovePage(this.repJobSettingPage); base.RemovePage(this.synchronizationPage); base.RemovePage(this.vmSettingsPage); base.RemovePage(this.completePage); this.repJobSettingPage.JobNameText = schedule.jobName; string tmpvdistr = ""; if (schedule.details.EndsWith("halsign_vdi_all")) { foreach (VBD vbd in vm.Connection.ResolveAll <VBD>(vm.VBDs)) { if (HalsignHelpers.IsCDROM(vbd)) { continue; } if (vbd.type.Equals(XenAPI.vbd_type.Disk)) { tmpvdistr += vm.Connection.Resolve <VDI>(vbd.VDI).uuid + "@";; } } tmpvdistr = tmpvdistr.Substring(0, tmpvdistr.Length - 1); this.repChoseVmPage.vdi_expand_list.Add(vm.uuid, tmpvdistr); } else { this.repChoseVmPage.vdi_expand_list.Add(vm.uuid, schedule.details); } this.schedulePage.EditReplicationInitButton(schedule); this.repJobSettingPage.EditReplicationInitJobSet(schedule); scheduleDetails = schedule.details.Replace("|halsign_vdi_all", ""); }
public void BackupEditWizard() { VM vm = this._xenModelObject as VM; this.vmCheckedList.Add(vm); BackupRestoreConfig.BrSchedule schedule = (BackupRestoreConfig.BrSchedule)HalsignUtil.JsonToObject(vm.other_config["halsign_br_rules"], typeof(BackupRestoreConfig.BrSchedule)); BackupRestoreConfig.Job job = (BackupRestoreConfig.Job)HalsignUtil.JsonToObject(vm.other_config["halsign_br_job_s"], typeof(BackupRestoreConfig.Job)); base.RemovePage(this.xenChoseVmBackupPage); base.RemovePage(this.optionsBackupPage); base.RemovePage(this.summaryBackupPage); base.RemovePage(this.completeBackupPage); this.optionsBackupPage._JobNameTextBox = schedule.jobName; string tmpvdistr = ""; if (schedule.details.Equals("halsign_vdi_all")) { foreach (VBD vbd in vm.Connection.ResolveAll <VBD>(vm.VBDs)) { if (HalsignHelpers.IsCDROM(vbd)) { continue; } if (vbd.type.Equals(XenAPI.vbd_type.Disk)) { tmpvdistr += vm.Connection.Resolve <VDI>(vbd.VDI).uuid + "@";; } } tmpvdistr = tmpvdistr.Substring(0, tmpvdistr.Length - 1); this.vdi_dictionary.Add(vm.uuid, tmpvdistr); } else { this.vdi_dictionary.Add(vm.uuid, schedule.details); } this.scheduleBackupPage.EditBackupInitButton(schedule); }
private void Bindbutton_Click(object sender, EventArgs e) { (sender as Button).Enabled = false; string errormsg = ""; VM selectedvm = m_host.Connection.Cache.VMs.First(vm => vm.uuid == this.VMsComboBox.SelectedValue.ToString() && vm.Home() == m_host); Dictionary <string, string> other_config = selectedvm.other_config; if (mode == "pvusb") { Dictionary <string, string> args = new Dictionary <string, string>(); args.Add("id", this.m_id); args.Add("vm_uuid", selectedvm.uuid); string result = XenAPI.Host.call_plugin(m_host.Connection.Session, m_host.opaque_ref, "pvusbinfo.py", "assign", args); var assignresult = (UsbDeviceInfoConfig.AssingResult)HalsignUtil.JsonToObject(result, typeof(UsbDeviceInfoConfig.AssingResult)); if (assignresult.returncode == "0") { if (!other_config.ContainsKey("usbmode")) { other_config.Add("usbmode", "pvusb"); } else { other_config["usbmode"] = "pvusb"; } XenAPI.VM.set_other_config(m_host.Connection.Session, selectedvm.opaque_ref, other_config); selectedvm.NotifyPropertyChanged("other_config"); } else if (assignresult.returncode == "1") { errormsg = string.Format(Messages.PVUSB_DAEMON_FAILURE_1, assignresult.returnvalue); } else if (assignresult.returncode == "2") { errormsg = string.Format(Messages.PVUSB_DAEMON_FAILURE_2, assignresult.returnvalue); } else if (assignresult.returncode == "3") { errormsg = string.Format(Messages.PVUSB_DAEMON_FAILURE_3, assignresult.returnvalue); } else { errormsg = string.Format(Messages.PVUSB_DAEMON_FAILURE_4); } } else { if (!other_config.ContainsKey("usbmode")) { other_config.Add("usbmode", "vt-d"); } else { other_config["usbmode"] = "vt-d"; } if (!other_config.ContainsKey("pci")) { other_config.Add("pci", string.Concat("0/0000:", this.m_id)); } else { string pci_value = other_config["pci"]; if (!pci_value.Contains(this.m_id)) { pci_value = string.Format("{0},{1}", pci_value, string.Concat("0/0000:", this.m_id)); other_config["pci"] = pci_value; } } //string msg = selectedvm.power_state == vm_power_state.Halted ? Messages.BOND_USB_DEVICE_VM_HALT : Messages.BOND_USB_DEVICE_VM_RUNNING; //MessageBox.Show(this, msg); XenAPI.VM.set_other_config(m_host.Connection.Session, selectedvm.opaque_ref, other_config); selectedvm.NotifyPropertyChanged("other_config"); } if (!string.IsNullOrEmpty(errormsg)) { MessageBox.Show(this, errormsg); } this.Close(); }
private void PcisdataGridViewExs_CellButtonClicked(object sender, Controls.DataGridViewExs.DataGridViewButtonClickEventArgs e) { if (e.Bind) { if (PcisdataGridViewExs.Rows[e.RowIndex].Cells[0].Value != null && PcisdataGridViewExs.Rows[e.RowIndex].Tag != null && PcisdataGridViewExs.Rows[e.RowIndex].Cells[1].Value != null) { string id = ""; string mode = "pvusb"; if (PcisdataGridViewExs.Rows[e.RowIndex].Cells[3].Value.ToString() == "pvusb") { string value = usbmode.Selected.ToString(); mode = "pvusb"; id = PcisdataGridViewExs.Rows[e.RowIndex].Tag.ToString(); // pass id } else if (PcisdataGridViewExs.Rows[e.RowIndex].Cells[3].Value.ToString() == "vt-d") { mode = "vt-d"; id = PcisdataGridViewExs.Rows[e.RowIndex].Cells[0].Tag.ToString();// pass pciid } PciBindDialog dialog = new PciBindDialog(home, PcisdataGridViewExs.Rows[e.RowIndex].Cells[0].Value.ToString(), id, mode, PcisdataGridViewExs.Rows[e.RowIndex].Cells[1].Value.ToString()); dialog.Show(Program.MainWindow); } } else { ((DataGridViewButtonCellEx)(PcisdataGridViewExs.Rows[e.RowIndex].Cells[4])).Enabled = false;//disable the button string vmuuid = PcisdataGridViewExs.Rows[e.RowIndex].Cells[2].Tag.ToString(); VM selectedvm = home.Connection.Cache.VMs.First(vm => vm.uuid == vmuuid); Dictionary <string, string> other_config = selectedvm.other_config; string mode = PcisdataGridViewExs.Rows[e.RowIndex].Cells[3].Value.ToString(); if (mode == "vt-d") { if (other_config.ContainsKey("pci")) { string pcistr = string.Concat("0/0000:", PcisdataGridViewExs.Rows[e.RowIndex].Cells[0].Tag.ToString()); string pci_val = other_config["pci"]; string[] devices = pci_val.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (other_config["pci"] == pcistr) { other_config.Remove("pci"); } else if (other_config["pci"].StartsWith(pcistr) && devices.Length > 1) { pci_val = pci_val.Remove(0, pcistr.Length + 1); other_config["pci"] = pci_val; } else { int position = other_config["pci"].IndexOf(pcistr, StringComparison.CurrentCultureIgnoreCase); if (position != -1) { pci_val = pci_val.Remove(position - 1, pcistr.Length + 1); other_config["pci"] = pci_val; } } other_config.Remove("usbmode"); XenAPI.VM.set_other_config(home.Connection.Session, selectedvm.opaque_ref, other_config); selectedvm.NotifyPropertyChanged("other_config"); } } else if (mode == "pvusb") { Dictionary <string, string> args = new Dictionary <string, string>(); args.Add("id", PcisdataGridViewExs.Rows[e.RowIndex].Tag.ToString()); string result = XenAPI.Host.call_plugin(home.Connection.Session, home.opaque_ref, "pvusbinfo.py", "unassign", args); var unassignresult = (UsbDeviceInfoConfig.AssingResult)HalsignUtil.JsonToObject(result, typeof(UsbDeviceInfoConfig.AssingResult)); if (unassignresult.returncode != "0") { if (unassignresult.returncode == "1") { MessageBox.Show(this, string.Format(Messages.PVUSB_DAEMON_FAILURE_1, unassignresult.returnvalue)); } else if (unassignresult.returncode == "2") { MessageBox.Show(this, string.Format(Messages.PVUSB_DAEMON_FAILURE_2, unassignresult.returnvalue)); } else if (unassignresult.returncode == "3") { MessageBox.Show(this, string.Format(Messages.PVUSB_DAEMON_FAILURE_3, unassignresult.returnvalue)); } else { MessageBox.Show(this, string.Format(Messages.PVUSB_DAEMON_FAILURE_4)); } } else { other_config.Remove("usbmode"); XenAPI.VM.set_other_config(home.Connection.Session, selectedvm.opaque_ref, other_config); } selectedvm.NotifyPropertyChanged("other_config"); } } }
protected override void Run() { try { Dictionary <string, string> other_config = _Pool.other_config; switch (this._Flag) { case 0: if (_Register) { if (other_config.ContainsKey("vswitch_controller_account")) { other_config["vswitch_controller_account"] = _Args["controller_username"]; } else { other_config.Add("vswitch_controller_account", _Args["controller_username"]); } string url = string.Format( @"https://{0}:{1}/client/ws/node?method=registerVgates&vmnUser={2}&vmnPass={3}&vGateUser={4}&vGatePass={5}&vGateIpAddress={6}", _Args["controller_ip"], VMANAGER_PORT, HttpUtility.UrlEncode(_Args["controller_username"]), HttpUtility.UrlEncode(_Args["controller_password"]), HttpUtility.UrlEncode(_Args["vgate_username"]), HttpUtility.UrlEncode(_Args["vgate_password"]), _Args["master_address"]); var result = (OVSCConfig.ConfigResult)HalsignUtil.JsonToObject(this.HttpCall(url), typeof(OVSCConfig.ConfigResult)); if (null == result) { throw new Exception(string.Format("Exception when call {0}", url)); } string errMsg = string.Empty; var errcode = (OVSCConfig.OCSC_CONFIG_ERRORCODE)(int.Parse(result.code)); if (errcode != OVSCConfig.OCSC_CONFIG_ERRORCODE.ERR_SUCCESS && errcode != OVSCConfig.OCSC_CONFIG_ERRORCODE.ERR_REGISTERED) { switch (errcode) { case OVSCConfig.OCSC_CONFIG_ERRORCODE.ERR_INVALID_PARAMS: errMsg = Messages.ERR_INVALID_PARAMS; break; case OVSCConfig.OCSC_CONFIG_ERRORCODE.ERR_CONTROLLER_ACCOUNT_INVALID: errMsg = Messages.ERR_CONTROLLER_ACCOUNT_INVALID; break; case OVSCConfig.OCSC_CONFIG_ERRORCODE.ERR_VGATE_ACCOUNT_INVALID: errMsg = Messages.ERR_VGATE_ACCOUNT_INVALID; break; //case (int)OVSCConfig.OCSC_CONFIG_ERRORCODE.ERR_REGISTERED: // errMsg = Messages.ERR_REGISTERED;break; default: break; } throw new Exception(errMsg); } } else { if (other_config.ContainsKey("vswitch_controller_account")) { if (_Pool.other_config.ContainsKey("vswitch_controller") && !string.IsNullOrEmpty(_Pool.other_config["vswitch_controller"])) { string[] paramslist = _Pool.other_config["vswitch_controller"].Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries); if (paramslist.Count() != 3) { return; } string url = string.Format("https://{0}:{1}/client/ws/node?method=unregisterVgates&uuid={2}", paramslist[1], VMANAGER_PORT, _Pool.uuid); try { this.HttpCall(url); } catch (Exception) {} } other_config.Remove("vswitch_controller_account"); } } string paramsValue = string.Format("{0}:{1}:{2}", _Args["protocol"], _Args["controller_ip"], _Args["controller_port"]); //Call set_vswitch_controller Pool.set_vswitch_controller(this._xenConnection.Session, _Args["controller_ip"]); //Write value to pool other_config if (other_config.ContainsKey("vswitch_controller")) { other_config["vswitch_controller"] = paramsValue; } else { other_config.Add("vswitch_controller", paramsValue); } break; case 1: if (other_config.ContainsKey("vswitch_controller_account")) { if (_Pool.other_config.ContainsKey("vswitch_controller") && !string.IsNullOrEmpty(_Pool.other_config["vswitch_controller"])) { string[] paramslist = _Pool.other_config["vswitch_controller"].Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries); if (paramslist.Count() != 3) { return; } try { string url = string.Format("https://{0}:{1}/client/ws/node?method=unregisterVgates&uuid={2}", paramslist[1], VMANAGER_PORT, _Pool.uuid); var result = (OVSCConfig.ConfigResult) HalsignUtil.JsonToObject(this.HttpCall(url), typeof(OVSCConfig.ConfigResult)); if (null == result) { throw new Exception(string.Format("Exception when call {0}", url)); } if (int.Parse(result.code) != (int)OVSCConfig.OCSC_CONFIG_ERRORCODE.ERR_SUCCESS) { throw new Exception(Messages.ERR_INVALID_PARAMS); } } catch (Exception exception) { log.Error(exception.Message); } finally { other_config.Remove("vswitch_controller_account"); if (other_config.ContainsKey("vswitch_controller")) { other_config.Remove("vswitch_controller"); } Pool.set_vswitch_controller(_xenConnection.Session, null); } } } break; default: break; } Pool.set_other_config(_xenConnection.Session, _Pool.opaque_ref, other_config); } catch (System.Exception ex) { base.Exception = ex; throw; } }
public void InitReplicationViewData() { BackupRestoreConfig.BrSchedule schedule = (BackupRestoreConfig.BrSchedule)HalsignUtil.JsonToObject(other_config["halsign_rep_rules"], typeof(BackupRestoreConfig.BrSchedule)); BackupRestoreConfig.Job job = (BackupRestoreConfig.Job)HalsignUtil.JsonToObject(other_config["halsign_br_job_r"], typeof(BackupRestoreConfig.Job)); this.Text = schedule.jobName + this.Text; string[] details = schedule.details.Split('|'); VMNameDetailLabel.Text = vm_name; if (job.request.StartsWith(BackupRestoreConfig.REPLICATION_ONCE)) { JobScheduleTypeDetailLabel.Text = Messages.REPLICATION_ONCE; } else if (job.request.StartsWith(BackupRestoreConfig.REPLICATION_DAILY)) { JobScheduleTypeDetailLabel.Text = Messages.REPLICATION_DAILY; RecurDetailLabel.Text = schedule.recur + Messages.BACKUP_RECUR_TEXT_DAYS; } else if (job.request.StartsWith(BackupRestoreConfig.REPLICATION_WEEKLY)) { JobScheduleTypeDetailLabel.Text = Messages.REPLICATION_WEEKLY; List <int> WeeklyDays = schedule.weeklyDays; WeeklyDays.Sort(); string WeeklyDayStr = ""; if (WeeklyDays != null && WeeklyDays.Count > 0) { foreach (var weeklyDay in WeeklyDays) { switch (weeklyDay) { case 0: WeeklyDayStr += Messages.SUNDAY + ","; break; case 1: WeeklyDayStr += Messages.MONDAY + ","; break; case 2: WeeklyDayStr += Messages.TUESDAY + ","; break; case 3: WeeklyDayStr += Messages.WEDNESDAY + ","; break; case 4: WeeklyDayStr += Messages.THURSDAY + ","; break; case 5: WeeklyDayStr += Messages.FRIDAY + ","; break; case 6: WeeklyDayStr += Messages.SATURDAY + ","; break; } } } WeeklyDaysDetailLabel.Text += WeeklyDayStr.Substring(0, WeeklyDayStr.Length - 1); RecurDetailLabel.Text = schedule.recur + Messages.BACKUP_RECUR_TEXT_WEEKS; } else if (job.request.StartsWith(BackupRestoreConfig.REPLICATION_CIRCLE)) { JobScheduleTypeDetailLabel.Text = Messages.REPLICATION_CIRCLE; RecurDetailLabel.Text = schedule.recur + Messages.BACKUP_RECUR_TEXT_HOURS; } JobNameDetailLable.Text = schedule.jobName; StartDateDetailLabel.Text = schedule.scheduleDate; StartTimeDetailLabel.Text = schedule.scheduleTime; AppendDetailLabel.Text = details[3]; DestServerDetailLabel.Text = details[0]; DestSRDetailLabel.Text = details[4]; NetworkDetailLabel.Text = details[7]; string hostname = details[0]; //int port = 80; // default string user = details[1]; string password = details[2]; Session session = null; try { XenConnection XenConnection = new XenConnection(hostname, ""); session = SessionFactory.CreateSession(connection, hostname, 443); session.login_with_password(user, password, API_Version.LATEST); /*XenRef<SR> sr = SR.get_by_uuid(session, details[4]); * DestSRDetailLabel.Text = SR.get_name_label(session, sr); * XenRef<XenAPI.Network> network = XenAPI.Network.get_by_uuid(session, details[7]); * NetworkDetailLabel.Text = XenAPI.Network.get_name_label(session, network).Replace("Pool-wide network associated with eth", Messages.NETWORK); */ setSrNetwork(session, details); }catch (Failure exn) { if ("HOST_IS_SLAVE".Equals(exn.ErrorDescription[0])) { session = SessionFactory.CreateSession(connection, exn.ErrorDescription[1], 443); session.login_with_password(user, password, API_Version.LATEST); setSrNetwork(session, details); } } /*catch (Failure f) * { * if (f.ErrorDescription.Count > 0) * throw new CancelledException(); * }*/ finally { if (session != null) { session.logout(); } } OptionDetailLabel.Text = ""; }
public void InitBackupViewData() { BackupRestoreConfig.BrSchedule schedule = (BackupRestoreConfig.BrSchedule)HalsignUtil.JsonToObject(other_config["halsign_br_rules"], typeof(BackupRestoreConfig.BrSchedule)); BackupRestoreConfig.Job job = (BackupRestoreConfig.Job)HalsignUtil.JsonToObject(other_config["halsign_br_job_s"], typeof(BackupRestoreConfig.Job)); VMNameDetailLabel.Text = vm_name; this.Text = schedule.jobName + this.Text; if (job.request.StartsWith(BackupRestoreConfig.FULL_BACKUP_ONCE) || (job.request.StartsWith(BackupRestoreConfig.FULL_BACKUP) && schedule.scheduleType == 1)) { JobScheduleTypeDetailLabel.Text = Messages.FULL_BACKUP_NOW; } else if (job.request.StartsWith(BackupRestoreConfig.BACKUP_ONCE) || (job.request.StartsWith(BackupRestoreConfig.FULL_BACKUP) && schedule.scheduleType == 1)) { JobScheduleTypeDetailLabel.Text = Messages.BACKUP_ONCE; } else if (job.request.StartsWith(BackupRestoreConfig.BACKUP_DAILY) || (job.request.StartsWith(BackupRestoreConfig.FULL_BACKUP) && schedule.scheduleType == 2)) { JobScheduleTypeDetailLabel.Text = Messages.BACKUP_DAILY; RecurDetailLabel.Text = schedule.recur + Messages.BACKUP_RECUR_TEXT_DAYS; } else if (job.request.StartsWith(BackupRestoreConfig.BACKUP_WEEKLY) || (job.request.StartsWith(BackupRestoreConfig.FULL_BACKUP) && schedule.scheduleType == 3)) { JobScheduleTypeDetailLabel.Text = Messages.BACKUP_WEEKLY; List <int> WeeklyDays = schedule.weeklyDays; WeeklyDays.Sort(); string WeeklyDayStr = ""; if (WeeklyDays != null && WeeklyDays.Count > 0) { foreach (var weeklyDay in WeeklyDays) { switch (weeklyDay) { case 0: WeeklyDayStr += Messages.SUNDAY + ","; break; case 1: WeeklyDayStr += Messages.MONDAY + ","; break; case 2: WeeklyDayStr += Messages.TUESDAY + ","; break; case 3: WeeklyDayStr += Messages.WEDNESDAY + ","; break; case 4: WeeklyDayStr += Messages.THURSDAY + ","; break; case 5: WeeklyDayStr += Messages.FRIDAY + ","; break; case 6: WeeklyDayStr += Messages.SATURDAY + ","; break; } } } WeeklyDaysDetailLabel.Text += WeeklyDayStr.Substring(0, WeeklyDayStr.Length - 1); RecurDetailLabel.Text = schedule.recur + Messages.BACKUP_RECUR_TEXT_WEEKS; } else if (job.request.StartsWith(BackupRestoreConfig.BACKUP_CIRCLE) || (job.request.StartsWith(BackupRestoreConfig.FULL_BACKUP) && schedule.scheduleType == 4)) { JobScheduleTypeDetailLabel.Text = Messages.BACKUP_CIRCLE; RecurDetailLabel.Text = schedule.recur + Messages.BACKUP_RECUR_TEXT_HOURS; } JobNameDetailLable.Text = schedule.jobName; StartDateDetailLabel.Text = schedule.scheduleDate; StartTimeDetailLabel.Text = schedule.scheduleTime; OptionDetailLabel.Text = schedule.expect_full_count == -1 ? "" : string.Format(Messages.FULL_BACKUP_RECURS_EVERY, schedule.expect_full_count); }