示例#1
0
        public void UpdateDateTo()
        {
            OverTimeEntities entity           = (OverTimeEntities)CurrentModuleEntity;
            HROverTimesInfo  objOverTimesInfo = (HROverTimesInfo)entity.MainObject;

            objOverTimesInfo.HROverTimeToDate = objOverTimesInfo.HROverTimeDateEnd;
        }
示例#2
0
        public override void Invalidate(int iObjectID)
        {
            base.Invalidate(iObjectID);
            VinaTextBox      t1               = (VinaTextBox)this.Controls["fld_txtHROverTimeFromDate"];
            VinaTextBox      t2               = (VinaTextBox)this.Controls["fld_txtHROverTimeToDate"];
            OverTimeEntities entity           = (OverTimeEntities)CurrentModuleEntity;
            HROverTimesInfo  objOverTimesInfo = (HROverTimesInfo)entity.MainObject;

            t1.Text = objOverTimesInfo.HROverTimeFromDate.ToString("HH:mm");
            t2.Text = objOverTimesInfo.HROverTimeToDate.ToString("HH:mm");
        }
示例#3
0
 public void Check()
 {
     if (!Toolbar.IsNullOrNoneAction())
     {
         OverTimeEntities entity           = (OverTimeEntities)CurrentModuleEntity;
         HROverTimesInfo  objOverTimesInfo = (HROverTimesInfo)entity.MainObject;
         DateTime         from             = objOverTimesInfo.HROverTimeDate.Date.AddHours(objOverTimesInfo.HROverTimeFromDate.Hour).AddMinutes(objOverTimesInfo.HROverTimeFromDate.Minute);
         DateTime         to = objOverTimesInfo.HROverTimeDateEnd.Date.AddHours(objOverTimesInfo.HROverTimeToDate.Hour).AddMinutes(objOverTimesInfo.HROverTimeToDate.Minute);
         double           n  = (to - from).TotalHours;
     }
 }
示例#4
0
        public override void SetDefaultMainObject()
        {
            base.SetDefaultMainObject();
            HROverTimesInfo objOverTimesInfo = (HROverTimesInfo)MainObject;

            objOverTimesInfo.HROverTimeDate     = DateTime.Now.Date;
            objOverTimesInfo.HROverTimeFromDate = DateTime.Now.Date;
            objOverTimesInfo.HROverTimeToDate   = DateTime.Now.Date;
            objOverTimesInfo.HROverTimeDateEnd  = DateTime.Now.Date;
            objOverTimesInfo.HROverTimeStatus   = OverTimeStatus.New.ToString();
        }
示例#5
0
        public override int ActionSave()
        {
            OverTimeEntities entity = (OverTimeEntities)CurrentModuleEntity;
            HROverTimesInfo  obj    = (HROverTimesInfo)entity.MainObject;
            DateTime         d      = obj.HROverTimeDate;
            DateTime         dto    = obj.HROverTimeDateEnd;

            obj.HROverTimeFromDate = new DateTime(d.Year, d.Month, d.Day, obj.HROverTimeFromDate.Hour, obj.HROverTimeFromDate.Minute, 0);
            obj.HROverTimeToDate   = new DateTime(dto.Year, dto.Month, dto.Day, obj.HROverTimeToDate.Hour, obj.HROverTimeToDate.Minute, 0);
            Check();
            return(base.ActionSave());
        }
示例#6
0
        public void CompleteTransaction()
        {
            HROverTimesInfo       objOverTimesInfo           = (HROverTimesInfo)MainObject;
            HROverTimesController objOverTimesController     = new HROverTimesController();
            HROverTimesInfo       objReferrenceOverTimesInfo = (HROverTimesInfo)objOverTimesController.GetObjectByID(objOverTimesInfo.HROverTimeID);

            if (objReferrenceOverTimesInfo != null)
            {
                objReferrenceOverTimesInfo.HROverTimeStatus = OverTimeStatus.Approved.ToString();
                objOverTimesController.UpdateObject(objReferrenceOverTimesInfo);

                objOverTimesInfo.HROverTimeStatus = OverTimeStatus.Approved.ToString();
                UpdateMainObjectBindingSource();
            }
        }
示例#7
0
        public bool ChangeToTimeOT()
        {
            OverTimeEntities entity = (OverTimeEntities)CurrentModuleEntity;

            if (entity.EmployeeOTsList == null || entity.EmployeeOTsList.Count == 0)
            {
                return(true);
            }
            HROverTimesInfo objOverTimesInfo = (HROverTimesInfo)entity.MainObject;
            DateTime        d = objOverTimesInfo.HROverTimeDateEnd;

            foreach (HREmployeeOTsInfo item in entity.EmployeeOTsList)
            {
                item.HREmployeeOTToDate  = new DateTime(d.Year, d.Month, d.Day, objOverTimesInfo.HROverTimeToDate.Hour, objOverTimesInfo.HROverTimeToDate.Minute, 0);
                item.HREmployeeOTDateEnd = objOverTimesInfo.HROverTimeDateEnd;
            }
            return(true);
        }
示例#8
0
        public void UpdateHREmployeeOTByWorkingShift(int workingShiftID)
        {
            OverTimeEntities entity           = (OverTimeEntities)CurrentModuleEntity;
            HROverTimesInfo  objOverTimesInfo = (HROverTimesInfo)entity.MainObject;

            if (!Toolbar.IsNullOrNoneAction())
            {
                if (entity.EmployeeOTsList.Count > 0)
                {
                    entity.EmployeeOTsList.ForEach(o =>
                    {
                        o.FK_ADWorkingShiftID = workingShiftID;
                    });

                    entity.EmployeeOTsList.GridControl.RefreshDataSource();
                }
                objOverTimesInfo.FK_ADWorkingShiftID = workingShiftID;
                entity.UpdateMainObjectBindingSource();
            }
        }
示例#9
0
        public override void InvalidateToolbar()
        {
            base.InvalidateToolbar();
            OverTimeEntities entity     = (OverTimeEntities)CurrentModuleEntity;
            HROverTimesInfo  mainObject = (HROverTimesInfo)entity.MainObject;

            ParentScreen.SetEnableOfToolbarButton(BaseToolbar.ToolbarButtonEdit, true);
            if (mainObject.HROverTimeID > 0)
            {
                if (mainObject.HROverTimeStatus == OverTimeStatus.New.ToString())
                {
                    ParentScreen.SetEnableOfToolbarButton(BaseToolbar.ToolbarButtonEdit, true);
                    ParentScreen.SetEnableOfToolbarButton(BaseToolbar.ToolbarButtonComplete, true);
                }
                else
                {
                    ParentScreen.SetEnableOfToolbarButton(BaseToolbar.ToolbarButtonEdit, false);
                    ParentScreen.SetEnableOfToolbarButton(BaseToolbar.ToolbarButtonComplete, false);
                }
            }
        }
示例#10
0
        public void SetDefaultValuesFromEmployee(HREmployeeOTsInfo objEmployeeOTsInfo, HREmployeesInfo objEmployeesInfo)
        {
            HROverTimesInfo objOverTimesInfo = (HROverTimesInfo)MainObject;

            objEmployeeOTsInfo.HREmployeeOTDate    = objOverTimesInfo.HROverTimeDate;
            objEmployeeOTsInfo.HREmployeeOTDateEnd = objOverTimesInfo.HROverTimeDateEnd;
            DateTime employeeOTDate    = objEmployeeOTsInfo.HREmployeeOTDate;
            DateTime employeeOTDateEnd = objEmployeeOTsInfo.HREmployeeOTDateEnd;

            objEmployeeOTsInfo.HREmployeeOTFromDate           = new DateTime(employeeOTDate.Year, employeeOTDate.Month, employeeOTDate.Day, objOverTimesInfo.HROverTimeFromDate.Hour, objOverTimesInfo.HROverTimeFromDate.Minute, 0);
            objEmployeeOTsInfo.HREmployeeOTToDate             = new DateTime(employeeOTDateEnd.Year, employeeOTDateEnd.Month, employeeOTDateEnd.Day, objOverTimesInfo.HROverTimeToDate.Hour, objOverTimesInfo.HROverTimeToDate.Minute, 0);
            objEmployeeOTsInfo.FK_HREmployeeID                = objEmployeesInfo.HREmployeeID;
            objEmployeeOTsInfo.HREmployeeName                 = objEmployeesInfo.HREmployeeName;
            objEmployeeOTsInfo.FK_HRDepartmentID              = objEmployeesInfo.FK_HRDepartmentID;
            objEmployeeOTsInfo.FK_HRDepartmentRoomID          = objEmployeesInfo.FK_HRDepartmentRoomID;
            objEmployeeOTsInfo.FK_HRDepartmentRoomGroupItemID = objEmployeesInfo.FK_HRDepartmentRoomGroupItemID;
            objEmployeeOTsInfo.HREmployeeCardNumber           = objEmployeesInfo.HREmployeeCardNumber;
            objEmployeeOTsInfo.FK_HRTimeSheetParamID          = objOverTimesInfo.FK_HRTimeSheetParamID;
            objEmployeeOTsInfo.FK_ADWorkingShiftID            = objOverTimesInfo.FK_ADWorkingShiftID;
            objEmployeeOTsInfo.HREmployeeOTFactor             = objOverTimesInfo.HROverTimeFactor;
        }
示例#11
0
        public void UpdateHREmployeeOTByOTFactor()
        {
            OverTimeEntities entity           = (OverTimeEntities)CurrentModuleEntity;
            HROverTimesInfo  objOverTimesInfo = (HROverTimesInfo)entity.MainObject;

            if (!Toolbar.IsNullOrNoneAction() && objOverTimesInfo.HROverTimeFactor >= 0)
            {
                if (entity.EmployeeOTsList.Count > 0)
                {
                    VinaDbUtil dbUtil = new VinaDbUtil();
                    foreach (HREmployeeOTsInfo employeeOT in entity.EmployeeOTsList)
                    {
                        dbUtil.SetPropertyValue(employeeOT, "HREmployeeOTFactor", objOverTimesInfo.HROverTimeFactor);
                    }
                    entity.EmployeeOTsList.GridControl.RefreshDataSource();
                }
            }
            else
            {
                objOverTimesInfo.HROverTimeFactor = entity.EmployeeOTsList.Count > 0 ? entity.EmployeeOTsList[0].HREmployeeOTFactor : 0;
                entity.UpdateMainObjectBindingSource();
            }
        }
示例#12
0
        public void AddEmployee()
        {
            OverTimeEntities       entity        = (OverTimeEntities)CurrentModuleEntity;
            HROverTimesInfo        mainObject    = (HROverTimesInfo)entity.MainObject;
            List <HREmployeesInfo> employeesList = entity.EmployeesList.Where(o1 => entity.EmployeeOTsList.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)
                {
                    HREmployeeOTsInfo objEmployeeOTsInfo = new HREmployeeOTsInfo();
                    entity.SetDefaultValuesFromEmployee(objEmployeeOTsInfo, objEmployeesInfo);
                    entity.EmployeeOTsList.Add(objEmployeeOTsInfo);
                }
                entity.EmployeeOTsList.GridControl.RefreshDataSource();
            }
            mainObject.HREmployeeCardNumber = string.Join(";", entity.EmployeeOTsList.Select(o1 => o1.HREmployeeCardNumber).ToArray());
            mainObject.HREmployeeName       = string.Join(";", entity.EmployeeOTsList.Select(o1 => o1.HREmployeeName).ToArray());
        }
示例#13
0
 public override void InitMainObject()
 {
     MainObject   = new HROverTimesInfo();
     SearchObject = new HROverTimesInfo();
 }