Esempio n. 1
0
 public void NUnit_Domain_GetCatDayOff()
 {
     string status = string.Empty;
     Cat_DayOffServices service = new Cat_DayOffServices();
     int count = service.GetAllUseEntity<Cat_DayOffEntity>(ref status).Count();
     //NUnit.Framework.Assert.AreNotEqual(0, count);
     Console.Write("Total Record: " + count);
 }
Esempio n. 2
0
 public void NUnit_Domain_GetByIdCatDayOff()
 {
     Cat_DayOffServices service = new Cat_DayOffServices();
     var DayOff = new Cat_DayOff { Id = 2 };
     string status = string.Empty;
     var result = service.GetById<Cat_DayOff>(DayOff.Id, ref status) ;
     NUnit.Framework.Assert.IsNotNull(result);
     Console.Write("SearchResult: " + result.Id + " | " + result.DateOff + " | " + result.Type + " | " + result.Status + " | " + result.Comments + " | " + result.OrgStructureID + " | " + result.IsLeaveDay);
 }
Esempio n. 3
0
        public void NUnit_Domain_GetCatDayOff()
        {
            string             status  = string.Empty;
            Cat_DayOffServices service = new Cat_DayOffServices();
            int count = service.GetAllUseEntity <Cat_DayOffEntity>(ref status).Count();

            //NUnit.Framework.Assert.AreNotEqual(0, count);
            Console.Write("Total Record: " + count);
        }
Esempio n. 4
0
        public void NUnit_Domain_GetByIdCatDayOff()
        {
            Cat_DayOffServices service = new Cat_DayOffServices();
            var DayOff = new Cat_DayOff {
                Id = 2
            };
            string status = string.Empty;
            var    result = service.GetById <Cat_DayOff>(DayOff.Id, ref status);

            NUnit.Framework.Assert.IsNotNull(result);
            Console.Write("SearchResult: " + result.Id + " | " + result.DateOff + " | " + result.Type + " | " + result.Status + " | " + result.Comments + " | " + result.OrgStructureID + " | " + result.IsLeaveDay);
        }
Esempio n. 5
0
 public void NUnit_Domain_UpdateCatDayOff()
 {
     Cat_DayOffServices service = new Cat_DayOffServices();
     var DayOff = new Cat_DayOff
     {
         Id = 12,
         Type = "ABCDomain12",
         Status = "BC-12",
     };
  //   NUnit.Framework.Assert.IsTrue(result);
     if (service.Edit<Cat_DayOff>(DayOff) == ActionStatus.EditSucceed.ToString())
     {
         Console.WriteLine("==>>> Result After Update:  " + DayOff.Id + " | " + DayOff.DateOff + " | " + DayOff.Type + " | " + DayOff.Status + " | " + DayOff.Comments + " | " + DayOff.OrgStructureID + " | " + DayOff.IsLeaveDay);
     }
 }
Esempio n. 6
0
        public void NUnit_Domain_UpdateCatDayOff()
        {
            Cat_DayOffServices service = new Cat_DayOffServices();
            var DayOff = new Cat_DayOff
            {
                Id     = 12,
                Type   = "ABCDomain12",
                Status = "BC-12",
            };

            //   NUnit.Framework.Assert.IsTrue(result);
            if (service.Edit <Cat_DayOff>(DayOff) == ActionStatus.EditSucceed.ToString())
            {
                Console.WriteLine("==>>> Result After Update:  " + DayOff.Id + " | " + DayOff.DateOff + " | " + DayOff.Type + " | " + DayOff.Status + " | " + DayOff.Comments + " | " + DayOff.OrgStructureID + " | " + DayOff.IsLeaveDay);
            }
        }
Esempio n. 7
0
        public void NUnit_Domain_DeleteCatDayOff()
        {
            Cat_DayOffServices service = new Cat_DayOffServices();
            int rs = 0;
            for (int i = 1; i <= 10; i++)
            {
                var DayOff = new Cat_DayOff { Id = i };
                if (service.Delete<Cat_DayOff>(DayOff.Id) == ActionStatus.DeleteSucceed.ToString())
                {
                    rs += 1;
                    Console.WriteLine("Process Success >>> Delete >>> " + i);
                }
            }
            Console.WriteLine("Total success record: " + rs);

            //NUnit.Framework.Assert.IsTrue(result);
        }
Esempio n. 8
0
 public void NUnit_Domain_AddCatDayOff()
 {
     Cat_DayOffServices service = new Cat_DayOffServices();
     int rs = 0;
     for (int i = 0; i < 10; i++)
     {
         var DayOff = new Cat_DayOff
         {
             Type = "NUnit Domain DayOffName " + i,
             Status = "NUnit-DayOffCode-" + i,
         };
         if (service.Add<Cat_DayOff>(DayOff) == ActionStatus.AddSucceed.ToString())
         {
             rs += 1;
             Console.WriteLine("Process Success >>> Create >>> " + DayOff.Id + " | " + DayOff.DateOff + " | " + DayOff.Type + " | " + DayOff.Status + " | " + DayOff.Comments + " | " + DayOff.OrgStructureID + " | " + DayOff.IsLeaveDay);
         }
     }
     Console.WriteLine("Total success record: " + rs);
 }
Esempio n. 9
0
        public void NUnit_Domain_DeleteCatDayOff()
        {
            Cat_DayOffServices service = new Cat_DayOffServices();
            int rs = 0;

            for (int i = 1; i <= 10; i++)
            {
                var DayOff = new Cat_DayOff {
                    Id = i
                };
                if (service.Delete <Cat_DayOff>(DayOff.Id) == ActionStatus.DeleteSucceed.ToString())
                {
                    rs += 1;
                    Console.WriteLine("Process Success >>> Delete >>> " + i);
                }
            }
            Console.WriteLine("Total success record: " + rs);

            //NUnit.Framework.Assert.IsTrue(result);
        }
Esempio n. 10
0
        public void NUnit_Domain_AddCatDayOff()
        {
            Cat_DayOffServices service = new Cat_DayOffServices();
            int rs = 0;

            for (int i = 0; i < 10; i++)
            {
                var DayOff = new Cat_DayOff
                {
                    Type   = "NUnit Domain DayOffName " + i,
                    Status = "NUnit-DayOffCode-" + i,
                };
                if (service.Add <Cat_DayOff>(DayOff) == ActionStatus.AddSucceed.ToString())
                {
                    rs += 1;
                    Console.WriteLine("Process Success >>> Create >>> " + DayOff.Id + " | " + DayOff.DateOff + " | " + DayOff.Type + " | " + DayOff.Status + " | " + DayOff.Comments + " | " + DayOff.OrgStructureID + " | " + DayOff.IsLeaveDay);
                }
            }
            Console.WriteLine("Total success record: " + rs);
        }
Esempio n. 11
0
        public IEnumerable <Att_OvertimeModel> Post(Att_ComputeOvertimeModel model)
        {
            Att_WorkDayServices serviceWorkDay = new Att_WorkDayServices();
            var status     = string.Empty;
            var lstWorkDay = serviceWorkDay.GetWorkDaysByInOut(model.DateFrom, model.DateTo);
            Cat_ShiftServices serviceShift = new Cat_ShiftServices();
            var lstShift = serviceShift.GetDataNotParam <Cat_ShiftEntity>(ConstantSql.hrm_cat_sp_get_Shift, UserLogin, ref status);

            //Cat_ShiftItemServices serviceShiftItem = new Cat_ShiftItemServices();
            //var lstShiftItem = serviceShiftItem.GetCatShiftItem();
            var lstShiftItem = new List <Cat_ShiftItemEntity>();
            Cat_DayOffServices servicesDayOff = new Cat_DayOffServices();
            var lstDayOff = servicesDayOff.GetAllUseEntity <Cat_DayOffEntity>(ref status).ToList();

            Cat_OvertimeTypeServices servicesOvertimeType = new Cat_OvertimeTypeServices();
            var lstOvertimeType = servicesOvertimeType.GetDataNotParam <Cat_OvertimeTypeEntity>(ConstantSql.hrm_cat_sp_get_OvertimeType, UserLogin, ref status);

            var Att_OvertimeInfoFillterAnalyze = new Att_OvertimeInfoFillterAnalyze()
            {
                isAllowGetAfterShift           = model.isAllowGetAfterShift,
                isAllowGetBeforeShift          = model.isAllowGetBeforeShift,
                isAllowGetInShift              = model.isAllowGetInShift,
                isAllowGetOTOutterShift        = model.isAllowGetOTOutterShift,
                isAllowGetTypeBaseOnActualDate = model.isAllowGetTypeBaseOnActualDate,
                isAllowGetTypeBaseOnBeginShift = model.isAllowGetTypeBaseOnBeginShift,
                isAllowGetTypeBaseOnEndShift   = model.isAllowGetTypeBaseOnEndShift,
                MininumOvertimeHour            = model.MininumOvertimeHour
            };

            var service = new Att_OvertimeServices();
            var result  = service.AnalyzeOvertime(lstWorkDay,
                                                  lstShift,
                                                  lstShiftItem,
                                                  lstDayOff,
                                                  lstOvertimeType,
                                                  Att_OvertimeInfoFillterAnalyze, UserLogin).ToList().Translate <Att_OvertimeModel>();

            return(result);
        }
Esempio n. 12
0
        public CatDayOffModel Post([Bind] CatDayOffModel model)
        {
            ActionService service = new ActionService(UserLogin);

            #region Validate
            var type = "Cat_DayOff";
            if (model.ID != Guid.Empty)
            {
                type = "Cat_DayOff_Edit";
            }
            string message       = string.Empty;
            var    checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData <CatDayOffModel>(model, type, ref message);
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return(model);
            }
            #endregion

            if (model.ID != Guid.Empty)
            {
                return(service.UpdateOrCreate <Cat_DayOffEntity, CatDayOffModel>(model));
            }
            List <Cat_DayOffEntity> listDayOffInsert = new List <Cat_DayOffEntity>();
            List <Cat_DayOffEntity> listDayOff       = getDayOff(model);
            List <Cat_DayOffEntity> listDayOffDelete = new List <Cat_DayOffEntity>();

            string             status        = string.Empty;
            Cat_DayOffServices dayOffService = new Cat_DayOffServices();
            var listDayOffExist = dayOffService.GetAll();

            foreach (Cat_DayOffEntity item in listDayOff)
            {
                item.IsLeaveDay     = model.IsLeaveDay;
                item.Comments       = model.Comments;
                item.OrgStructureID = model.OrgStructureID;
                item.UserCreate     = model.UserCreate;
                item.DateUpdate     = model.DateUpdate;

                DateTime _dateOff = item.DateOff.Date;
                listDayOffExist = listDayOffExist.Where(dOff => dOff.DateOff.Date == _dateOff).ToList();

                if (listDayOffExist.Count > 0)
                {
                    if (model.Overwite)
                    {
                        listDayOffDelete.AddRange(listDayOffExist);
                        item.ID = Guid.NewGuid();
                        listDayOffInsert.Add(item);
                    }
                    else
                    {
                        continue;
                    }
                }
                else
                {
                    item.ID = Guid.NewGuid();
                    listDayOffInsert.Add(item);
                }
            }
            if (listDayOffDelete.Count > 0)
            {
                List <Guid> lstDel = listDayOffDelete.Select(s => s.ID).ToList();
                foreach (var item in lstDel)
                {
                    dayOffService.Remove <Cat_DayOffEntity>(item);
                }
            }
            CatDayOffModel rs = new CatDayOffModel();
            rs.ActionStatus = dayOffService.Add <Cat_DayOffEntity>(listDayOffInsert);
            return(rs);



            //if (model.ID == Guid.Empty && model.DateEnd.HasValue)
            //{
            //    CatDayOffModel modelReturn = model.CopyData<CatDayOffModel>();
            //    DateTime dtFrom = model.DateOff;
            //    while (dtFrom <= model.DateEnd.Value)
            //    {
            //        CatDayOffModel NewModel = new CatDayOffModel();
            //        NewModel.DateOff = dtFrom;
            //        NewModel.Type = model.Type;
            //        NewModel.Status = model.Status;
            //        NewModel.Comments = model.Comments;
            //        NewModel.OrgStructureID = model.OrgStructureID;
            //        NewModel.IsLeaveDay = model.IsLeaveDay;
            //        NewModel.OrgStructureName = model.OrgStructureName;
            //        NewModel.UserUpdate = model.UserUpdate;
            //        NewModel.DateUpdate = model.DateUpdate;
            //        modelReturn = service.UpdateOrCreate<Cat_DayOffEntity, CatDayOffModel>(NewModel);
            //        if (modelReturn.ActionStatus != NotificationType.Success.ToString())
            //            return modelReturn;
            //        dtFrom = dtFrom.AddDays(1);
            //    }
            //    return modelReturn;
            //}
            //else
            //{
            //    return service.UpdateOrCreate<Cat_DayOffEntity, CatDayOffModel>(model);
            //}
        }