示例#1
0
        private void AssignEmployeeJobRegisterButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                CheckForEmpty(this.AssignEmplyeeJobGrid);
                if (this.textboxstatus == false)
                {
                    MessageBox.Show("A field has not been entered");
                    textboxstatus = false;
                    return;
                }

                // look for fields in the tables
                AllContainer = new Container();
                DB1 = new DBManager();
                AllContainer = DB1.GetWholeEntity();

                var result = from item in AllContainer._employeeslist
                             where item.employee_name.ToLower().Contains(this.AssignEmployeejobEmployeeNameTextbox.Text.ToLower())
                             select item;
                // get the id of the first value found
                employees emp = (employees)result.ToList().First();

                var rs = from item in AllContainer._job_typelist
                         where item.job_name.ToLower().Contains(this.AssignEmployeeJobJobNameTextBox.Text.ToLower())
                         select item;
                job_type job = (job_type)rs.ToList().First();

                // get the values from the two entities so as to merge them
                Container Entity1 = new Container();
                Entity1._job_description.employee_id = emp.employee_id;
                Entity1._job_description.job_type_id = job.job_type_id;
                if (DB1.InsertValue(Entity1, Constants.Job_Description))
                {
                    MessageBox.Show("the job description has been registered");
                    EmptyAllfields(this.AssignEmplyeeJobGrid);
                    RefreshContainer();
                }
            }
            catch { }
        }
示例#2
0
        private void RefreshContainer()
        {
            DBManager DB1 = new DBManager();

            this.AllContainer = DB1.GetWholeEntity();
        }
示例#3
0
        private void CreateProject_Click(object sender, RoutedEventArgs e)
        {
            // get all the values from the
            // check if any of the values is left empty
            try
            {

                // check for empty ness
                CheckForEmpty(this.RegisterProjectGrid);
                if (this.textboxstatus == false)
                {
                    MessageBox.Show("A field has not been entered");
                    textboxstatus = false;
                    return;
                }

                try
                {

                    Container Entity1 = new Container();
                    Entity1._project.project_id = 0;
                    Entity1._project.project_name = this.RegisterProjectProjectNameTextBox.Text;
                    Entity1._project.location = this.RegisterProjectLocationTextBox.Text;
                    Entity1._project.description = this.RegisterProjectDescriptionTextBox.Text;
                    Entity1._project.end_date = (DateTime)this.RegisterProjectEndDatePicker.SelectedDate;
                    Entity1._project.start_date = (DateTime)this.RegisterProjectStartDatePicker.SelectedDate;

                    // get the client
                    try
                    {
                        Container container1 = new Container();
                        DB1 = new DBManager();
                        container1 = DB1.GetWholeEntity();
                        List<clients> cc = container1._clientlist;
                        var result = from item in cc
                                     where item.client_name.ToLower().Contains(this.RegisterProjectClientTextBox.Text.ToLower())
                                     select item;

                        if (result != null)
                        {
                            Entity1._project.client_id = Convert.ToInt32(((List<clients>)result.ToList()).First().client_id);
                        }

                    }
                    catch { }

                    if (DB1.InsertValue(Entity1, Constants.Project))
                    {
                        MessageBox.Show("The Project has been registered successfully");
                        EmptyAllfields(this.RegisterProjectGrid);
                    }
                }
                catch { }

            }
            catch { }
        }