Exemplo n.º 1
0
        private void CheckOut_Load(object sender, EventArgs e)
        {
            List <string> outItems = new List <string>();
            List <string> inItems  = new List <string>()
            ;

            foreach (string item in Properties.Settings.Default.ItemStatus)
            {
                string[] parts  = item.Split('⎖');
                string   status = parts[1];
                if (status == "In")
                {
                    inItems.Add(ItemManagementSystem.GetName(parts[0])); continue;
                }
                outItems.Add(ItemManagementSystem.GetName(parts[0]));
            }
            foreach (string item in Properties.Settings.Default.Items)
            {
                string[] parts = item.Split('⎖');
                if (inItems.Contains(parts[1]))
                {
                    cbItem.Items.Add(parts[1]); continue;
                }
                if (!outItems.Contains(parts[1]))
                {
                    cbItem.Items.Add(parts[1]);
                }
            }
        }
Exemplo n.º 2
0
 private void btnAddEdit_Click(object sender, EventArgs e)
 {
     try
     {
         int index = 0;
         foreach (string item in Properties.Settings.Default.Items)
         {
             if (txtID.Text == item.Split('⎖')[0])
             {
                 ItemManagementSystem.EditItem(txtID.Text, txtName.Text, txtLocation.Text, txtDescription.Text, index);
                 listPopulate();
                 operationCompleted();
                 return;
             }
             index++;
         }
         ItemManagementSystem.CreateItem(txtID.Text, txtName.Text, txtLocation.Text, txtDescription.Text);
         listPopulate();
         operationCompleted();
         return;
     }
     catch (Exception ex)
     {
         operationFailed();
     }
 }
Exemplo n.º 3
0
        private void btnDown_Click(object sender, EventArgs e)
        {
            if (lbItems.SelectedIndex == -1)
            {
                operationFailed(); return;
            }
            int index = 0;

            foreach (string item in Properties.Settings.Default.Items)
            {
                if (lbItems.SelectedItem.ToString() == item.Split('⎖')[1])
                {
                    if (index == (lbItems.Items.Count - 1))
                    {
                        operationFailed(); return;
                    }
                    string[] parts       = item.Split('⎖');
                    string   id          = parts[0];
                    string   name        = parts[1];
                    string   location    = parts[2];
                    string   description = parts[3];
                    ItemManagementSystem.EditItem(id, name, location, description, index + 1);
                    listPopulate();
                    operationCompleted();
                    lbItems.SelectedItem = name;
                    return;
                }
                index++;
            }
            operationFailed();
        }
Exemplo n.º 4
0
 private void ItemLog_Load(object sender, EventArgs e)
 {
     if (Properties.Settings.Default.Items == null)
     {
         Properties.Settings.Default.Items = new ArrayList();
         Properties.Settings.Default.Save();
         Properties.Settings.Default.Reload();
     }
     lbItems.Items.Clear();
     lbItems.Items.AddRange(ItemManagementSystem.GetNames().ToArray());
 }
Exemplo n.º 5
0
 private void listPopulate()
 {
     if (Properties.Settings.Default.Items == null)
     {
         Properties.Settings.Default.Items = new ArrayList();
         Properties.Settings.Default.Save();
         Properties.Settings.Default.Reload();
     }
     lbItems.Items.Clear();
     lbItems.Items.AddRange(ItemManagementSystem.GetNames().ToArray());
 }
Exemplo n.º 6
0
 private void btnCheckOut_Click(object sender, EventArgs e)
 {
     foreach (string item in Properties.Settings.Default.Items)
     {
         string[] data = item.Split('⎖');
         string   id   = data[0];
         string   name = data[1];
         if (name == cbItem.Text)
         {
             ItemManagementSystem.CheckOut(id, txtReason.Text, dtpMoment.Text);
             MessageBox.Show("Successfully Checked Out " + name);
             Close();
             return;
         }
     }
 }
Exemplo n.º 7
0
 private void btnRemove_Click(object sender, EventArgs e)
 {
     foreach (string item in Properties.Settings.Default.Items)
     {
         if (txtID.Text == item.Split('⎖')[0])
         {
             ItemManagementSystem.RemoveItem(txtID.Text);
             listPopulate();
             operationCompleted();
             return;
         }
     }
     MessageBox.Show("The given id wasn't found. The operation failed.");
     operationFailed();
     listPopulate();
     return;
 }