public MainWindowViewModel(MainWindow mainOpen)
 {
     main            = mainOpen;
     serviceEmployee = new ServiceEmployee();
     EmployeeList    = serviceEmployee.GetAllEmployees();
     serviceEmployee.AddLocations();
 }
 public AddEmployeeViewModel(AddEmployeeView addEmployeeViewOpen)
 {
     addEmployeeView = addEmployeeViewOpen;
     GenderList      = serviceEmployee.GetAllGender();
     LocationList    = serviceEmployee.GetAllLocations();
     ManagerList     = serviceEmployee.GetAllEmployees();
     employee        = new vwEmployee();
 }
        public ManagerWindowViewModel(ManagerWindow managerWindowOpen, vwManager managerLog)
        {
            managerWindow = managerWindowOpen;
            manager       = managerLog;

            serviceEmployee = new ServiceEmployee();
            serviceManager  = new ServiceManager();
            employeeList    = serviceEmployee.GetAllEmployees(manager.Floor).ToList();
        }
        public void DeleteEmployeeExecute()
        {
            MessageBoxResult messageBoxResult = MessageBox.Show("Are you sure that you want to delete the employee?", "Delete Confirmation", MessageBoxButton.YesNo);

            if (messageBoxResult == MessageBoxResult.Yes)
            {
                try
                {
                    if (Employee != null)
                    {
                        serviceEmployee.DeleteEmployee(Employee.EmployeeID);
                        EmployeeList = serviceEmployee.GetAllEmployees();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
 private void salaryDefExecute()
 {
     try
     {
         if (Employee != null)
         {
             Salary salaryDefined = new Salary(Employee, Manager);
             salaryDefined.ShowDialog();
             if ((salaryDefined.DataContext as SalaryViewModel).IsUpdateEmployee == true)
             {
                 EmployeeList = serviceEmployee.GetAllEmployees(manager.Floor).ToList();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
예제 #6
0
        public void PopulateProjectGeneralInfo()
        {
            this.Cursor = Cursors.WaitCursor;
            Application.UseWaitCursor = true;
            ServiceProject _service = new ServiceProject();

            try
            {
                SelectListItem           selItem = null;
                List <SelectListItem>    lst     = _service.GetAllProjectStatuses();
                TBL_MP_PMC_ProjectMaster model   = (new ServiceProject()).GetProjectDBInfoByID(this.SelectedProjectID);

                if (model != null)
                {
                    headerGroupMain.ValuesPrimary.Heading = model.ProjectNumber;
                    selItem        = lst.Where(x => x.ID == model.FK_ProjectStatusID).FirstOrDefault();
                    txtStatus.Text = selItem.Description;

                    txtProjectNo.Text        = model.ProjectNumber;
                    txtProjectName.Text      = model.ProjectName;
                    dtProjectDate.Value      = (DateTime)model.ProjectDate;
                    dtProjectStartDate.Value = (DateTime)model.StartDate;
                    dtProjectEndDate.Value   = (DateTime)model.EndDate;

                    // txtBillingAddress.Text = Project_generalInfo.BillingClientAddressID.ToString();
                    // txtClientAddress.Text = Project_generalInfo.SiteClientAddressID.ToString();
                    ServiceProject serviceProject = new ServiceProject();
                    txtBillingAddress.Text   = serviceProject.GetProjectBillingAddress((int)model.PK_ProjectID);
                    txtClientAddress.Text    = serviceProject.GetProjectSiteAddress((int)model.PK_ProjectID);
                    lblCreatedDateTime.Text  = model.CreatedDatetime.ToString();
                    lblModifiedDateTime.Text = model.ModifiedDatetime.ToString();
                    ServiceEmployee       emp  = new ServiceEmployee();
                    List <SelectListItem> lst1 = emp.GetAllEmployees();
                    selItem           = lst1.Where(x => x.ID == model.CreatedBy).FirstOrDefault();
                    lblCreatedBy.Text = selItem.Description;
                    List <SelectListItem> lst2 = emp.GetAllEmployees();
                    selItem            = lst2.Where(x => x.ID == model.ModifiedBy).FirstOrDefault();
                    lblModifiedBy.Text = selItem.Description;

                    TBL_MP_Admin_Company_Master myComp = (new ServiceMASTERS()).MyCompanyInfo();
                    if (myComp != null)
                    {
                        txtCompanyAddress.Text = myComp.Address;
                    }
                }
                else
                {
                    txtProjectNo.Text          = txtProjectName.Text = txtStatus.Text =
                        txtBillingAddress.Text = txtClientAddress.Text = txtCompanyAddress.Text = string.Empty;
                    dtProjectDate.Checked      = dtProjectStartDate.Checked = dtProjectEndDate.Checked = false;
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "ControlProjectGeneralInfo::PopulateProjectGeneralInfo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            this.Cursor = Cursors.Default;
            Application.UseWaitCursor = false;
        }