Exemplo n.º 1
0
 /// <summary>
 /// Checks all the textboxes for valid data then runs UpdateEscapeRoom, shows CreateEscapeRoom and hides itself
 /// it has error messages is the data is invalid
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnUpdateRoom_Click(object sender, EventArgs e)
 {
     if (txbName.Text.Equals(""))
     {
         txbName.Text      = "Dette felt skal have en værdig";
         txbName.BackColor = Color.Red;
     }
     else if (txbDescription.Text.Equals(""))
     {
         txbDescription.Text      = "Dette felt skal have en værdig";
         txbDescription.BackColor = Color.Red;
     }
     else if (txbMaxClearTime.Text.Equals(""))
     {
         txbMaxClearTime.Text      = "";
         txbMaxClearTime.BackColor = Color.Red;
     }
     else if (txbCleanTime.Text.Equals(""))
     {
         txbCleanTime.Text      = "";
         txbCleanTime.BackColor = Color.Red;
     }
     else if (txbPrice.Text.Equals(""))
     {
         txbPrice.Text      = "";
         txbPrice.BackColor = Color.Red;
     }
     else
     {
         string  name         = txbName.Text;
         string  description  = txbDescription.Text;
         decimal maxClearTime = Convert.ToDecimal(txbMaxClearTime.Text);
         decimal cleanTime    = Convert.ToDecimal(txbCleanTime.Text);
         decimal price        = Convert.ToDecimal(txbPrice.Text);
         //skal laves om når vi har mere rating indover
         decimal rating = 0;
         int     empID;
         if (Emp == null)
         {
             empID = ER.Emp.EmployeeID;
         }
         else
         {
             empID = Emp.EmployeeID;
         }
         byte[] img;
         if (ER.Image == null)
         {
             img = ConvertImgToBinary(pbEscapeRoom.Image);
         }
         else
         {
             img = ER.Image;
         }
         ERctr.UpdateEscapeRoom(name, description, maxClearTime, cleanTime, price, rating, empID, ER.EscapeRoomID, img);
         this.Hide();
         CreateEscapeRoom cer = new CreateEscapeRoom();
         cer.Show();
     }
 }
Exemplo n.º 2
0
        private void btnMMCreateEscapeRoom_Click(object sender, EventArgs e)
        {
            CreateEscapeRoom ce = new CreateEscapeRoom();

            ce.Show();
            this.Hide();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Shows CreateEscapeRoom and hides itself
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Hide();
            CreateEscapeRoom cer = new CreateEscapeRoom();

            cer.Show();
        }