Exemplo n.º 1
0
        private void staffToolMenu_Click(object sender, EventArgs e)
        {
            frmStaff staff = new frmStaff();

            if (txtUserType.Text == "Admin")
            {
                ((Form)staff).Controls["txtUserType"].Text = txtUserType.Text;
                ((Form)staff).Controls["txtUser"].Text     = txtUser.Text;

                staff.Controls["txtUser"].BackColor     = Color.LightSkyBlue;
                staff.Controls["txtUserType"].BackColor = Color.LightSkyBlue;
                staff.Controls["pnlStaff"].Visible      = true;
            }
            else if (txtUserType.Text == "Personel")
            {
                ((Form)staff).Controls["txtUserType"].Text = txtUserType.Text;
                ((Form)staff).Controls["txtUser"].Text     = txtUser.Text;

                staff.Controls["txtUser"].BackColor     = Color.LightGreen;
                staff.Controls["txtUserType"].BackColor = Color.LightGreen;
                staff.Controls["dgvListStaff"].Location = new Point(10, 50);
                staff.Controls["dgvListStaff"].Size     = new Size(650, 400);
                staff.Controls["lblUser"].Location      = new Point(670, 43);
                staff.Controls["txtUser"].Location      = new Point(800, 43);
                staff.Controls["lblUserType"].Location  = new Point(670, 89);
                staff.Controls["txtUserType"].Location  = new Point(800, 89);
            }

            this.Hide();
            staff.Show();
        }
Exemplo n.º 2
0
 public void PopulateDataGridViewStaff(frmStaff frmStaff)
 {
     frmStaff.dgvListStaff.AutoGenerateColumns = false;
     using (StockTracingEntities stockTracing = new StockTracingEntities())
     {
         frmStaff.dgvListStaff.DataSource = stockTracing.Staff.ToList <Staff>();
     }
 }
Exemplo n.º 3
0
        public void ClearStaff(frmStaff frmStaff)
        {
            frmStaff.txtStaffName.Clear();
            frmStaff.txtStaffSurname.Clear();
            frmStaff.txtStaffGender.Clear();
            frmStaff.txtStaffTelephone.Clear();
            frmStaff.txtStaffSalary.Clear();

            frmStaff.btnAddStaff.Text       = "Personel Ekle";
            frmStaff.btnDeleteStaff.Enabled = false;
            staff.StaffID = 0;
        }
Exemplo n.º 4
0
        public void addStaff(frmStaff frmStaff)
        {
            staff.StaffName      = frmStaff.txtStaffName.Text.Trim();
            staff.StaffSurname   = frmStaff.txtStaffSurname.Text.Trim();
            staff.StaffGender    = frmStaff.txtStaffGender.Text.Trim();
            staff.StaffTelephone = frmStaff.txtStaffTelephone.Text.Trim();
            staff.StaffSalary    = Convert.ToDecimal(frmStaff.txtStaffSalary.Text.Trim());
            using (StockTracingEntities stockTracing = new StockTracingEntities())
            {
                if (staff.StaffID == 0)
                {
                    stockTracing.Staff.Add(staff);
                }
                else
                {
                    stockTracing.Entry(staff).State = EntityState.Modified;
                }
                stockTracing.SaveChanges();
            }

            ClearStaff(frmStaff);
            PopulateDataGridViewStaff(frmStaff);
            MessageBox.Show("Personel Kaydedildi", "Bilgi");
        }