Exemplo n.º 1
0
        private void Reset()
        {
            TxtUniqueId.Visible        = false;
            CmbUniqueId.Visible        = true;
            LblBookName.Location       = new Point(6, 68);
            CmdBookName.Location       = new Point(121, 62);
            PnlButtons.Location        = new Point(6, 92);
            PnlUser.Visible            = false;
            PnlUser.Location           = new Point(9, 144);
            PnlDateTime.Visible        = false;
            PnlDateTime.Location       = new Point(6, 144);
            BtnBookReservation.Visible = true;
            BtnEnd.Visible             = false;
            BtnEnd.Enabled             = false;
            GrbBookCrud.Size           = new Size(285, 169);

            TxtPenalty.ResetText();
            TxtStartTime.ResetText();
            TxtUniqueId.ResetText();
            CmbUniqueId.ResetText();
            CmdBookName.ResetText();
            TxtName.ResetText();
            TxtPhone.ResetText();
            TxtSurname.ResetText();
            CmbSearchBook.ResetText();
            CmbSearchId.ResetText();
        }
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(TxtName.Text) && !string.IsNullOrEmpty(TxtBudget.Text) && !string.IsNullOrEmpty(TxtName.Text) && comboBoxInstructors.Text != null)
            {
                using (var db = new SchoolEntities())
                {
                    // parsing budget if correct
                    decimal budget = default;
                    decimal.TryParse(TxtBudget.Text, out budget);

                    if (budget.ToString() == "0")
                    {
                        MessageBox.Show("Invalid budget value.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    // parsing deptid if correct
                    int deptID = default;
                    int.TryParse(TxtId.Text, out deptID);

                    if (deptID.ToString() == "0")
                    {
                        MessageBox.Show("Invalid department ID value.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }


                    // getting dept admin id from name + surname
                    var findAdmin = from o in db.Person
                                    where (o.FirstName + " " + o.LastName).Equals(comboBoxInstructors.Text)
                                    select o.PersonID;


                    var dept = new Department()
                    {
                        Name          = TxtName.Text,
                        Budget        = budget,
                        DepartmentID  = deptID,
                        StartDate     = dateTimeStart.Value,
                        Administrator = findAdmin.First()
                    };

                    TxtId.ResetText();
                    TxtBudget.ResetText();
                    TxtName.ResetText();
                    dateTimeStart.ResetText();
                    comboBoxInstructors.SelectedItem = null;

                    db.Department.Add(dept);

                    db.SaveChanges();
                    dataGridViewDepartments.DataSource = db.Department.ToList();
                }
            }
            else
            {
                MessageBox.Show("Please enter missing information.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemplo n.º 3
0
 // Take all values back to their start point
 private void Reset()
 {
     BtnDelete.Visible = false;
     BtnUpdate.Visible = false;
     TxtName.ResetText();
     ClickedRow = -1;
     ClickedId  = 0;
 }
Exemplo n.º 4
0
 private void Reset()
 {
     BtnAdd.Visible    = true;
     BtnDel.Visible    = false;
     BtnUpdate.Visible = false;
     TxtName.ResetText();
     NudCount.Value = 0;
     CmbBookName.ResetText();
 }
Exemplo n.º 5
0
 // Resets all values to default...
 private void Reset()
 {
     TxtName.ResetText();
     TxtSurname.ResetText();
     TxtPhone.ResetText();
     BtnDeleteClient.Visible = false;
     BtnUpdateClient.Visible = false;
     NumBookLimit.Value      = 3;
     clickedId  = 0;
     clickedRow = -1;
 }
Exemplo n.º 6
0
 private void Reset()
 {
     CmbStadiums.ResetText();
     CmbTime.ResetText();
     DtpStartDate.Value = DateTime.Now;
     TxtName.ResetText();
     TxtSurname.ResetText();
     CkbSingleUse.Checked = false;
     CkbSubcribe.Checked  = false;
     CmbWeeks.ResetText();
     CmbWeeks.Enabled = false;
 }
Exemplo n.º 7
0
 private void ReseTextBox()
 {
     this.Abo_Load(abo, usu);
     MtxtIdentification.ResetText();
     TxtName.ResetText();
     TxtFirstN.ResetText();
     TxtLastN.ResetText();
     MtxtPhone.ResetText();
     MtxtMovil.ResetText();
     TxtEmail.ResetText();
     TxtAddress.ResetText();
 }
Exemplo n.º 8
0
 private void Reset()
 {
     BtnAdd.Visible    = true;
     BtnDel.Visible    = false;
     BtnUpdate.Visible = false;
     TxtName.ResetText();
     TxtPhone.ResetText();
     TxtSurname.ResetText();
     TxtUniqueId.ResetText();
     CmbSearchAdmin.ResetText();
     CmbSearchId.ResetText();
 }
Exemplo n.º 9
0
        private void Reset()
        {
            BtnAdd.Visible    = true;
            BtnDel.Visible    = false;
            BtnUpdate.Visible = false;

            TxtLogin.ResetText();
            TxtName.ResetText();
            TxtPhone.ResetText();
            TxtPw.ResetText();
            TxtSurname.ResetText();
            CkbIsBoss.Checked = false;
        }
Exemplo n.º 10
0
 // Reset Text Boxes and radio buttons. Set Id and row index 0 and -1
 private void Reset()
 {
     TxtName.ResetText();
     TxtSurname.ResetText();
     TxtUsername.ResetText();
     TxtPassword.ResetText();
     TxtPhone.ResetText();
     RbtnIsBoss.Checked    = false;
     RbtnNotBoss.Checked   = false;
     BtnDeleteUser.Visible = false;
     BtnUpdateUser.Visible = false;
     clickedId             = 0;
     clickedRow            = -1;
 }