Ejemplo n.º 1
0
 private void AddButton_Click(object sender, EventArgs e)
 {
     if (FirstNameTextBox.Text == "" || SecondNameTextBox.Text == "" || LastNameTextBox.Text == "")
     {
         warningLabel.Text      = "Invalid data";
         warningLabel.Visible   = true;
         warningLabel.ForeColor = Color.Red;
     }
     else
     {
         Database_Elements.DataAccess dataAccess = new Database_Elements.DataAccess();
         dataAccess.InsertInfoMembers(FirstNameTextBox.Text, SecondNameTextBox.Text, LastNameTextBox.Text);
         string fullName = FirstNameTextBox.Text + " " + SecondNameTextBox.Text + " " + LastNameTextBox.Text;
         warningLabel.Text      = "Data inserted succeessfuly";
         warningLabel.Visible   = true;
         warningLabel.ForeColor = Color.Green;
         MemberListBox.Items.Add(fullName);
         FirstNameTextBox.Text  = "";
         SecondNameTextBox.Text = "";
         LastNameTextBox.Text   = "";
         int numberOfMembers = int.Parse(MemberCounterLabel.Text);
         numberOfMembers++;
         MemberCounterLabel.Text = numberOfMembers.ToString();
     }
 }
        private void ConfirmDataButton_Click(object sender, EventArgs e)
        {
            int[] fromToArray = new int[2];
            int   from        = 0;
            int   to          = 0;

            foreach (string item in AvailableDupSetListBox.Items)
            {
                fromToArray = item.Split('-').Select(int.Parse).ToArray();
                from        = fromToArray[0];
                to          = fromToArray[1];
                int numberOfIterations = to - from + 1;
                for (int i = 0; i < numberOfIterations; i++)
                {
                    Database_Elements.DataAccess dataAccess = new Database_Elements.DataAccess();
                    dataAccess.InsertDocument(Helper.MakeTo6((from + i).ToString()), NomenclatureNumberLabel.Text, "2018", "Наличен");
                }
            }
            foreach (string item in DupRegBookListBox.Items)
            {
                fromToArray = item.Split('-').Select(int.Parse).ToArray();
                from        = fromToArray[0];
                to          = fromToArray[1];
                int numberOfIterations = to - from + 1;
                for (int i = 0; i < numberOfIterations; i++)
                {
                    Database_Elements.DataAccess dataAccess = new Database_Elements.DataAccess();
                    dataAccess.InsertDocument(Helper.MakeTo6((from + i).ToString()), NomenclatureNumberLabel.Text, "2018", "Издаден по регистрационна книга");
                }
            }
            foreach (string item in ReadyForDestructionListBox.Items)
            {
                fromToArray = item.Split('-').Select(int.Parse).ToArray();
                from        = fromToArray[0];
                to          = fromToArray[1];
                int numberOfIterations = to - from + 1;
                for (int i = 0; i < numberOfIterations; i++)
                {
                    Database_Elements.DataAccess dataAccess = new Database_Elements.DataAccess();
                    dataAccess.InsertDocument(Helper.MakeTo6((from + i).ToString()), NomenclatureNumberLabel.Text, "2018", "Годен за унищожаване");
                }
            }
            foreach (string item in CanceledDupListBox.Items)
            {
                fromToArray = item.Split('-').Select(int.Parse).ToArray();
                from        = fromToArray[0];
                to          = fromToArray[1];
                int numberOfIterations = to - from + 1;
                for (int i = 0; i < numberOfIterations; i++)
                {
                    Database_Elements.DataAccess dataAccess = new Database_Elements.DataAccess();
                    dataAccess.InsertDocument(Helper.MakeTo6((from + i).ToString()), NomenclatureNumberLabel.Text, "2018", "Анулиран");
                }
            }
        }
Ejemplo n.º 3
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (OrderNumberTB.Text == "")
     {
         warningLabel.Visible = true;
         warningLabel.Text    = "Invalid data";
     }
     else
     {
         Database_Elements.DataAccess dataAccess = new Database_Elements.DataAccess();
         dataAccess.InsertOrder(OrderNumberTB.Text, OrderDataPicker.Value);
         warningLabel.Visible = true;
         warningLabel.Text    = "Data successfuly inserted";
         Globals.OrderNumber  = OrderNumberTB.Text;
         Globals.OrderDate    = OrderDataPicker.Value;
     }
 }
Ejemplo n.º 4
0
 private void UpdateButton_Click(object sender, EventArgs e)
 {
     if (managerFirstNameTB.Text == "" || managerLastNameTB.Text == "" || managerMiddleNameTB.Text == "")
     {
         warningLabel.ForeColor = Color.Red;
         warningLabel.Text      = "Invalid data";
         warningLabel.Visible   = true;
     }
     else
     {
         string fullname = managerFirstNameTB.Text + managerMiddleNameTB.Text + managerLastNameTB.Text;
         Database_Elements.DataAccess dataAccess = new Database_Elements.DataAccess();
         dataAccess.UpdateInfoDepartments(fullname);
         warningLabel.Text      = "Data inserted succeessfuly";
         warningLabel.ForeColor = Color.Green;
         warningLabel.Visible   = true;
     }
 }
Ejemplo n.º 5
0
        public CommissionInfoForm()
        {
            InitializeComponent();
            Database_Elements.DataAccess dataAccess = new Database_Elements.DataAccess();
            bool managerInserted = dataAccess.CheckIfManagerInserted();

            if (managerInserted)
            {
                UpdateButton.Visible  = true;
                UpdateButton.Enabled  = true;
                ConfirmButton.Visible = false;
                ConfirmButton.Enabled = false;
            }
            else
            {
                UpdateButton.Visible  = false;
                ConfirmButton.Visible = true;
                UpdateButton.Enabled  = false;
            }
        }
Ejemplo n.º 6
0
 private void deleteMemberButton_Click(object sender, EventArgs e)
 {
     if (FirstNameTextBox.Text == "" || SecondNameTextBox.Text == "" || LastNameTextBox.Text == "")
     {
         warningLabel.Text      = "Invalid data";
         warningLabel.ForeColor = Color.Red;
         warningLabel.Visible   = true;
     }
     else
     {
         Database_Elements.DataAccess dataAccess = new Database_Elements.DataAccess();
         dataAccess.DeleteInfoMembers(FirstNameTextBox.Text, SecondNameTextBox.Text, LastNameTextBox.Text);
         warningLabel.Text      = "Data deleted succeessfuly";
         warningLabel.ForeColor = Color.Green;
         warningLabel.Visible   = true;
         FirstNameTextBox.Text  = "";
         SecondNameTextBox.Text = "";
         LastNameTextBox.Text   = "";
         //gospodin vasilev ne mi dade inforaciq help
         //durjat me v kilera molq pomosht
         //бтв аз съм сингъл уинкифейс
     }
 }
Ejemplo n.º 7
0
 private void RemoveButton_Click(object sender, EventArgs e)
 {
     if (MemberListBox.SelectedItem == null)
     {
         warningLabel.Text      = "Please select a name";
         warningLabel.ForeColor = Color.Red;
         warningLabel.Visible   = true;
     }
     else
     {
         string   fullName = MemberListBox.SelectedItem.ToString();
         string[] names    = new string[3];
         names = fullName.Split(' ').ToArray();
         Database_Elements.DataAccess dataAccess = new Database_Elements.DataAccess();
         dataAccess.DeleteInfoMembers(names[0], names[1], names[2]);
         warningLabel.Visible = true;
         int numberOfMembers = int.Parse(MemberCounterLabel.Text);
         numberOfMembers--;
         MemberCounterLabel.Text = numberOfMembers.ToString();
         MemberListBox.Items.Remove(MemberListBox.SelectedItem);
         warningLabel.Text      = "Data deleted succeessfuly";
         warningLabel.ForeColor = Color.Green;
     }
 }