Beispiel #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult option;
                option = MessageBox.Show("Do you really want to delete?", "SysBusiness", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (option == DialogResult.OK)
                {
                    string Code;
                    string resp = "";

                    foreach (DataGridViewRow row in dataList.Rows)
                    {
                        if (Convert.ToBoolean(row.Cells[0].Value))
                        {
                            Code = Convert.ToString(row.Cells[1].Value);
                            resp = BStaff.Delete(Convert.ToInt32(Code));

                            if (resp.Equals("OK"))
                            {
                                this.MessageOk("Success deleted");
                            }
                            else
                            {
                                this.MessageError(resp);
                            }
                        }
                    }
                    this.ShowValues();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Beispiel #2
0
 private void ShowValues()
 {
     this.dataList.DataSource = BStaff.ShowValues();
     this.HideCollumns();
     lblTotal.Text = Convert.ToString(dataList.Rows.Count) + " registers found";
 }
Beispiel #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string resp = "";
                if (txtName.Text == string.Empty)
                {
                    MessageError("Fill the fields");
                    errorIcon.SetError(txtName, "Insert the staff's name");
                }
                else
                {
                    if (this.eNew)
                    {
                        resp = BStaff.Insert(
                            this.txtName.Text.Trim().ToUpper(),
                            this.txtSurname.Text,
                            this.cbGender.Text,
                            this.dtDate.Value,
                            this.txtDocNumber.Text,
                            this.txtAddress.Text,
                            this.txtPhone.Text,
                            this.txtEmail.Text,
                            this.cbAccess.Text,
                            this.txtUsername.Text,
                            this.txtPassword.Text
                            );
                    }
                    else
                    {
                        resp = BStaff.Edit(Convert.ToInt32(this.txtId.Text),
                                           this.txtName.Text.Trim().ToUpper(), this.txtSurname.Text, this.cbGender.Text, this.dtDate.Value,
                                           this.txtDocNumber.Text, this.txtAddress.Text, this.txtPhone.Text, this.txtEmail.Text, this.cbAccess.Text,
                                           this.txtUsername.Text, this.txtPassword.Text);
                    }

                    if (resp.Equals("OK"))
                    {
                        if (this.eNew)
                        {
                            this.MessageOk("Register saved");
                        }
                        else
                        {
                            this.MessageOk("Register Edited");
                        }
                    }
                    else
                    {
                        this.MessageError(resp);
                    }

                    this.eNew  = false;
                    this.eEdit = false;
                    this.Enabledbuttons();
                    this.Clean();
                    this.ShowValues();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Beispiel #4
0
 private void SearchDocument()
 {
     this.dataList.DataSource = BStaff.SearchDocument(this.txtSearch.Text);
     this.HideCollumns();
     lblTotal.Text = Convert.ToString(dataList.Rows.Count) + " registers found";
 }