Example #1
0
        // // // // // //


        //Uplaoding the File into Database
        // // // // // //
        private void uploadButton_Click(object sender, EventArgs e)
        {
            try
            {
                using (var context = new DemoBoxDBContext())
                {
                    FileStream   fs       = new FileStream(fi.FullName, FileMode.Open, FileAccess.Read);
                    BinaryReader rdr      = new BinaryReader(fs);
                    byte[]       fileData = rdr.ReadBytes((int)fs.Length);
                    rdr.Close();
                    fs.Close();

                    file = new DemoBoxThrid.File();

                    file.FileName      = fi.FullName;
                    file.Data          = fileData;
                    file.FileExtension = fi.Extension;
                    file.ProjectId     = proId;
                    file.EmployeeId    = id;

                    context.Files.Add(file);
                    context.SaveChanges();
                }
            }
            catch
            {
            }
        }
Example #2
0
        // // // // // //


        //Project Manager Form Loading
        // // // // // //
        private void ProjectManagerUI_Load(object sender, EventArgs e)
        {
            //Employee Information Panels Visibility Off
            currentEIPanel.Visible   = false;
            onLeaveEIPanel.Visible   = false;
            availableEIPanel.Visible = false;

            //Completed/Pending Project Panels Visibility Off
            pendingProjectPanel.Visible   = false;
            completedProjectPanel.Visible = false;

            //Loading Project Manager's Name in ProjectManagerLaber from Database
            try
            {
                using (var context = new DemoBoxDBContext())
                {
                    var query = from x in context.Employees
                                where x.EmployeeEmail == email
                                select x.EmployeeName;

                    foreach (var em in query)
                    {
                        projectManagerNameLabel.Text = "" + em;
                    }
                }
            }
            catch
            {
            }
        }
Example #3
0
        //By Clicking Done Project Manager has added an Project into Project Database
        private void doneLink_Click(object sender, EventArgs e)
        {
            try
            {
                var newProject = new Project();

                newProject.ProjectName       = projectNameTextBox.Text;
                newProject.ClientName        = projectClientTextBox.Text;
                newProject.ClientEmail       = clientEmailTextBox.Text;
                newProject.ClientContact     = clientContactNoTextBox.Text;
                newProject.ProjectTimeline   = projectTimelineTextBox.Text;
                newProject.ProjectCost       = projectCostTextBox.Text;
                newProject.EstimatedTimeline = estimatedTimeTextBox.Text;
                newProject.EstimatedCost     = estimatedCostTextBox.Text;
                newProject.DeliveryDate      = deliveryDatePicker.Text;
                newProject.Specification     = specificationTextBox.Text;
                newProject.ProjectStatus     = "Active";


                using (var context = new DemoBoxDBContext())
                {
                    context.Projects.Add(newProject);
                    context.SaveChanges();
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("" + ex);
            }
        }
Example #4
0
        private void doneLink_Click(object sender, EventArgs e)
        {
            if (maleCheckBox.Checked == true && femaleCheckBox.Checked == false)
            {
                gender = "Male";
            }
            else if (femaleCheckBox.Checked == true && maleCheckBox.Checked == false)
            {
                gender = "FeMale";
            }
            try
            {
                var newEmployee = new Employee();

                newEmployee.EmployeeName     = uNameTextBox.Text;
                newEmployee.EmployeeEmail    = uEmailTextBox.Text;
                newEmployee.EmployeePassword = uPasswordTextBox.Text;
                newEmployee.EmployeeGender   = gender;
                newEmployee.EmplyoeePhone    = uPhoneNoTextBox.Text;
                newEmployee.EmployeeBlood    = bloodGroupComboBox.Text;
                newEmployee.EmployeeBirth    = dateOfBirthTextBox.Text;

                using (var context = new DemoBoxDBContext())
                {
                    context.Employees.Add(newEmployee);
                    context.SaveChanges();
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("" + ex);
            }

            try
            {
                this.Hide();
                m.ShowDialog();
                this.Close();
            }
            catch { }
        }
Example #5
0
        // // // // // //


        //Loading Assign Project to search and assign Employee.
        // // // // // //
        private void AssignProject_Load(object sender, EventArgs e)
        {
            string name, time, id;

            //Visibility Switching at the start of the project.Only search Project Panel is shown.
            searchProjectPanel.Visible     = true;
            availableEmployeePanel.Visible = false;
            // // //

            //Showing Search History on Project Search TextBox.
            projectNameTextBox.AutoCompleteMode         = AutoCompleteMode.SuggestAppend;
            projectNameTextBox.AutoCompleteSource       = AutoCompleteSource.CustomSource;
            projectNameTextBox.AutoCompleteCustomSource = autoComplete;
            // // //

            try
            {
                using (var context = new DemoBoxDBContext())
                {
                    IEnumerable <Project> query = from x in context.Projects
                                                  select x;
                    foreach (var pr in query)
                    {
                        id   = pr.ProjectId.ToString();
                        name = pr.ProjectName;
                        time = pr.ProjectTimeline;

                        ListViewItem lvi1 = new ListViewItem();
                        lvi1.Text = id;
                        lvi1.SubItems.Add(name);
                        lvi1.SubItems.Add("NILL");
                        lvi1.SubItems.Add("NILL");
                        lvi1.SubItems.Add(time);

                        projectListView.Items.Add(lvi1);
                    }
                }
            }
            catch
            {
            }
        }
Example #6
0
        // // // // // //


        //Current Employee Checking Button & Setting Visibilitiy
        // // // // // //
        private void currentEIButton_Click(object sender, EventArgs e)
        {
            //View On or Off
            if (i == 0)
            {
                currentEIPanel.Visible   = true;
                onLeaveEIPanel.Visible   = false;
                availableEIPanel.Visible = false;
                i = 1;
                //Showing list on data throug Crruent List view
                try
                {
                    string name, role;
                    using (var context = new DemoBoxDBContext())
                    {
                        IEnumerable <Employee> Emp = from x in context.Employees
                                                     select x;

                        foreach (var em in Emp)
                        {
                            if (em.EmployeeStatus != "On Leave" || em.EmployeeStatus != "Left")
                            {
                                if (em.EmployeeRole == 2)
                                {
                                    name = em.EmployeeName;
                                    role = "Team Leader";

                                    ListViewItem lvi1 = new ListViewItem();
                                    lvi1.Text = name;
                                    lvi1.SubItems.Add(role);

                                    currentEIListView.Items.Add(lvi1);
                                }
                                else if (em.EmployeeRole == 3)
                                {
                                    name = em.EmployeeName;
                                    role = "Analyst";
                                    ListViewItem lvi1 = new ListViewItem();
                                    lvi1.Text = name;
                                    lvi1.SubItems.Add(role);

                                    currentEIListView.Items.Add(lvi1);
                                }
                                else if (em.EmployeeRole == 4)
                                {
                                    name = em.EmployeeName;
                                    role = "Designer";
                                    ListViewItem lvi1 = new ListViewItem();
                                    lvi1.Text = name;
                                    lvi1.SubItems.Add(role);

                                    currentEIListView.Items.Add(lvi1);
                                }
                                else if (em.EmployeeRole == 5)
                                {
                                    name = em.EmployeeName;
                                    role = "Programmer";
                                    ListViewItem lvi1 = new ListViewItem();
                                    lvi1.Text = name;
                                    lvi1.SubItems.Add(role);

                                    currentEIListView.Items.Add(lvi1);
                                }
                                else if (em.EmployeeRole == 6)
                                {
                                    name = em.EmployeeName;
                                    role = "Tester";
                                    ListViewItem lvi1 = new ListViewItem();
                                    lvi1.Text = name;
                                    lvi1.SubItems.Add(role);

                                    currentEIListView.Items.Add(lvi1);
                                }
                            }
                        }
                    }
                }
                catch
                {
                }
            }
            else
            {
                currentEIPanel.Visible   = false;
                onLeaveEIPanel.Visible   = false;
                availableEIPanel.Visible = false;
                i = 0;
                currentEIListView.Items.Clear();
            }

            /*EmployeeData ed = new EmployeeData();
             * List<Employee> Employees =  ed.GetEmployee();
             *
             * foreach ()
             * {
             *
             * }
             */
        }
Example #7
0
        // // // // // //


        //Available Employee Checking Button & Setting Visibility
        // // // // // //
        private void availableEIButton_Click(object sender, EventArgs e)
        {
            if (i == 0)

            {
                currentEIPanel.Visible   = false;
                onLeaveEIPanel.Visible   = false;
                availableEIPanel.Visible = true;
                i = 1;

                try
                {
                    string name, role;
                    using (var context = new DemoBoxDBContext())
                    {
                        IEnumerable <Employee> Emp = from x in context.Employees
                                                     select x;

                        foreach (var em in Emp)
                        {
                            if (em.EmployeeStatus != "On Leave" && em.EmployeeStatus != "Working" && em.EmployeeStatus != "Left")
                            {
                                if (em.EmployeeRole == 2)
                                {
                                    name = em.EmployeeName;
                                    role = "Team Leader";

                                    ListViewItem lvi1 = new ListViewItem();
                                    lvi1.Text = name;
                                    lvi1.SubItems.Add(role);

                                    avaiableEIListView.Items.Add(lvi1);
                                }
                                else if (em.EmployeeRole == 3)
                                {
                                    name = em.EmployeeName;
                                    role = "Analyst";
                                    ListViewItem lvi1 = new ListViewItem();
                                    lvi1.Text = name;
                                    lvi1.SubItems.Add(role);

                                    avaiableEIListView.Items.Add(lvi1);
                                }
                                else if (em.EmployeeRole == 4)
                                {
                                    name = em.EmployeeName;
                                    role = "Designer";
                                    ListViewItem lvi1 = new ListViewItem();
                                    lvi1.Text = name;
                                    lvi1.SubItems.Add(role);

                                    avaiableEIListView.Items.Add(lvi1);
                                }
                                else if (em.EmployeeRole == 5)
                                {
                                    name = em.EmployeeName;
                                    role = "Programmer";
                                    ListViewItem lvi1 = new ListViewItem();
                                    lvi1.Text = name;
                                    lvi1.SubItems.Add(role);

                                    avaiableEIListView.Items.Add(lvi1);
                                }
                                else if (em.EmployeeRole == 6)
                                {
                                    name = em.EmployeeName;
                                    role = "Tester";
                                    ListViewItem lvi1 = new ListViewItem();
                                    lvi1.Text = name;
                                    lvi1.SubItems.Add(role);

                                    avaiableEIListView.Items.Add(lvi1);
                                }
                            }
                        }
                    }
                }
                catch
                {
                }
            }
            else
            {
                currentEIPanel.Visible   = false;
                onLeaveEIPanel.Visible   = false;
                availableEIPanel.Visible = false;
                avaiableEIListView.Items.Clear();
                i = 0;
            }
        }
Example #8
0
        private void ProjectHub_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                using (var context = new DemoBoxDBContext())
                {
                    var query = from x in context.Employees
                                where x.EmployeeEmail == email
                                select x.EmployeeRole;


                    foreach (var s in query)
                    {
                        if (s == 1)
                        {
                            this.Hide();
                            ProjectManagerUI pm = new ProjectManagerUI(email);
                            pm.ShowDialog();
                            this.Close();
                        }
                        else if (s == 2)
                        {
                            this.Hide();
                            EmployeeManagement em = new EmployeeManagement(email, s);
                            em.ShowDialog();
                            this.Close();
                        }
                        else if (s == 3)
                        {
                            this.Hide();
                            EmployeeManagement em = new EmployeeManagement(email, s);
                            em.ShowDialog();
                            this.Close();
                        }
                        else if (s == 4)
                        {
                            this.Hide();
                            EmployeeManagement em = new EmployeeManagement(email, s);
                            em.ShowDialog();
                            this.Close();
                        }
                        else if (s == 5)
                        {
                            this.Hide();
                            EmployeeManagement em = new EmployeeManagement(email, s);
                            em.ShowDialog();
                            this.Close();
                        }
                        else if (s == 6)
                        {
                            this.Hide();
                            EmployeeManagement em = new EmployeeManagement(email, s);
                            em.ShowDialog();
                            this.Close();
                        }
                    }
                }
            }
            catch
            {
            }
        }
Example #9
0
        private void projectNameTextBox_KeyDown(object sender, KeyEventArgs e)
        {
            int n = 0;

            if (e.KeyCode == Keys.Enter)
            {
                this.proName = projectNameTextBox.Text;
                autoComplete.Add(projectNameTextBox.Text);

                if (n == 0)
                {
                    try
                    {
                        using (var context = new DemoBoxDBContext())
                        {
                            var query = from x in context.Projects
                                        where x.ProjectName == proName
                                        select x;
                            foreach (var em in query)
                            {
                                this.proId = em.ProjectId;
                            }
                        }

                        using (var context = new DemoBoxDBContext())
                        {
                            IEnumerable <File> query = from x in context.Files
                                                       join c in context.Projects on x.ProjectId equals c.ProjectId
                                                       //select new { FileName = x.FileName, x.EmployeeId };
                                                       select x;
                            foreach (var em in query)
                            {
                                this.name = em.FileName;
                                this.id   = em.EmployeeId;
                                using (var newContext = new DemoBoxDBContext())
                                {
                                    var newQuery = from y in newContext.Employees
                                                   where y.EmployeeId == id
                                                   select y;
                                    foreach (var es in newQuery)
                                    {
                                        this.empName = es.EmployeeName;
                                        this.role    = es.EmployeeRole;
                                    }
                                }

                                ListViewItem lvi1 = new ListViewItem();
                                lvi1.Text = name;
                                lvi1.SubItems.Add(empName);
                                lvi1.SubItems.Add("" + role);
                                projectDetailsListView.Items.Add(lvi1);
                            }
                        }

                        using (var context = new DemoBoxDBContext())
                        {
                            var query = from x in context.Projects
                                        where x.ProjectId == proId
                                        select x;
                            foreach (var em in query)
                            {
                                showStatusLabel.Text       = em.ProjectStatus;
                                deliveryDateShowLabel.Text = em.DeliveryDate;
                                clientShowLabel.Text       = em.ClientName;
                                DateTime dt1  = Convert.ToDateTime(em.DeliveryDate);
                                DateTime dt2  = DateTime.Today;
                                TimeSpan time = dt1.Subtract(dt2);
                                int      t    = (int)time.TotalDays;
                                timeRemainingShowLabel.Text = "" + t + " Days";
                            }
                        }
                    }
                    catch
                    {
                        MessageBox.Show("Nothing Found");
                    }
                    n = 1;
                }
                else if (n == 1)
                {
                    projectDetailsListView.Items.Clear();
                    n = 0;
                }
            }
        }
Example #10
0
        // // // // // //

        //Loading Information FORM
        // // // // // //
        private void Info_Load(object sender, EventArgs e)
        {
            updateInfoTile.Visible      = false;
            deleteInfoTile.Visible      = false;
            projectPanel.Visible        = false;
            projectPendingPanel.Visible = false;

            try
            {
                using (var context = new DemoBoxDBContext())
                {
                    //Setting Id From Database
                    var query = from x in context.Employees
                                where x.EmployeeEmail == email
                                select x.EmployeeId;
                    foreach (var em in query)
                    {
                        this.id          = em;
                        idTextLabel.Text = "" + em;
                    }
                    // // //

                    //Setting Name From Database
                    var query1 = from x in context.Employees
                                 where x.EmployeeEmail == email
                                 select x.EmployeeName;
                    foreach (var em in query1)
                    {
                        nameTextLabel.Text = em;
                    }
                    // // //

                    //Setting Password From Database
                    var query2 = from x in context.Employees
                                 where x.EmployeeEmail == email
                                 select x.EmployeePassword;
                    foreach (var em in query2)
                    {
                        passwordTextLabel.Text = em;
                    }
                    // // //

                    //Setting Email From Database
                    var query3 = from x in context.Employees
                                 where x.EmployeeEmail == email
                                 select x.EmployeeEmail;
                    foreach (var em in query3)
                    {
                        emailTextLabel.Text = em;
                    }
                    // // //

                    //Setting Phone From Database
                    var query4 = from x in context.Employees
                                 where x.EmployeeEmail == email
                                 select x.EmplyoeePhone;
                    foreach (var em in query4)
                    {
                        phoneNoTextLabel.Text = em;
                    }
                    // // //

                    //Setting Id From Database
                    var query5 = from x in context.Employees
                                 where x.EmployeeEmail == email
                                 select x.EmployeeBirth;
                    foreach (var em in query5)
                    {
                        dateOfBirthTextLabel.Text = em;
                    }
                    // // //

                    //Setting Id From Database
                    var query6 = from x in context.Employees
                                 where x.EmployeeEmail == email
                                 select x.EmployeeGender;
                    foreach (var em in query6)
                    {
                        genderTextLabel.Text = em;
                    }
                    // // //

                    //Setting Project Number till now
                    int a = 0;
                    IEnumerable <ProjectEmployee> query7 = from x in context.ProjectEmployees
                                                           where x.EmployeeId == id
                                                           select x;
                    foreach (var em in query7)
                    {
                        a++;
                    }
                    projectCompletedTextLabel.Text = "" + a;
                    // // //

                    //Loading Pending Projects
                }
            }

            catch
            {
            }
        }
Example #11
0
        //New Employee Pending Requests by pressing Button and values in PendingNewListView
        // // // // // //
        private void newEmployeeButton_Click(object sender, EventArgs e)
        {
            if (i == 0)
            {
                if (pendingOldPanel.Visible == true)
                {
                    pendingOldPanel.Visible = false;
                }
                pendingNewPanel.Visible = true;
                i = 1;

                try
                {
                    string id, name, role;
                    using (var context = new DemoBoxDBContext())
                    {
                        IEnumerable <Employee> Emp = from x in context.Employees
                                                     select x;

                        foreach (var em in Emp)
                        {
                            if (em.EmployeeRole == 0)
                            {
                                id   = em.EmployeeId.ToString();
                                name = em.EmployeeName;
                                role = "NILL";

                                ListViewItem lvi1 = new ListViewItem();

                                lvi1.Text = id;
                                lvi1.SubItems.Add(name);
                                lvi1.SubItems.Add(role);

                                pendingNewListView.Items.Add(lvi1);
                            }

                            /*else if (em.EmployeeRole == 2)
                             * {
                             *  id = em.EmployeeId.ToString();
                             *  name = em.EmployeeName;
                             *  role = "NILL";
                             *
                             *  ListViewItem lvi1 = new ListViewItem();
                             *
                             *  lvi1.Text = id;
                             *  lvi1.SubItems.Add(name);
                             *  lvi1.SubItems.Add(role);
                             *
                             *  pendingNewListView.Items.Add(lvi1);
                             * }
                             * else if (em.EmployeeRole == 4)
                             * {
                             *  id = em.EmployeeId.ToString();
                             *  name = em.EmployeeName;
                             *  role = "NILL";
                             *
                             *  ListViewItem lvi1 = new ListViewItem();
                             *
                             *  lvi1.Text = id;
                             *  lvi1.SubItems.Add(name);
                             *  lvi1.SubItems.Add(role);
                             *
                             *  pendingNewListView.Items.Add(lvi1);
                             * }
                             * else if (em.EmployeeRole == 5)
                             * {
                             *  id = em.EmployeeId.ToString();
                             *  name = em.EmployeeName;
                             *  role = "NILL";
                             *
                             *  ListViewItem lvi1 = new ListViewItem();
                             *
                             *  lvi1.Text = id;
                             *  lvi1.SubItems.Add(name);
                             *  lvi1.SubItems.Add(role);
                             *
                             *  pendingNewListView.Items.Add(lvi1);
                             * }
                             * else if (em.EmployeeRole == 6)
                             * {
                             *  id = em.EmployeeId.ToString();
                             *  name = em.EmployeeName;
                             *  role = "NILL";
                             *
                             *  ListViewItem lvi1 = new ListViewItem();
                             *
                             *  lvi1.Text = id;
                             *  lvi1.SubItems.Add(name);
                             *  lvi1.SubItems.Add(role);
                             *
                             *  pendingNewListView.Items.Add(lvi1);
                             * }*/
                        }
                    }
                }
                catch
                {
                }
            }
            else if (i == 1)
            {
                pendingNewListView.Items.Clear();
                pendingNewPanel.Visible = false;
                pendingOldPanel.Visible = false;
                i = 0;
            }
        }
Example #12
0
        // // // // // //


        //Assinging Role and Status to Employee by clicking AssignButton
        // // // // // //
        private void assignButton_Click(object sender, EventArgs e)
        {
            if (id != 0 && roles != null)
            {
                using (var context = new DemoBoxDBContext())
                {
                    var query = from x in context.Employees
                                where x.EmployeeId == id
                                select x;

                    foreach (var em in query)
                    {
                        if (roles == "Team Leader")
                        {
                            em.EmployeeRole = 2;
                        }
                        else if (roles == "Analyst")
                        {
                            em.EmployeeRole = 3;
                        }
                        else if (roles == "Designer")
                        {
                            em.EmployeeRole = 4;
                        }
                        else if (roles == "Programmer")
                        {
                            em.EmployeeRole = 5;
                        }
                        else if (roles == "Tester")
                        {
                            em.EmployeeRole = 6;
                        }
                    }

                    try
                    {
                        context.SaveChanges();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("" + ex);
                    }
                }
            }

            else if (id != 0 && status != null)
            {
                using (var context = new DemoBoxDBContext())
                {
                    var query = from x in context.Employees
                                where x.EmployeeId == id
                                select x;

                    foreach (var em in query)
                    {
                        em.EmployeeStatus = status;
                    }

                    try
                    {
                        context.SaveChanges();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("" + ex);
                    }
                }
            }
        }
Example #13
0
        // // // // // // //


        //Login Completed
        // // // // // // //
        private void loginDoneButton_Click(object sender, EventArgs e)
        {
            if (loginEmailTextBox.Text == null || loginPasswordTextBox.Text == null)
            {
                MessageBox.Show("Enter your Email and Password!!");
            }

            try
            {
                string email = loginEmailTextBox.Text;
                string pass  = loginPasswordTextBox.Text;
                using (var context = new DemoBoxDBContext())
                {
                    var query = from x in context.Employees
                                where x.EmployeeEmail == email && x.EmployeePassword == pass
                                select x.EmployeeRole;


                    foreach (var s in query)
                    {
                        if (s == 1)
                        {
                            this.Hide();
                            ProjectManagerUI pm = new ProjectManagerUI(email);
                            pm.ShowDialog();
                            this.Close();
                        }
                        else if (s == 2)
                        {
                            this.Hide();
                            EmployeeManagement em = new EmployeeManagement(email, s);
                            em.ShowDialog();
                            this.Close();
                        }
                        else if (s == 3)
                        {
                            this.Hide();
                            EmployeeManagement em = new EmployeeManagement(email, s);
                            em.ShowDialog();
                            this.Close();
                        }
                        else if (s == 4)
                        {
                            this.Hide();
                            EmployeeManagement em = new EmployeeManagement(email, s);
                            em.ShowDialog();
                            this.Close();
                        }
                        else if (s == 5)
                        {
                            this.Hide();
                            EmployeeManagement em = new EmployeeManagement(email, s);
                            em.ShowDialog();
                            this.Close();
                        }
                        else if (s == 6)
                        {
                            this.Hide();
                            EmployeeManagement em = new EmployeeManagement(email, s);
                            em.ShowDialog();
                            this.Close();
                        }

                        else if (s == 0)
                        {
                            MetroFramework.MetroMessageBox.Show(this, "Your Account Hasn't Confirmed Yet");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("" + ex);
            }
        }
Example #14
0
        // // // // // //



        //Assigning Project to an Employee
        // // // // // //
        private void assignButton_Click(object sender, EventArgs e)
        {
            if (empId != 0 && proId != 0 && poss != null)
            {
                try
                {
                    var projectEmployee = new ProjectEmployee();

                    projectEmployee.EmployeeId = empId;
                    projectEmployee.ProjectId  = proId;

                    using (var context = new DemoBoxDBContext())
                    {
                        context.ProjectEmployees.Add(projectEmployee);
                        context.SaveChanges();
                    }

                    using (var context = new DemoBoxDBContext())
                    {
                        var query = from x in context.Employees
                                    where x.EmployeeId == empId
                                    select x;
                        foreach (var em in query)
                        {
                            if (poss == "Team Leader")
                            {
                                em.EmployeeProjectRole = 2;
                                em.EmployeeStatus      = "Working";
                            }
                            else if (poss == "Analyst")
                            {
                                em.EmployeeProjectRole = 3;
                                em.EmployeeStatus      = "Working";
                            }
                            else if (poss == "Designer")
                            {
                                em.EmployeeProjectRole = 4;
                                em.EmployeeStatus      = "Working";
                            }
                            else if (poss == "Programmer")
                            {
                                em.EmployeeProjectRole = 5;
                                em.EmployeeStatus      = "Working";
                            }
                            else if (poss == "Tester")
                            {
                                em.EmployeeProjectRole = 6;
                                em.EmployeeStatus      = "Working";
                            }
                        }

                        try
                        {
                            context.SaveChanges();
                        }
                        catch
                        {
                        }
                    }
                }
                catch
                {
                }
            }
        }
Example #15
0
        // // // // // //


        //Showing Available Employee Panel on One click
        private void projectListView_MouseClick(object sender, MouseEventArgs e)
        {
            availableEmployeePanel.Visible = true;
            try
            {
                string name, role, id;
                using (var context = new DemoBoxDBContext())
                {
                    IEnumerable <Employee> Emp = from x in context.Employees
                                                 select x;

                    foreach (var em in Emp)
                    {
                        if (em.EmployeeStatus != "On Leave" && em.EmployeeStatus != "Working" && em.EmployeeStatus != "Left")
                        {
                            if (em.EmployeeRole == 2)
                            {
                                id   = em.EmployeeId.ToString();
                                name = em.EmployeeName;
                                role = "Team Leader";

                                ListViewItem lvi1 = new ListViewItem();
                                lvi1.Text = id;
                                lvi1.SubItems.Add(name);
                                lvi1.SubItems.Add(role);

                                availableEmployeeListView.Items.Add(lvi1);
                            }
                            else if (em.EmployeeRole == 3)
                            {
                                id   = em.EmployeeId.ToString();
                                name = em.EmployeeName;
                                role = "Analyst";
                                ListViewItem lvi1 = new ListViewItem();
                                lvi1.Text = id;
                                lvi1.SubItems.Add(name);
                                lvi1.SubItems.Add(role);

                                availableEmployeeListView.Items.Add(lvi1);
                            }
                            else if (em.EmployeeRole == 4)
                            {
                                id   = em.EmployeeId.ToString();
                                name = em.EmployeeName;
                                role = "Designer";
                                ListViewItem lvi1 = new ListViewItem();
                                lvi1.Text = id;
                                lvi1.SubItems.Add(name);
                                lvi1.SubItems.Add(role);

                                availableEmployeeListView.Items.Add(lvi1);
                            }
                            else if (em.EmployeeRole == 5)
                            {
                                id   = em.EmployeeId.ToString();
                                name = em.EmployeeName;
                                role = "Programmer";
                                ListViewItem lvi1 = new ListViewItem();
                                lvi1.Text = id;
                                lvi1.SubItems.Add(name);
                                lvi1.SubItems.Add(role);

                                availableEmployeeListView.Items.Add(lvi1);
                            }
                            else if (em.EmployeeRole == 6)
                            {
                                id   = em.EmployeeId.ToString();
                                name = em.EmployeeName;
                                role = "Tester";
                                ListViewItem lvi1 = new ListViewItem();
                                lvi1.Text = id;
                                lvi1.SubItems.Add(name);
                                lvi1.SubItems.Add(role);

                                availableEmployeeListView.Items.Add(lvi1);
                            }
                        }
                    }
                }
            }
            catch
            {
            }
        }
Example #16
0
        // // // // // //


        //Setting EmployeeId,EmployeeName,EmployeeRole, at the top of Form in empNameLabel
        // // // // // //
        private void EmployeeManagement_Load(object sender, EventArgs e)
        {
            try
            {
                using (var context = new DemoBoxDBContext())
                {
                    //Setting Employee Name According to Login
                    var query = from x in context.Employees
                                where x.EmployeeEmail == email
                                select x.EmployeeName;
                    foreach (var em in query)
                    {
                        empNameLabel.Text = em;
                    }

                    //Seting Employee ID According to Login
                    var query1 = from x in context.Employees
                                 where x.EmployeeEmail == email
                                 select x.EmployeeId;

                    foreach (var em in query1)
                    {
                        this.id = em;
                        employeeIdLabel.Text = "" + em;
                    }

                    //

                    //Seting Employee Status Accoding to Login
                    var query2 = from x in context.Employees
                                 where x.EmployeeEmail == email
                                 select x.EmployeeStatus;

                    foreach (var em in query2)
                    {
                        if (em != null)
                        {
                            empStatusTextLabel.Text = "" + em;
                        }
                        else
                        {
                            empStatusTextLabel.Text = "Nill";
                        }
                    }

                    //Setting Employee Status According to Login
                    var query3 = from x in context.Employees
                                 where x.EmployeeRole == role
                                 select x.EmployeeRole;
                    foreach (var em in query3)
                    {
                        if (em == 2)
                        {
                            joinedAsTextLabel.Text = "Team Leader";
                        }
                        else if (em == 3)
                        {
                            joinedAsTextLabel.Text = "Analyst";
                        }
                        else if (em == 4)
                        {
                            joinedAsTextLabel.Text = "Designer";
                        }

                        else if (em == 5)
                        {
                            joinedAsTextLabel.Text = "Programmer";
                        }

                        else if (em == 6)
                        {
                            joinedAsTextLabel.Text = "Tester";
                        }
                    }

                    //Setting ProjectId
                    var query4 = from x in context.ProjectEmployees
                                 where x.EmployeeId == id
                                 select x.ProjectId;

                    foreach (var em in query4)
                    {
                        this.proId = em;
                    }

                    //Loading Project on List View
                    string name, file;
                    var    query5 = from p in context.Projects
                                    join c in context.Files on p.ProjectId equals c.ProjectId
                                    select new { projectName = p.ProjectName, c.FileName };

                    foreach (var em in query5)
                    {
                        name = em.projectName;
                        file = em.FileName;

                        ListViewItem lvi1 = new ListViewItem();
                        lvi1.Text = name;
                        lvi1.SubItems.Add(file);

                        projectOnWorkListView.Items.Add(lvi1);
                    }
                }
            }
            catch
            {
            }
        }