Ejemplo n.º 1
0
        private void btn_Delete_Click(object sender, EventArgs e)
        {
            Role        role        = FormToRole();
            EmployeeArr employeeArr = new EmployeeArr();

            employeeArr.Fill();

            if (role.Id == 0)
            {
            }
            else
            {
                if (employeeArr.DoesExist(role))
                {
                    MessageBox.Show("You can not delete this role, it is connected" +
                                    " to 1 or more Employee", "Can not delete role",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    if (MessageBox.Show("Are you sure you want to delete this" +
                                        " Role? ", "Warning", MessageBoxButtons.YesNo,
                                        MessageBoxIcon.Warning) == DialogResult.Yes)
                    {
                        role.Delete();
                        ClearForm();
                        RoleArrToForm(null);
                    }
                }
            }
        }
        public Employee GetEmployee(string Username, string Password)
        {
            EmployeeArr employeeArr = new EmployeeArr();

            employeeArr.Fill();
            employeeArr = employeeArr.FilterUsername(Username, Password);
            return(employeeArr[0] as Employee);
        }
Ejemplo n.º 3
0
        private void EmployeeArrToForm()
        {
            //ממירה את הטנ"מ אוסף לקוחות לטופס
            EmployeeArr employeeArr = new EmployeeArr();

            employeeArr.Fill();

            listbox_Employees.DataSource = employeeArr;
        }
Ejemplo n.º 4
0
        private void EmployeeArrToForm()
        {
            EmployeeArr employeeArr = new EmployeeArr();

            employeeArr.FillNew();


            listBox_Data.DataSource = employeeArr;

            listBox_Data.ValueMember   = "Id";
            listBox_Data.DisplayMember = "FullEmployee";
        }
        private bool CheckEmployee(string Username, string Password)
        {
            EmployeeArr employeeArr = new EmployeeArr();

            employeeArr.Fill();
            employeeArr = employeeArr.FilterUsername(Username, Encrypt(Password));

            if (employeeArr.Count == 1)
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 6
0
        private void EmployeeArrToForm(Employee curemployee)
        {
            EmployeeArr employeeArr = new EmployeeArr();

            employeeArr.Fill();

            cmb_Employee.ValueMember   = "Id";
            cmb_Employee.DisplayMember = "FullRole";

            cmb_Employee.DataSource = employeeArr;

            if (curemployee != null)
            {
                cmb_Employee.SelectedValue = curemployee.Id;
            }
        }
Ejemplo n.º 7
0
        public EmployeeArr GetEmployees_V2()
        {
            int id = 0;

            //אם המשתמש רשם ערך בשדה המזהה
            if (txt_Id.Text != "")
            {
                id = int.Parse(txt_Id.Text);
            }

            //מייצרים אוסף של כלל הלקוחות
            EmployeeArr employeeArr = new EmployeeArr();

            employeeArr.FillNew();

            //מסננים את אוסף הלקוחות לפי שדות הסינון שרשם המשתמש
            employeeArr = employeeArr.Filter(id, txt_Name.Text, txt_PhoneNumber.Text);

            return(employeeArr);
        }
Ejemplo n.º 8
0
        private void textBox_Filter_KeyUp(object sender, KeyEventArgs e)
        {
            int id = 0;

            //אם המשתמש רשם ערך בשדה המזהה
            if (txt_Id.Text != "")
            {
                id = int.Parse(txt_Id.Text);
            }

            //מייצרים אוסף של כלל הלקוחות
            EmployeeArr employeeArr = new EmployeeArr();

            employeeArr.Fill();

            //מסננים את אוסף הלקוחות לפי שדות הסינון שרשם המשתמש
            employeeArr = employeeArr.Filter(id, txt_Name.Text, txt_PhoneNumber.Text);

            //מציבים בתיבת הרשימה את אוסף הלקוחות
        }
Ejemplo n.º 9
0
        private bool IsDataExsits(string Email, string Phone, string Username)
        {
            // מחזיר האם האיימיל כבר קיםם במערכת

            EmployeeArr employeeArr = new EmployeeArr();

            employeeArr.Fill();

            if (employeeArr.IsContainPhone(Phone))
            {
                MessageBox.Show("Phone Number is already in use", "Phone Number is unvalid", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(true);
            }
            else
            {
            }

            if (employeeArr.IsContainEmail(Email))
            {
                MessageBox.Show("Email is already in use", "Email is unvalid", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(true);
            }
            else
            {
            }

            if (employeeArr.IsContainUsername(Username))
            {
                MessageBox.Show("Username is already in use", "Username is unvalid", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(true);
            }
            else
            {
            }

            return(false);
        }
Ejemplo n.º 10
0
        public void EmployeeRentToChart(DateTime dt)
        {
            RadioButton(true);

            chart1.Palette = ChartColorPalette.SeaGreen;
            chart1.ChartAreas[0].AxisX.LabelStyle.Interval = 1;

            chart1.Titles.Clear();
            chart1.Titles.Add("Distribution");

            SortedDictionary <string, int> dictionary = new SortedDictionary <string, int>();
            OrderRentArr detailsRent = new OrderRentArr();

            detailsRent.Fill();

            EmployeeArr employeeArr = detailsRent.GetEmployeeArr();

            foreach (Employee employee in employeeArr)
            {
                Count = detailsRent.Filter(employee, dt).Count;
                if (Count > 0)
                {
                    dictionary.Add(employee.Fullname, Count);
                }
            }

            Series series = new Series("Employee", employeeArr.Count);

            series.ChartType = SeriesChartType.Column;

            series.Label = "[#PERCENT{P0}]";
            series.Points.DataBindXY(dictionary.Keys, dictionary.Values);

            chart1.Series.Clear();
            chart1.Series.Add(series);
        }