private void BtnAddIncident_Click(object sender, RoutedEventArgs e) { if (String.IsNullOrEmpty(LDAvion.Text) || String.IsNullOrEmpty(getTitre.Text) || String.IsNullOrEmpty(getDesc.Text)) { MessageBox.Show("Veuillez remplir tous les champs !"); } else { var singleton = Datas.GetInstance(); Avion RecupAvion = LDAvion.SelectedItem as Avion; Incident UnIncident = new Incident(); UnIncident.Id_Employe = singleton.Id_Employe; UnIncident.Id_Avion = RecupAvion.Id_Avion; UnIncident.Titre = getTitre.Text; UnIncident.Description = getDesc.Text; UnIncident.DateIncident = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss").Replace("/", "-"); IncidentDAL AjoutIncident = new IncidentDAL(); AjoutIncident.AjouterIncident(UnIncident); this.NavigationService.Navigate(new AjoutIncident()); } }
private void UpdateIncidentDetail() { Incident i = new Incident(); try { i.IIncidentID = Convert.ToInt32(lblIncidentID.Text); i.VCIncidentNumber = txtIncidentNumber.Text; i.VCIncidentType = ddlincidentTypes.SelectedItem.Value; i.VCIncidentLocation = ddlincidentLocations.SelectedItem.Value; i.VCIncidentType = ddlincidentTypes.SelectedItem.Value; i.VCIncident = ddlIncident.SelectedItem.Value; i.VCImpact = ddlImpact.SelectedItem.Value; i.DTincidentDate = Convert.ToDateTime(txtincidentTime.Text); i.VCDescription = txtDescription.Text; if (IncidentDAL.UpdateIncidentDetail(i)) { ErrorMessage = "Success: Details updated."; } else { ErrorMessage = "Error: Update failed."; } } catch (Exception exc) { ErrorMessage = exc.Message; } }
public List <Incident> GetAllIncidents() { List <Incident> lstIncidents = new List <Incident>(); DataTable dtAllIncidents = new DataTable(); IncidentDAL incDal = new IncidentDAL(); dtAllIncidents = incDal.RetrieveAllIncidents(); foreach (DataRow dr in dtAllIncidents.Rows) { Incident anIncident = new Incident(); anIncident.IncidentID = (int)dr["IncidentID"]; anIncident.CustomerID = (int)dr["CustomerID"]; anIncident.ProductCode = (string)dr["ProductCode"]; anIncident.TechID = dr["TechID"] == DBNull.Value ? (int?)null : Convert.ToInt32(dr["TechID"]); anIncident.DateOpened = (DateTime)dr["DateOpened"]; anIncident.DateClosed = dr["DateClosed"] == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(dr["DateClosed"]); anIncident.Title = dr["Title"].ToString(); anIncident.Description = dr["Description"].ToString(); lstIncidents.Add(anIncident); } return(lstIncidents); }
public List <Incident> GetOpenIncidentsByTechnician(int techID) { List <Incident> lstOpenIncidentsByTechnician = new List <Incident>(); DataTable dtOpenIncidentsByTechnician = new DataTable(); IncidentDAL incDal = new IncidentDAL(); dtOpenIncidentsByTechnician = incDal.RetrieveOpenIncidentsByTechnician(techID); //DataRow dr; (cant declare this up here for some reason foreach (DataRow dr in dtOpenIncidentsByTechnician.Rows)//this statement needs the "DataRow" before dr { Incident anIncident = new Incident(); anIncident.IncidentID = (int)dr["IncidentID"]; anIncident.CustomerID = (int)dr["CustomerID"]; anIncident.ProductCode = (string)dr["ProductCode"]; anIncident.TechID = dr["TechID"] == DBNull.Value ? (int?)null : Convert.ToInt32(dr["TechID"]); anIncident.DateOpened = (DateTime)dr["DateOpened"]; anIncident.DateClosed = dr["DateClosed"] == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(dr["DateClosed"]); anIncident.Title = dr["Title"].ToString(); anIncident.Description = dr["Description"].ToString(); lstOpenIncidentsByTechnician.Add(anIncident); } return(lstOpenIncidentsByTechnician); }
public GestionIncident() { InitializeComponent(); IncidentDAL AfficherIncident = new IncidentDAL(); dataGrid.ItemsSource = AfficherIncident.ListeDesIncidents(); }
protected void btnUpdateStatus_Click(object sender, EventArgs e) { try { IncidentDAL.UpdateIncidentStatus(ddlIncidentStatus.SelectedItem.Value, lblIncidentID.Text); GetIncidentHistory(txtIncidentNumber.Text); } catch (Exception exc) { ErrorMessage = exc.Message; } }
private void LoadIncidentLocations(string incidentType) { try { ddlIncident.Items.Clear(); ddlincidentLocations.DataSource = IncidentDAL.GetIncidentLocations(incidentType); ddlincidentLocations.DataBind(); } catch (Exception exc) { ErrorMessage = exc.Message; } }
private void LoadIncidents() { try { DataTable dt = IncidentDAL.GetIncidentsDS().Tables[0]; GridView1.DataSource = dt; GridView1.DataBind(); } catch (Exception exc) { ErrorMessage = exc.Message; } }
private void LoadIncidentsByLocation() { try { string incidentType = ddlincidentTypes.SelectedItem.Text; string Location = ddlincidentLocations.SelectedItem.Text; ddlIncident.DataSource = IncidentDAL.LoadIncidentsByLocation(incidentType, Location); ddlIncident.DataBind(); } catch (Exception exc) { ErrorMessage = exc.Message; } }
private void DeleteAvion_Click(object sender, RoutedEventArgs e) { Incident RecupIncident = dataGrid.SelectedItem as Incident; Incident LIncident = new Incident(); LIncident.Id_Incident = Convert.ToInt32(RecupIncident.Id_Incident);; IncidentDAL SuppressionIncident = new IncidentDAL(); SuppressionIncident.SupprimerIncident(LIncident); this.NavigationService.Navigate(new GestionIncident()); }
private void InsertIncidentDetail() { string vcIncidentType = String.Empty; string vcIncidentLocation = String.Empty; string vcIncident = String.Empty; string vcImpact = String.Empty; String dtincidentDate = String.Empty; String dtIncidentTime = String.Empty; String vcDescription = String.Empty; String vcIncidentNumber = String.Empty; int IncidentID = 0; try { vcIncidentNumber = txtIncidentNumber.Text; vcIncidentType = ddlincidentTypes.SelectedItem.Value; vcIncidentLocation = ddlincidentLocations.SelectedItem.Value; vcIncident = ddlIncident.SelectedItem.Value; vcImpact = ddlImpact.SelectedItem.Value; vcDescription = txtDescription.Text; dtincidentDate = txtIncidentDate.Text; dtIncidentTime = txtincidentTime.Text; IncidentID = IncidentDAL.CreateIncident( vcIncidentNumber, vcIncidentType, vcIncidentLocation, vcIncident, vcImpact, vcDescription, dtincidentDate, dtIncidentTime ); InsertIncidentFiles(IncidentID); ErrorMessage = "Success: Incident create."; } catch (Exception exc) { ErrorMessage = exc.Message; } }
public DetailIncident(int id) { InitializeComponent(); IncidentDAL ResumeIncident = new IncidentDAL(); List <Incident> DetailDeLincident = new List <Incident>(); DetailDeLincident = ResumeIncident.ReadIncident(id); getId.Text = Convert.ToString(DetailDeLincident[0].Id_Incident); getModeleAvion.Text = Convert.ToString(DetailDeLincident[0].Modele); getNom.Text = Convert.ToString(DetailDeLincident[0].Nom); getPrenom.Text = Convert.ToString(DetailDeLincident[0].Prenom); getTitre.Text = Convert.ToString(DetailDeLincident[0].Titre); getDescription.Text = Convert.ToString(DetailDeLincident[0].Description); getDate.Text = Convert.ToString(DetailDeLincident[0].DateIncident); this.idAvion = Convert.ToInt32(DetailDeLincident[0].Id_Avion); }
public List <Incident> GetIncidentsByTechnician(int techID) { List <Incident> lstIncidentsByTech = new List <Incident>(); DataTable dtIncidentsByTech = new DataTable(); IncidentDAL incidentDAL = new IncidentDAL(); dtIncidentsByTech = incidentDAL.RetrieveIncidentsByTechnician(techID); foreach (DataRow dr in dtIncidentsByTech.Rows) { Incident incidentA = new Incident(); incidentA.IncidentID = (int)dr["IncidentID"]; incidentA.CustomerID = (int)dr["CustomerID"]; incidentA.ProductCode = dr["ProductCode"].ToString(); //Need to account for if the TechID value returns a null value. if (dr["TechID"] == DBNull.Value) { incidentA.TechID = null; } else { incidentA.TechID = (int?)dr["TechID"]; } incidentA.DateOpened = (DateTime)dr["DateOpened"]; if (dr["DateClosed"] == DBNull.Value) { incidentA.DateClosed = null; } else { incidentA.DateClosed = (DateTime?)dr["DateClosed"]; } incidentA.Title = dr["Title"].ToString(); incidentA.Description = dr["Description"].ToString(); lstIncidentsByTech.Add(incidentA); } return(lstIncidentsByTech); }
protected void InsertIncidentFiles(int IncidentID) { string filepath = ConfigurationManager.AppSettings["PathToSaveFiles"].ToString(); HttpFileCollection uploadedFiles = Request.Files; for (int i = 0; i < uploadedFiles.Count; i++) { HttpPostedFile userPostedFile = uploadedFiles[i]; try { if (userPostedFile.ContentLength > 0) { String outFolder = filepath + "\\" + IncidentID.ToString(); System.IO.Directory.CreateDirectory(outFolder); Label1.Text += "<u>File #" + (i + 1) + "</u><br>"; Label1.Text += "File Content Type: " + userPostedFile.ContentType + "<br>"; Label1.Text += "File Size: " + userPostedFile.ContentLength + "kb<br>"; Label1.Text += "File Name: " + userPostedFile.FileName + "<br>"; userPostedFile.SaveAs(outFolder + "\\" + System.IO.Path.GetFileName(userPostedFile.FileName)); Label1.Text += "Location where saved: " + outFolder + "\\" + System.IO.Path.GetFileName(userPostedFile.FileName) + "<p>"; IncidentDAL.InsertIncidentFile(IncidentID, outFolder + "\\" + System.IO.Path.GetFileName(userPostedFile.FileName)); } } catch (Exception Ex) { Label1.Text += "Error: <br>" + Ex.Message; } } }
private void GetIncidentDetail(string IIncidentID) { Incident i = IncidentDAL.GetIncidentDetailByID(IIncidentID); lblIncidentID.Text = i.IIncidentID.ToString(); txtIncidentNumber.Text = i.VCIncidentNumber; ddlincidentTypes.Items.FindByText(i.VCIncidentType).Selected = true; LoadIncidentLocations(i.VCIncidentType); ddlincidentLocations.Items.FindByText(i.VCIncidentLocation).Selected = true; ddlincidentTypes.Items.FindByText(i.VCIncidentType).Selected = true; LoadIncidentsByLocation(); ddlIncident.Items.FindByText(i.VCIncident).Selected = true; ddlImpact.Items.FindByText(i.VCImpact).Selected = true; txtIncidentDate.Text = i.DTincidentDate.ToString("dd-MMM-yyyy"); txtincidentTime.Text = i.DTIncidentTime.ToString("hh:mm"); txtDescription.Text = i.VCDescription; GetIncidentHistory(IIncidentID); }
public IncidentBLL() { _incidentDal = new IncidentDAL(); }
private void DeleteRecord(int IncidentID) { IncidentDAL.Delete(IncidentID); LoadIncidents(); }
public AddIncidentController() { this.incidentSource = new IncidentDAL(); }
private void GetIncidentHistory(string IIncidentID) { GridView1.DataSource = IncidentDAL.GetIncidentHistory(IIncidentID); GridView1.DataBind(); }
private void LoadincidentStatus() { ddlIncidentStatus.DataSource = IncidentDAL.GetIncidentStatusList(); ddlIncidentStatus.DataBind(); }
public SearchController() { this.incidentSource = new IncidentDAL(); }