Exemplo n.º 1
0
        void init()
        {
            HasHistory = HistoryCheck(change);
            string[] date = calendar.SplitDate(change.getFromDate());
            lblFrom.Text = date[0] + "-" + date[1] + "-";
            txtFrom.Text = date[2];
            if (change.getToDate() != null)
            {
                date       = calendar.SplitDate(change.getToDate());
                lblTo.Text = date[0] + "-" + date[1] + "-";
                txtTo.Text = date[2];
            }
            else
            {
                lblTo.Text = lblFrom.Text;
                txtTo.Text = txtFrom.Text;
            }
            Option3.Text = change.getStatus();
            if (Option3.Text == "R")
            {
                Option3.BackColor = Color.LightPink;
                Option1.BackColor = Color.LightGreen;
                Option2.BackColor = Color.Khaki;
                Option1.Text      = "W";
                Option2.Text      = "A";
            }
            else if (Option3.Text == "W")
            {
                Option3.BackColor = Color.LightGreen;
                Option1.BackColor = Color.LightPink;
                Option2.BackColor = Color.Khaki;
                Option1.Text      = "R";
                Option2.Text      = "A";
            }
            else if (Option3.Text == "A")
            {
                Option3.BackColor = Color.Khaki;
                Option1.BackColor = Color.LightGreen;
                Option2.BackColor = Color.LightPink;
                Option1.Text      = "W";
                Option2.Text      = "R";
            }
            txtReason.Text = change.getReason();
            Personnel person = db.getPerson(change.getPersonId());

            lblName.Text      = person.getName();
            HasChangeToSave   = !HasHistory;
            btnRemove.Visible = HasHistory;
            HasChangeToSave   = false;
        }
Exemplo n.º 2
0
        public void updatePerson(Personnel person)
        {
            string sql = "UPDATE personnel SET name = '" + person.getName() +
                         "', start = '" + person.getStart() +
                         "', work = " + person.getWork() +
                         ", rest = " + person.getRest() +
                         ", xp_id = " + person.getXpId() +
                         " WHERE id = " + person.getId() + ";";

            connection.Open();
            SQLiteCommand command = new SQLiteCommand(sql, connection);

            command.ExecuteNonQuery();
            connection.Close();
        }
Exemplo n.º 3
0
        public void addPerson(Personnel person)
        {
            string sql = "INSERT INTO personnel (name, start, work, rest, xp_id) VALUES " +
                         "('" + person.getName() + "', '" +
                         person.getStart() + "', " +
                         person.getWork() + ", " +
                         person.getRest() + ", " +
                         person.getXpId() + ");";

            connection.Open();
            SQLiteCommand command = new SQLiteCommand(sql, connection);

            command.ExecuteNonQuery();
            connection.Close();
        }
Exemplo n.º 4
0
 private void init()
 {
     txtName.Text = person.getName();
     txtRest.Text = person.getRest().ToString();
     txtWork.Text = person.getWork().ToString();
     String[] date = calendar.SplitDate(person.getStart());
     txtRDay.Text           = date[2];
     txtRYear.Text          = date[0];
     cbRMonth.SelectedIndex = int.Parse(date[1]) - 1;
     xps = db.getExpertise();
     foreach (Expertise xp in xps)
     {
         cbXP.Items.Add(xp.getXp());
     }
     cbXP.SelectedIndex = cbXP.Items.IndexOf(person.getXp());
     HasChangeToSave    = false;
 }