Esempio n. 1
0
 private void dgvDescription_DoubleClick(object sender, EventArgs e)
 {
     if (dgvDescription.CurrentRow.Index != -1)
     {
         this.idSelectedDescription = Convert.ToInt32(dgvDescription.CurrentRow.Cells["IdMaintDesc"].Value);
         maintenanceDescription     = this.db.MaintenanceDescriptions.Where(maintenanceDescription => maintenanceDescription.IdMaintDesc == this.idSelectedDescription).First();
         if (this.maintenanceDescription.DescriptionLong == null)
         {
             this.txtLongDescription.Text = "";
         }
         else
         {
             this.txtLongDescription.Text = this.maintenanceDescription.DescriptionLong.ToString();
         }
         if (this.maintenanceDescription.DescriptionShort == null)
         {
             this.txtShortDescription.Text = "";
         }
         else
         {
             this.txtShortDescription.Text = this.maintenanceDescription.DescriptionShort.ToString();
         }
         btnSave.Text      = "Aktualizuj";
         btnDelete.Enabled = true;
     }
 }
Esempio n. 2
0
 void populateTextBox()
 {
     if (this.idSelectedDescription > 0)
     {
         this.maintenanceDescription = this.db.MaintenanceDescriptions.Where(maintDescription => maintDescription.IdMaintDesc == idSelectedDescription).First();
         if (maintenanceDescription.DescriptionLong == null)
         {
             this.txtDescriptionLong.Text = String.Empty;
         }
         else
         {
             this.txtDescriptionLong.Text = this.maintenanceDescription.DescriptionLong.ToString();
         }
     }
 }
Esempio n. 3
0
 public MaintenanceDescriptionForm(RoofingCompanyEntities db, int tIdMaintDescription)
 {
     this.db = db;
     InitializeComponent();
     txtShortDescription.ReadOnly  = true;
     txtDetailDescription.ReadOnly = true;
     try
     {
         if (tIdMaintDescription > 0)
         {
             this.maintenanceDescription    = db.MaintenanceDescriptions.Where(maintenanceDescription => maintenanceDescription.IdMaintDesc == tIdMaintDescription).First();
             this.txtShortDescription.Text  = maintenanceDescription.DescriptionShort;
             this.txtDetailDescription.Text = maintenanceDescription.DescriptionLong;
             tIdMaintDescription            = 0;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Esempio n. 4
0
 void clear()
 {
     this.txtShortDescription.Text = this.txtLongDescription.Text = "";
     this.maintenanceDescription   = new MaintenanceDescription();
 }