/// <summary> /// /// </summary> public void Save() { EDBEntities eDB = new EDBEntities(); // To determine which items have been deleted in the collection, get all objects of the project stored in the database table first var tblTemplates = eDB.tblTemplates.Where(p => p.Project_ID == Globals.Project_ID); // Check if each template of the table exists in the templates collection // if not, delete the template in the table foreach (var templateRec in tblTemplates) { var templateItem = GetTemplate(templateRec.ID); if (templateItem == null) // template not found in collection { eDB.tblTemplates.Remove(templateRec); } } // Add and update templates recursively SaveLevel(Templates, eDB); try { eDB.SaveChanges(); } catch (Exception ex) { RadWindow.Alert(new DialogParameters() { Header = "Error", Content = "Fault while saving templates:\n" + ex.Message }); } SaveTreeState(); }
void mrsClient_SetContractStatusCompleted(object sender, SetContractStatusCompletedEventArgs e) { BusyIndicator1.IsBusy = false; if (e.Error == null) { if (!e.Result) { DialogParameters param = new DialogParameters(); param.Header = "Update failed"; param.Content = "Update failed!\r\nPlease contact the System Administrator."; RadWindow.Alert(param); } else { RadWindow window = this.ParentOfType <RadWindow>(); if (window != null) { window.DialogResult = true; window.Close(); } } } else { ExceptionHandler.PopUpErrorMessage(e.Error, "SetContractStatusCompleted"); } }
/// <summary> /// Loads the records from the DbSet into the ViewModel. This function designed for recursive use /// </summary> /// <returns>Observable collection of Projects</returns> private void Load() { using (EDBEntities eDB = new EDBEntities()) { try { foreach (tblProject Rec in (from o in eDB.tblProjects select o)) { ProjectModel projectItem = new ProjectModel { ID = Rec.ID, ProjectName = Rec.ProjectName, ContractNo = Rec.ContractNo, CustomerName = Rec.CustomerName, Logo = Rec.Logo, LastOpened = Rec.LastOpened, LastOpenedBy = Rec.LastOpenedBy }; Projects.Add(projectItem); } } catch (Exception ex) { RadWindow.Alert(ex.Message); } } }
private void actfolio() { intcogid = intcogid + 1; try { string connectionStringer = "SERVER = gggctserver.database.windows.net; DATABASE = devArellantas; USER ID = sysadmin_gg_gc_sa_dgo_testing; PASSWORD = GRUPO.gu@di@[email protected]_#Staging_Test.2099 "; SqlConnection sqlcon = new SqlConnection(connectionStringer); sqlcon.Open(); string consulta = " UPDATE [dbo].[DatosServicios] SET [Prefijo] = 'LRG' ,[NumeroServicio] = " + intcogid + " WHERE Prefijo = 'LRG'"; SqlCommand agregar = new SqlCommand(consulta, sqlcon); agregar.ExecuteNonQuery(); sqlcon.Close(); } catch (SqlException ex) { RadWindow radWindow = new RadWindow(); RadWindow.Alert(new DialogParameters() { Content = "Revise su conexón a internet.", Header = "BIG", DialogStartupLocation = WindowStartupLocation.CenterOwner // IconContent = ""; }); } }
void ObjectsItemEndEdit(IEditableObject sender) { EspecialZoneViewModel UIObject = sender as EspecialZoneViewModel; try { if (UIObject.Name != null) { int id = EspecialZonesDataAccess.UpdateZone(UIObject.GetDataObject()); if (id != -1) { UIObject.Id = id; } } } catch (Exception ex) { log.Error(ex.StackTrace); UIObjects.Remove(UIObject); RadWindow.Alert(new DialogParameters { Content = MessageUtil.FormatMessage("ERROR.DuplicatedZone", UIObject.Name, UIObject.Name) }); } }
/// <summary> /// /// </summary> public void Save() { EDBEntities eDB = new EDBEntities(); // To determine which items have been deleted in the collection, get all associations of the project stored in the database table first var tblObjectAssociations = eDB.tblObjectAssociations.Where(p => p.Project_ID == Globals.Project_ID); // Check if each association of the table exists in the associations collection // if not, delete the association in the table foreach (var objectAssociationRec in tblObjectAssociations) { var objectAssociationItem = GetObjectAssociation(objectAssociationRec.Object_ID, objectAssociationRec.Association_ID); if (objectAssociationItem == null) // association not found in collection { eDB.tblObjectAssociations.Remove(objectAssociationRec); } } // Add and update associations recursively SaveLevel(ObjectAssociations, eDB); try { eDB.SaveChanges(); } catch (Exception ex) { RadWindow.Alert(new DialogParameters() { Header = "Error", Content = "Fault while saving object associations:\n" + ex.Message }); } IsChanged = false; }
private void Delete(object sender, RoutedEventArgs e) { if (tabla.Rows.Count > 0) { tabla.Rows[m_selectedIndex].Delete(); } else { RadWindow radWindow = new RadWindow(); RadWindow.Alert(new DialogParameters() { Content = "No hay articulos para eliminar.", Header = "BIG", DialogStartupLocation = WindowStartupLocation.CenterOwner // IconContent = ""; }); } if (m_selectedIndex == -1) { return; } RemoveItem(m_selectedIndex); this.DeleteButton.IsEnabled = false; }
private void okRadButton_Click(object sender, RoutedEventArgs e) { var name = nameTextbox.Text; var errorMessage = ""; _ViewModel.DL.Name = nameTextbox.Text; if (_ViewModel.DLss.CurrentItem is DL dL) { if (nameTextbox.Text == "") { errorMessage += $"نام شخص وارد نشده است {Environment.NewLine}"; } if (familyTextBox.Text == "") { errorMessage += $"نام خانوادگی شخص وارد نشده است {Environment.NewLine}"; } if (errorMessage.Length > 0) { DialogParameters parameters = new DialogParameters(); parameters.OkButtonContent = "بستن"; parameters.Header = "!اخطار"; parameters.Content = errorMessage; RadWindow.Alert(parameters); } else { dL.Title = nameTextbox.Text + " " + familyTextBox.Text; dL.Name = nameTextbox.Text; dL.Family = familyTextBox.Text; _ViewModel.Active = false; Close(); } } }
private void BtnBuscar_Click(object sender, RoutedEventArgs e) { int expediente = 0; Int32.TryParse(TxtExpediente.Text, out expediente); if (expediente != 0) { empleado = new EmpleadosModel().GetEmpleadoPorExpediente(expediente); if (empleado != null) { TxtNombre.Text = empleado.Nombre; TxtApellidos.Text = empleado.Apellidos; RcbArea.SelectedValue = empleado.IdArea; } else { RadWindow.Alert("El número de expediente que ingreso no existe. Favor de verificar"); } } else { RadWindow.Alert("Ingrese el número de expediente del servidor público que desea eliminar"); } }
private void Save() { if (this.SelectedTemplate != null) { var template = this.SelectedTemplate; var param = Settings.Current.GetDialogParameters(); if (string.IsNullOrEmpty(template.Name)) { param.Content = "You must specify a name for your template."; RadWindow.Alert(param); } else { var path = Properties.Settings.Default.RepTemplates + "\\" + template.Name + ".xml"; if (File.Exists(path)) { RadWindow.Confirm(template.Name + " already exists." + Environment.NewLine + "Do you want to overwrite it ?", OnSaveConfirm); } else { this.SaveTemplateAsFile(template, path); } } } }
private void SaveAs() { if (this.SelectedTemplate != null) { var template = this.SelectedTemplate; if (string.IsNullOrEmpty(template.Name)) { var param = Settings.Current.GetDialogParameters(); param.Content = "You must specify a name for your template."; RadWindow.Alert(param); } else { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.InitialDirectory = Settings.Current.RepTemplates; saveFileDialog.FileName = template.Name; saveFileDialog.AddExtension = true; saveFileDialog.Filter = "XML files (*.xml)|*.xml"; saveFileDialog.Title = "Save As ..."; if (saveFileDialog.ShowDialog() == DialogResult.OK) { this.SaveTemplateAsFile(template, saveFileDialog.FileName); } } } }
private void Save(SideButton sideButton) { if (!Position.HasErrors) { switch (sideButton) { case SideButton.Add: Position.Insert(); Positions.Add(Position); break; case SideButton.Edit: Position.Update(); OldPosition.Copy(Position); break; } ReturnState(sideButton); } else { RadWindow.Alert(new DialogParameters { Content = "Ada data yg masih kosong", Owner = Application.Current.MainWindow }); } }
private void LoadTreeState() { TD.ObservableItemCollection <ObjectModel> isExpandedCollection; XmlSerializer x = new XmlSerializer(typeof(TD.ObservableItemCollection <ObjectModel>)); //ToDo: put filename in configuration var xmlFileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Sculptor\\" + Globals.ContractNo + "_ObjectExpandedState.xml"); if (File.Exists(xmlFileName)) { try { using (var stream = new FileStream(xmlFileName, FileMode.Open)) { isExpandedCollection = x.Deserialize(stream) as TD.ObservableItemCollection <ObjectModel>; LoadTreeStateRecursive(isExpandedCollection); } } catch (Exception ex) { RadWindow.Alert(new DialogParameters() { Header = "Error", Content = "Error while opening expansion state\n" + ex.Message }); } } }
private void ImportSDDPFilesButton_Click(object sender, RoutedEventArgs e) { Errors = 0; Warnings = 0; bool canImportStart = false; if (Directory.Exists(filesReadingParametersViewModel.InputFilesPath)) { canImportStart = true; if (filesReadingParametersViewModel.CreateScenario) { string scenarioFolder = filesReadingParametersViewModel.GetDataObject().ScenarioFolderName + 1; if (!Directory.Exists(scenarioFolder)) { canImportStart = false; MessageBox.Show(MessageUtil.FormatMessage("ERROR.InvalidFolderName", scenarioFolder), MessageUtil.FormatMessage("LABEL.SDDPFilesImportDialog"), MessageBoxButton.OK, MessageBoxImage.Error); } } if (canImportStart) { ImportBusyIndicator.IsBusy = true; BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += ImportSDDPFiles; worker.RunWorkerCompleted += ImportCompleted; worker.RunWorkerAsync(); } } else { RadWindow.Alert(MessageUtil.FormatMessage("ERROR.InvalidFolder")); } }
public void GetAllClassroomBuildings() { Dictionary <string, string> parameters = new Dictionary <string, string>(); int total = 0; try { Collection <ClassroomBuilding> classroomBuildings = restConnection.GetPageValues <ClassroomBuilding>("api/ClassroomBuilding/GetAllClassroomBuildings" , 1, 0, 1000000, parameters, ref total); if (null != classroomBuildings) { ClassroomBuildings = new ObservableCollection <ClassroomBuilding>(classroomBuildings); } } catch (Exception e) { RadWindow.Alert(new DialogParameters { OkButtonContent = "确定", Content = e.Message, Owner = App.Current.MainWindow, Header = "错误" }); } }
public void GetAllFaculties() { Dictionary <string, string> parameters = new Dictionary <string, string>(); int total = 0; try { Collection <FacultyModel> faculties = restConnection.GetPageValues <FacultyModel>("api/Faculty/GetAll" , 1, 0, 1000000, parameters, ref total); if (null != faculties) { Faculties = new ObservableCollection <FacultyModel>(faculties); } } catch (Exception e) { RadWindow.Alert(new DialogParameters { OkButtonContent = "确定", Content = e.Message, Owner = App.Current.MainWindow, Header = "错误" }); } }
public bool SetCentralizedControl(CentralizedControlModel data) { bool result = false; try { Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("terminalId", data.TerminalId); parameters.Add("terminalIp", data.TerminalIp); Dictionary <string, string> switchs = new Dictionary <string, string>(); switchs.Add("System", data.CentralizedControlSwitch ? "1" : "0"); switchs.Add("AirConditioner", data.AirConditionerSwitch ? "1" : "0"); switchs.Add("Lamp", data.LampSwitch ? "1" : "0"); parameters.Add("parameters", JsonConvert.SerializeObject(switchs)); JObject jo = restConnection.Get("api/TerminalOperate/SetParameter", parameters); if (null != jo && jo.Value <bool>("success")) { result = true; } } catch (Exception e) { RadWindow.Alert(new DialogParameters { OkButtonContent = "确定", Content = e.Message, Owner = App.Current.MainWindow, Header = "错误" }); } return(result); }
public bool AddRecord(object data) { bool result = false; try { JObject jo = restConnection.Post("api/IcCardInfoMaint/CreatIcCard", data); if (null != jo) { IcCardModel icCard = jo.Value <JObject>("data").ToObject <IcCardModel>(); SelectedItem.Id = icCard.Id; result = true; } } catch (Exception e) { RadWindow.Alert(new DialogParameters { OkButtonContent = "确定", Content = e.Message, Owner = App.Current.MainWindow, Header = "错误" }); } return(result); }
private void BtnAceptar_Click(object sender, RoutedEventArgs e) { if (idEvento == 0) { RadWindow.Alert("Seleccione el tipo de evento presentado"); return; } Eventos evento = new Eventos(); evento.IdEmpleado = Convert.ToInt32(RcbEmpleados.SelectedValue); evento.IdEvento = idEvento; evento.StartDate = RdpDesde.SelectedDate.Value; evento.EndDate = (idEvento == 1) ? RdpHasta.SelectedDate.Value : evento.StartDate; evento.IdIncidente = (idEvento == 1) ? Convert.ToInt32(RcbJustificantes.SelectedValue) : 0; evento.Observaciones = (idEvento == 1) ? TxtObservaciones.Text : " "; if (evento.StartDate == evento.EndDate) { new EventosModel().SetEventoAislado(evento); } else { new EventosModel().SetEventoPeriodico(evento); } }
private void OKButton_Click(object sender, RoutedEventArgs e) { if (cmbOwner.SelectedIndex > 0) { BusyIndicator1.IsBusy = true; BusyIndicator1.BusyContent = "Assigning Estimate..."; if (_recordType == "Queue") { _mrsClient.AssignQueuedEstimateCompleted += new EventHandler <AssignQueuedEstimateCompletedEventArgs>(mrsClient_AssignQueuedEstimateCompleted); _mrsClient.AssignQueuedEstimateAsync(_recordId, (App.Current as App).CurrentUserId, Convert.ToInt32(cmbOwner.SelectedValue)); } else { _mrsClient.AssignWorkingEstimateCompleted += new EventHandler <System.ComponentModel.AsyncCompletedEventArgs>(mrsClient_AssignWorkingEstimateCompleted); _mrsClient.AssignWorkingEstimateAsync(_recordId, (App.Current as App).CurrentUserId, Convert.ToInt32(cmbOwner.SelectedValue)); } } else { DialogParameters param = new DialogParameters(); param.Header = "Owner is required"; param.Content = "Please specify the Owner"; RadWindow.Alert(param); } }
static DataTable GetDetail(string folio) { string conect = "SERVER = gggctserver.database.windows.net; DATABASE = devArellantas; USER ID = sysadmin_gg_gc_sa_dgo_testing; PASSWORD = GRUPO.gu@di@[email protected]_#Staging_Test.2099 "; SqlConnection sqlconn = new SqlConnection(conect); try { sqlconn.Open(); } catch (Exception ex) { RadWindow radWindow = new RadWindow(); RadWindow.Alert(new DialogParameters() { Content = "Revise su conexón a internet.", Header = "BIG", DialogStartupLocation = WindowStartupLocation.CenterOwner // IconContent = ""; }); } SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM RemisionDetail WHERE FolioRemision = '" + folio + "' ", sqlconn); DataSet dsPubs = new DataSet("Pubs"); adapter.Fill(dsPubs, "RemisionDetail"); DataTable dtbl = new DataTable(); dtbl = dsPubs.Tables["RemisionDetail"]; sqlconn.Close(); return(dtbl); }
private void generardetalle(System.Data.DataTable tblDetalle) { try { objectDataSource1.DataSource = tblDetalle; this.table1.DataSource = objectDataSource1; txtNumeroDeFolio.Value = tblDetalle.Rows[0][11].ToString(); m_nombre = tblDetalle.Rows[0][11].ToString(); DateTime deit = Convert.ToDateTime(tblDetalle.Rows[0][14]); txtFecha.Value = deit.ToString("dd/MMMM/yyyy").ToUpper(); } catch (Exception eq) { RadWindow radWindow = new RadWindow(); RadWindow.Alert(new DialogParameters() { Content = "Error al generar detalle.", Header = "BIG", DialogStartupLocation = WindowStartupLocation.CenterOwner // IconContent = ""; }); } }
private void SaveForum() { try { var mainVM = ServiceLocator.Current.GetInstance <MainViewModel>(); var template = mainVM.SelectedTemplate; if (template != null) { var content = template.GetTxtReport(this.Full, this.Gems, this.Materials, true); if (!string.IsNullOrEmpty(content)) { Clipboard.SetText(content, TextDataFormat.Text); var param = Settings.Current.GetDialogParameters(); param.Content = "Report saved to ClipBoard !"; RadWindow.Alert(param); } } } catch (Exception) { var param = Settings.Current.GetDialogParameters(); param.Content = "An error occured while saving the template to clipboard ! Please, try again later."; RadWindow.Alert(param); } }
private void generarHeader(System.Data.DataTable tblHeader) { try { txtNumeroDeCliente.Value = tblHeader.Rows[0][1].ToString(); txtReceptorNombre.Value = tblHeader.Rows[0][3].ToString(); txtReceptorDireccion.Value = tblHeader.Rows[0][4].ToString(); txtReceptorColonia.Value = tblHeader.Rows[0][5].ToString(); txtReceptorCiudad.Value = tblHeader.Rows[0][7].ToString() + " " + tblHeader.Rows[0][8].ToString() + " " + tblHeader.Rows[0][6].ToString(); txtReceptorRFC.Value = tblHeader.Rows[0][2].ToString(); txtNota.Value = tblHeader.Rows[0][14].ToString(); double cant = Convert.ToDouble(tblHeader.Rows[0][11]); decimal canti = Convert.ToDecimal(cant); txtSubtotal.Value = "$" + cant.ToString("#,###.00", CultureInfo.InvariantCulture); generarImportes(canti); // txtNumeroDeFolio.Value = tblHeader.Rows[0][1].ToString(); } catch (Exception eq) { RadWindow radWindow = new RadWindow(); RadWindow.Alert(new DialogParameters() { Content = "Error al generar el archivo PDF.", Header = "BIG", DialogStartupLocation = WindowStartupLocation.CenterOwner // IconContent = ""; }); } }
void _mrsClient_ValidateSetEstimateStatusCompleted(object sender, ValidateSetEstimateStatusCompletedEventArgs e) { _mrsClient.ValidateSetEstimateStatusCompleted -= new EventHandler <ValidateSetEstimateStatusCompletedEventArgs>(_mrsClient_ValidateSetEstimateStatusCompleted); if (e.Error == null) { if (e.Result != null) { BusyIndicator1.IsBusy = false; DialogParameters param = new DialogParameters(); param.Header = "Validation Error"; param.Content = e.Result; RadWindow.Alert(param); } else { // If the Comments has been modified if ((_comments != txtComments.Text || _summary != txtvariationsummary.Text) && _createNewRevision) { _mrsClient.UpdateCommentCompleted += new EventHandler <System.ComponentModel.AsyncCompletedEventArgs>(mrsClient_UpdateCommentCompleted); _mrsClient.UpdateCommentAsync(_estimateRevisionId, txtComments.Text, (App.Current as App).CurrentUserId, int.Parse(_customerdocumentnumber), txtvariationsummary.Text); } else { CreateLog(); } } } else { ExceptionHandler.PopUpErrorMessage(e.Error, "ValidateSetEstimateStatusCompleted"); BusyIndicator1.IsBusy = false; } }
private void btnCompare_Click(object sender, RoutedEventArgs e) { if (cmbRevision1.SelectedItem != null && cmbRevision2.SelectedItem != null) { BusyIndicator1.IsBusy = true; HeaderGrid.Columns[1].Header = ((EstimateGridItem)cmbRevision1.SelectedItem).RevisionDetails; HeaderGrid.Columns[2].Header = ((EstimateGridItem)cmbRevision2.SelectedItem).RevisionDetails; HeaderCompareGrid.Columns[1].Header = HeaderGrid.Columns[1].Header; HeaderCompareGrid.Columns[2].Header = HeaderGrid.Columns[2].Header; RetailSystemClient mrsClient = new RetailSystemClient(); mrsClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(Internal.Utilities.GetMetriconRetailSystemWcfClientEndpointUrl()); mrsClient.CompareEstimateHeaderCompleted += new EventHandler <CompareEstimateHeaderCompletedEventArgs>(mrsClient_CompareEstimateHeaderCompleted); mrsClient.CompareEstimateHeaderAsync(Convert.ToInt32(cmbRevision1.SelectedValue), Convert.ToInt32(cmbRevision2.SelectedValue)); } else { DialogParameters param = new DialogParameters(); param.Header = "Estimate Revisions Required"; param.Content = "Please specify both Source and Destination revisions to compare."; RadWindow.Alert(param); } }
void mrsClient_CreateTaskForContractCompleted(object sender, CreateTaskForContractCompletedEventArgs e) { _mrsClient.CreateTaskForContractCompleted -= new EventHandler <CreateTaskForContractCompletedEventArgs>(mrsClient_CreateTaskForContractCompleted); if (e.Error == null) { if (!e.Result) { DialogParameters param = new DialogParameters(); param.Header = "Create Task Failed"; param.Content = "Create Task failed!\r\nPlease contact the System Administrator."; RadWindow.Alert(param); BusyIndicator1.IsBusy = false; } else { CompleteEstimate(); } } else { ExceptionHandler.PopUpErrorMessage(e.Error, "CreateTaskForContractCompleted"); BusyIndicator1.IsBusy = false; } }
public Map OpenNewMapWizardDialog() { var newMapWizard = new Wizard.NewMapWizard() { Owner = App.Current.MainWindow }; var dialogResult = newMapWizard.ShowDialog(); if (dialogResult.HasValue && dialogResult.Value) { try { var newMapWizardViewModel = ServiceLocator.Current.GetInstance <NewMapWizardViewModel>(); return(DataService.NewMap(newMapWizardViewModel.FileName, newMapWizardViewModel.CHMFileName)); } catch (Exception ex) { var dialogParameters = new DialogParameters() { Content = $"Error creating new map: {ex.Message}" }; RadWindow.Alert(dialogParameters); return(null); } } else { return(null); } }
private static void ShowMessage(string message, string header) { RadWindow.Alert(new DialogParameters() { Header = header, Content = message }); }
/// <summary> /// Description: Limpia cada uno de los valores del procedimiento /// </summary> private void _clearButton_btn_Click(object sender, RoutedEventArgs e) { Procedures procedures = SelectFailsProcedures.Where <Procedures>(wprocedure => wprocedure.Procedure.name == "Weight and Balance").First(); procedure procedure = procedures.Procedure; //Logic clear procedures _textZone1_txt.Text = ""; _textZone2_txt.Text = ""; _textZone3_txt.Text = ""; _textZone4_txt.Text = ""; _textZone5_txt.Text = ""; _textZone6_txt.Text = ""; _textZoneA_txt.Text = ""; _textZoneB_txt.Text = ""; _textZoneC_txt.Text = ""; _textZoneD_txt.Text = ""; RadWindow.Alert(new DialogParameters { Header = "Alert", Content = "Pounds cleared", OkButtonContent = "Ok", Owner = this }); }