Ejemplo n.º 1
0
        public void GetEmployeesList()
        {
            ArrangementShiftEntities entity = (ArrangementShiftEntities)CurrentModuleEntity;
            HREmployeesController    objEmployeesController = new HREmployeesController();

            entity.EmployeesList = objEmployeesController.GetAllEmployees();
        }
Ejemplo n.º 2
0
        public void AddDefaulArrangementShiftEntries(HREmployeeArrangementShiftsInfo objEmployeeArrangementShiftsInfo, HREmployeesInfo objEmployeesInfo)
        {
            objEmployeeArrangementShiftsInfo.HRArrangementShiftEntrysList.Clear();

            ArrangementShiftEntities   entity = (ArrangementShiftEntities)CurrentModuleEntity;
            HRArrangementShiftsInfo    objArrangementShiftsInfo   = (HRArrangementShiftsInfo)entity.MainObject;
            ADWorkingShiftsController  objWorkingShiftsController = new ADWorkingShiftsController();
            List <ADWorkingShiftsInfo> workingShifts = entity.WorkingShifts;
            ADWorkingShiftsInfo        defaultParam  = (ADWorkingShiftsInfo)workingShifts.Where(o => o.ADWorkingShiftID == objEmployeesInfo.FK_ADWorkingShiftID).FirstOrDefault();

            if (defaultParam != null)
            {
                VinaDbUtil dbUtil  = new VinaDbUtil();
                int        numDays = NumOfDayInMonth();
                for (int i = 1; i <= numDays; i++)
                {
                    DateTime currentDate = objArrangementShiftsInfo.HRArrangementShiftFromDate.Date.AddDays(i - 1);
                    HRArrangementShiftEntrysInfo entry = new HRArrangementShiftEntrysInfo();
                    entry.FK_HREmployeeID                 = objEmployeeArrangementShiftsInfo.FK_HREmployeeID;
                    entry.FK_HRArrangementShiftID         = objEmployeeArrangementShiftsInfo.FK_HRArrangementShiftID;
                    entry.FK_HREmployeeArrangementShiftID = objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftID;
                    entry.HRArrangementShiftEntryDate     = currentDate;
                    entry.FK_ADWorkingShiftID             = defaultParam.ADWorkingShiftID;

                    //String propertyName = String.Format("{0}{1}", "HREmployeeArrangementShiftDate", i);
                    objEmployeeArrangementShiftsInfo.HRArrangementShiftEntrysList.Add(entry);
                }
            }
        }
Ejemplo n.º 3
0
        public int NumOfDayInMonth()
        {
            ArrangementShiftEntities entity = (ArrangementShiftEntities)CurrentModuleEntity;
            HRArrangementShiftsInfo  objArrangementShiftsInfo = (HRArrangementShiftsInfo)entity.MainObject;
            int numDays = (int)(objArrangementShiftsInfo.HRArrangementShiftToDate.Date - objArrangementShiftsInfo.HRArrangementShiftFromDate.Date).TotalDays + 1;

            return(numDays);
        }
Ejemplo n.º 4
0
 public ArrangementShiftModule()
 {
     CurrentModuleName          = "ArrangementShift";
     CurrentModuleEntity        = new ArrangementShiftEntities();
     CurrentModuleEntity.Module = this;
     InitializeModule();
     GetEmployeesList();
 }
Ejemplo n.º 5
0
        public void InitializeArrangementShiftEntryGridControl()
        {
            ArrangementShiftEntities entity = (ArrangementShiftEntities)CurrentModuleEntity;
            HRArrangementShiftsInfo  objArrangementShiftsInfo  = (HRArrangementShiftsInfo)entity.MainObject;
            HREmployeeArrangementShiftsGridControl gridControl = (HREmployeeArrangementShiftsGridControl)Controls["fld_dgcHREmployeeArrangementShifts"];

            gridControl.InitializeControl();
            InitColumnRepository();
        }
Ejemplo n.º 6
0
        private void InvalidateArrangementShiftValues()
        {
            ArrangementShiftEntities entity = (ArrangementShiftEntities)CurrentModuleEntity;

            foreach (HREmployeeArrangementShiftsInfo employeeArrangementShift in entity.EmployeeArrangementShiftsList)
            {
                entity.SetEmployeeArrangementShiftValue(employeeArrangementShift);
            }
        }
Ejemplo n.º 7
0
        public void RemoveEmployeeFromArrangementShiftList()
        {
            ArrangementShiftEntities entity     = (ArrangementShiftEntities)CurrentModuleEntity;
            BandedGridView           bandedView = (BandedGridView)entity.EmployeeArrangementShiftsList.GridControl.MainView;

            if (bandedView.FocusedRowHandle >= 0)
            {
                int index = bandedView.GetDataSourceRowIndex(bandedView.FocusedRowHandle);
                entity.EmployeeArrangementShiftsList.RemoveAt(index);
                bandedView.RefreshData();
            }
        }
Ejemplo n.º 8
0
        public void ChangeArrangementShiftTime()
        {
            ArrangementShiftEntities entity = (ArrangementShiftEntities)CurrentModuleEntity;
            HRArrangementShiftsInfo  objArrangementShiftsInfo = (HRArrangementShiftsInfo)entity.MainObject;
            int numDays = NumOfDayInMonth();

            if (numDays > 31)
            {
                MessageBox.Show("Bạn không thể chọn thời gian xếp ca quá 31 ngày!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                objArrangementShiftsInfo.HRArrangementShiftToDate = objArrangementShiftsInfo.HRArrangementShiftFromDate;
                entity.UpdateMainObjectBindingSource();
            }
            InvalidateArrangementShiftValues();
            InitializeArrangementShiftEntryGridControl();
            UpdateEmployeeArrangementShift();
        }
Ejemplo n.º 9
0
        public List <string> GetColumnFieldNameByTypeEndOfWeek()
        {
            ArrangementShiftEntities entity = (ArrangementShiftEntities)CurrentModuleEntity;
            HRArrangementShiftsInfo  objArrangementShiftsInfo = (HRArrangementShiftsInfo)entity.MainObject;
            List <string>            list = new List <string>();
            int numDays = NumOfDayInMonth();

            for (int i = 1; i <= numDays; i++)
            {
                DateTime dt          = objArrangementShiftsInfo.HRArrangementShiftFromDate.Date.AddDays(i - 1);
                bool     isDayOfWeek = (VinaApp.IsEndOfWeek(objArrangementShiftsInfo.HRArrangementShiftFromDate.Date.AddDays(i - 1).DayOfWeek));
                if (isDayOfWeek)
                {
                    string columnName = String.Format("{0}{1}", "HREmployeeArrangementShiftDate", i.ToString());
                    list.Add(columnName);
                }
            }
            return(list);
        }
Ejemplo n.º 10
0
        public void UpdateEmployeeArrangementShift()
        {
            ArrangementShiftEntities entity = (ArrangementShiftEntities)CurrentModuleEntity;
            HRArrangementShiftsInfo  objArrangementShiftsInfo = (HRArrangementShiftsInfo)entity.MainObject;
            HREmployeesController    objEmployeesController   = new HREmployeesController();
            HREmployeesInfo          objEmployeesInfo;

            entity.EmployeeArrangementShiftsList.ForEach(o =>
            {
                objEmployeesInfo = (HREmployeesInfo)objEmployeesController.GetObjectByID(o.FK_HREmployeeID);
                if (objEmployeesInfo != null)
                {
                    AddDefaulArrangementShiftEntries(o, objEmployeesInfo);
                    List <HRArrangementShiftEntrysInfo> arrangementShiftEntrys = o.HRArrangementShiftEntrysList.Where(i => i.FK_HREmployeeID == o.FK_HREmployeeID).ToList();
                    o.HRArrangementShiftEntrysList = arrangementShiftEntrys;
                    entity.SetEmployeeArrangementShiftValue(o);
                }
            });
            entity.EmployeeArrangementShiftsList.GridControl.RefreshDataSource();
        }
Ejemplo n.º 11
0
        public void InitColumnRepository()
        {
            ArrangementShiftEntities          entity = (ArrangementShiftEntities)CurrentModuleEntity;
            VinaGridControl                   employeeArrangementShiftsGridControl = (VinaGridControl)Controls["fld_dgcHREmployeeArrangementShifts"];
            RepositoryItemCheckedComboBoxEdit reposItemCheckedCombo = new RepositoryItemCheckedComboBoxEdit();

            ADWorkingShiftsController  objWorkingShiftsController = new ADWorkingShiftsController();
            List <ADWorkingShiftsInfo> mainParams = (List <ADWorkingShiftsInfo>)objWorkingShiftsController.GetListFromDataSet(objWorkingShiftsController.GetAllObjects());

            reposItemCheckedCombo.DataSource = mainParams;

            reposItemCheckedCombo.DisplayMember = "ADWorkingShiftName";
            reposItemCheckedCombo.ValueMember   = "ADWorkingShiftName";
            employeeArrangementShiftsGridControl.RepositoryItems.Add(reposItemCheckedCombo);
            GridView gridView = (GridView)employeeArrangementShiftsGridControl.MainView;

            for (int i = 4; i < gridView.Columns.Count; i++)
            {
                gridView.Columns[i].ColumnEdit = reposItemCheckedCombo;
            }
            reposItemCheckedCombo.EditValueChanged += new EventHandler(ReposItemCheckedCombo_EditValueChanged);
        }
Ejemplo n.º 12
0
        public override void Invalidate(int iObjectID)
        {
            base.Invalidate(iObjectID);
            ArrangementShiftEntities    entity = (ArrangementShiftEntities)CurrentModuleEntity;
            HRDepartmentsController     objDepartmentsController     = new HRDepartmentsController();
            HRDepartmentRoomsController objDepartmentRoomsController = new HRDepartmentRoomsController();
            HREmployeesController       objEmployeesController       = new HREmployeesController();

            foreach (var objEmployeeArrangementShiftsInfo in entity.EmployeeArrangementShiftsList)
            {
                HREmployeesInfo   objEmployeesInfo   = (HREmployeesInfo)objEmployeesController.GetObjectByID(objEmployeeArrangementShiftsInfo.FK_HREmployeeID);
                HRDepartmentsInfo objDepartmentsInfo = (HRDepartmentsInfo)objDepartmentsController.GetObjectByID(objEmployeesInfo.FK_HRDepartmentID);
                if (objDepartmentsInfo != null)
                {
                    objEmployeeArrangementShiftsInfo.HRDepartmentName = objDepartmentsInfo.HRDepartmentName;
                }
                HRDepartmentRoomsInfo objDepartmentRoomsInfo = (HRDepartmentRoomsInfo)objDepartmentRoomsController.GetObjectByID(objEmployeesInfo.FK_HRDepartmentRoomID);
                if (objDepartmentRoomsInfo != null)
                {
                    objEmployeeArrangementShiftsInfo.HRDepartmentRoomName = objDepartmentRoomsInfo.HRDepartmentRoomName;
                }
            }
            InitializeArrangementShiftEntryGridControl();
        }
Ejemplo n.º 13
0
        public void AddEmployee()
        {
            ArrangementShiftEntities entity = (ArrangementShiftEntities)CurrentModuleEntity;

            List <HREmployeesInfo> employeesList = entity.EmployeesList.Where(o1 => entity.EmployeeArrangementShiftsList.FirstOrDefault(o2 => o2.FK_HREmployeeID == o1.HREmployeeID) == null).ToList();

            guiSearchEmployee guiSearchEmployee = new guiSearchEmployee(employeesList);

            guiSearchEmployee.Module = this;
            if (guiSearchEmployee.ShowDialog() == DialogResult.OK)
            {
                List <HREmployeesInfo> result = (List <HREmployeesInfo>)guiSearchEmployee.SelectedObjects;
                foreach (HREmployeesInfo objEmployeesInfo in result)
                {
                    HREmployeeArrangementShiftsInfo objEmployeeArrangementShiftsInfo = SetEmployeeArrangementShiftsInfoFromEmployee(objEmployeesInfo);
                    AddDefaulArrangementShiftEntries(objEmployeeArrangementShiftsInfo, objEmployeesInfo);
                    List <HRArrangementShiftEntrysInfo> arrangementShiftEntrys = objEmployeeArrangementShiftsInfo.HRArrangementShiftEntrysList.Where(o => o.FK_HREmployeeID == objEmployeeArrangementShiftsInfo.FK_HREmployeeID).ToList();
                    objEmployeeArrangementShiftsInfo.HRArrangementShiftEntrysList = arrangementShiftEntrys;
                    entity.SetEmployeeArrangementShiftValue(objEmployeeArrangementShiftsInfo);
                    entity.EmployeeArrangementShiftsList.Add(objEmployeeArrangementShiftsInfo);
                }
                entity.EmployeeArrangementShiftsList.GridControl.RefreshDataSource();
            }
        }
Ejemplo n.º 14
0
        public override int ActionSave()
        {
            ArrangementShiftEntities entity = (ArrangementShiftEntities)CurrentModuleEntity;

            return(base.ActionSave());
        }
Ejemplo n.º 15
0
        public void UpdateArrangementShift(HREmployeeArrangementShiftsInfo objEmployeeArrangementShiftsInfo)
        {
            ArrangementShiftEntities entity = (ArrangementShiftEntities)CurrentModuleEntity;
            HRArrangementShiftsInfo  objArrangementShiftsInfo          = (HRArrangementShiftsInfo)entity.MainObject;
            List <string>            employeeArrangementShiftValueList = new List <string> {
                objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate1, objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate2,
                objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate3, objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate4,
                objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate5, objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate6,
                objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate7, objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate8,
                objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate9, objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate10,
                objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate11, objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate12,
                objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate13, objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate14,
                objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate15, objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate16,
                objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate17, objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate18,
                objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate19, objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate20,
                objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate21, objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate22,
                objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate23, objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate24,
                objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate25, objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate26,
                objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate27, objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate28,
                objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate29, objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate30,
                objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftDate31
            };

            objEmployeeArrangementShiftsInfo.HRArrangementShiftEntrysList.ForEach(o => o.FK_HRArrangementShiftID = 0);
            objEmployeeArrangementShiftsInfo.HRArrangementShiftEntrysList.Clear();
            int numDays = NumOfDayInMonth();

            for (int i = 0; i < numDays; i++)
            {
                string[] paramNumbers = employeeArrangementShiftValueList[i].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                DateTime currentDate    = objArrangementShiftsInfo.HRArrangementShiftFromDate.AddDays(i);
                decimal  mainEntryValue = 0;

                for (int j = 0; j < paramNumbers.Length; j++)
                {
                    string paramNo            = paramNumbers[j].Trim();
                    ADWorkingShiftsInfo param = entity.WorkingShifts.Where(o => o.ADWorkingShiftName == paramNo).FirstOrDefault();
                    if (param != null)
                    {
                        HRArrangementShiftEntrysInfo arrangementShiftEntrys = objEmployeeArrangementShiftsInfo.HRArrangementShiftEntrysList.Where(o => o.HRArrangementShiftEntryDate.Date == currentDate.Date &&
                                                                                                                                                  o.FK_ADWorkingShiftID == param.ADWorkingShiftID &&
                                                                                                                                                  objEmployeeArrangementShiftsInfo.FK_HREmployeeID == o.FK_HREmployeeID)
                                                                              .FirstOrDefault();
                        if (arrangementShiftEntrys == null)
                        {
                            arrangementShiftEntrys = new HRArrangementShiftEntrysInfo();
                            arrangementShiftEntrys.FK_HREmployeeArrangementShiftID = objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftID;
                            arrangementShiftEntrys.FK_HRArrangementShiftID         = objEmployeeArrangementShiftsInfo.FK_HRArrangementShiftID;
                            arrangementShiftEntrys.FK_HREmployeeID             = objEmployeeArrangementShiftsInfo.FK_HREmployeeID;
                            arrangementShiftEntrys.HRArrangementShiftEntryDate = currentDate;

                            arrangementShiftEntrys.FK_ADWorkingShiftID = param.ADWorkingShiftID;
                            objEmployeeArrangementShiftsInfo.HRArrangementShiftEntrysList.Add(arrangementShiftEntrys);
                        }
                        else
                        {
                            arrangementShiftEntrys.FK_HREmployeeArrangementShiftID = objEmployeeArrangementShiftsInfo.HREmployeeArrangementShiftID;
                            arrangementShiftEntrys.FK_HRArrangementShiftID         = objEmployeeArrangementShiftsInfo.FK_HRArrangementShiftID;
                            arrangementShiftEntrys.FK_HREmployeeID             = objEmployeeArrangementShiftsInfo.FK_HREmployeeID;
                            arrangementShiftEntrys.FK_ADWorkingShiftID         = param.ADWorkingShiftID;
                            arrangementShiftEntrys.HRArrangementShiftEntryDate = currentDate;
                        }
                    }
                }
            }
            entity.EmployeeArrangementShiftsList.GridControl.RefreshDataSource();
            entity.UpdateMainObjectBindingSource();
        }
Ejemplo n.º 16
0
        public void RemoveSelectedItemFromArrangementShiftItemList()
        {
            ArrangementShiftEntities entity = (ArrangementShiftEntities)CurrentModuleEntity;

            entity.EmployeeArrangementShiftsList.RemoveSelectedRowObjectFromList();
        }