public void NUnit_RosterGroup_Domain_GetById()
 {
     Att_RosterGroupServices service = new Att_RosterGroupServices();
     var model = new Att_RosterGroup { Id = 1 };
     string status = string.Empty;
     var result = service.GetById<Att_RosterGroupEntity>(model.Id, ref status) as Att_RosterGroupEntity;
     NUnit.Framework.Assert.IsNotNull(result);
     Console.Write("SearchResult: " + result.Id
         + " | " + result.RosterGroupName
       
         );
 }
Пример #2
0
        public void NUnit_RosterGroup_Domain_GetById()
        {
            Att_RosterGroupServices service = new Att_RosterGroupServices();
            var model = new Att_RosterGroup {
                Id = 1
            };
            string status = string.Empty;
            var    result = service.GetById <Att_RosterGroupEntity>(model.Id, ref status) as Att_RosterGroupEntity;

            NUnit.Framework.Assert.IsNotNull(result);
            Console.Write("SearchResult: " + result.Id
                          + " | " + result.RosterGroupName

                          );
        }
Пример #3
0
        public void NUnit_RosterGroup_Domain_Delete()
        {
            Att_RosterGroupServices service = new Att_RosterGroupServices();
            int rs    = 0;
            var model = new Att_RosterGroup {
                Id = 3
            };
            string result = service.Delete <Att_RosterGroupEntity>(model.Id);

            if (result != string.Empty)
            {
                rs += 1;
                Console.WriteLine("Process Success >>> Delete >>> " + model.Id);
            }
        }
 public void NUnit_RosterGroup_Domain_Edit()
 {
     Att_RosterGroupServices service = new Att_RosterGroupServices();
     var model = new Att_RosterGroup
     {
         Id = 1
     };
     string result = service.Edit(model);
     if (result != string.Empty)
     {
         Console.WriteLine("Process Success >>> Update >>> " + model.Id
                 + " | " + model.MonShiftID
                 );
     }
 }
Пример #5
0
        public void NUnit_RosterGroup_Domain_Edit()
        {
            Att_RosterGroupServices service = new Att_RosterGroupServices();
            var model = new Att_RosterGroup
            {
                Id = 1
            };
            string result = service.Edit(model);

            if (result != string.Empty)
            {
                Console.WriteLine("Process Success >>> Update >>> " + model.Id
                                  + " | " + model.MonShiftID
                                  );
            }
        }
 public void NUnit_RosterGroup_Domain_Add()
 {
     Att_RosterGroupServices service = new Att_RosterGroupServices();
     string result = string.Empty;
     int countSC = 0;
     for (int i = 1; i <= 10; i++)
     {
         var model = new Att_RosterGroup
         {
             Comment = "Comment : "+ 1
         };
         result = service.Add(model);
         if (result != string.Empty)
         {
             countSC += 1;
             Console.WriteLine("Process Success >>> Create >>> " + model.Id
                 );
         }
     }
     Console.WriteLine("Total success record: " + countSC);
 }
Пример #7
0
        public void NUnit_RosterGroup_Domain_Add()
        {
            Att_RosterGroupServices service = new Att_RosterGroupServices();
            string result  = string.Empty;
            int    countSC = 0;

            for (int i = 1; i <= 10; i++)
            {
                var model = new Att_RosterGroup
                {
                    Comment = "Comment : " + 1
                };
                result = service.Add(model);
                if (result != string.Empty)
                {
                    countSC += 1;
                    Console.WriteLine("Process Success >>> Create >>> " + model.Id
                                      );
                }
            }
            Console.WriteLine("Total success record: " + countSC);
        }
Пример #8
0
        public void SaveRosterGroup(DateTime MonthYear, DataTable dt)
        {
            DateTime BeginMonth = MonthYear;
            DateTime EndMonth   = BeginMonth.AddMonths(1).AddMinutes(-1);
            //For qua list Nhosm
            //For qua ngafy
            //Trong luc for qua ngay thi tach tuan
            //<Tên Nhóm Ca, <Ngày, Ca>>
            List <Cat_Shift>             lstShift       = lstShift_RosterGroup;
            List <RosterGroupTableModel> lstRosterTable = new List <RosterGroupTableModel>();

            foreach (DataRow dataRow in dt.Rows)
            {
                DateTime Date = Common.ConvertStringToDateTime(dataRow[ConstantMessages.DayOfMonth].ToString(), "dd/MM/yyyy");
                foreach (var shift in lstShift)
                {
                    if (dataRow[shift.Code] != null && dataRow[shift.Code].ToString() != string.Empty)
                    {
                        string RosterGroupName           = dataRow[shift.Code].ToString();
                        RosterGroupTableModel GroupTable = new RosterGroupTableModel();
                        GroupTable.Date            = Date;
                        GroupTable.RosterGroupName = RosterGroupName;
                        GroupTable.ShifID          = shift.ID;
                        lstRosterTable.Add(GroupTable);
                    }
                }
            }

            List <string> lstNameOfGroup = lstName_RosterGroup;

            List <Att_RosterGroup> lstRosterGroup_Insert = new List <Att_RosterGroup>();

            foreach (var item in lstNameOfGroup)
            {
                List <RosterGroupTableModel> lstRosterTableByName = lstRosterTable.Where(m => m.RosterGroupName == item).OrderBy(m => m.Date).ToList();
                for (DateTime dateCheck = BeginMonth; dateCheck < EndMonth; dateCheck = dateCheck.AddDays(1))
                {
                    DateTime BeginWeek = dateCheck;
                    DateTime EndOfWeek = dateCheck;
                    Common.GetStartEndWeek(dateCheck, out BeginWeek, out EndOfWeek);
                    EndOfWeek = EndOfWeek.Date;
                    if (EndOfWeek > EndMonth)
                    {
                        EndOfWeek = EndMonth;
                    }
                    if (BeginWeek < BeginMonth)
                    {
                        BeginWeek = BeginMonth;
                    }

                    Att_RosterGroup RosterGroup = lstRosterGroup_Insert.Where(m => m.RosterGroupName == item && m.DateStart == BeginWeek).FirstOrDefault();
                    if (RosterGroup == null)
                    {
                        RosterGroup = new Att_RosterGroup();
                        RosterGroup.RosterGroupName = item;
                        RosterGroup.DateStart       = BeginWeek;
                        RosterGroup.DateEnd         = EndOfWeek;
                        lstRosterGroup_Insert.Add(RosterGroup);
                    }

                    RosterGroupTableModel rosterGroupInTable = lstRosterTableByName.Where(m => m.Date == dateCheck && m.ShifID != null && m.ShifID != Guid.Empty).FirstOrDefault();
                    if (rosterGroupInTable != null)
                    {
                        switch (dateCheck.DayOfWeek)
                        {
                        case DayOfWeek.Monday:
                            RosterGroup.MonShiftID = rosterGroupInTable.ShifID;
                            break;

                        case DayOfWeek.Tuesday:
                            RosterGroup.TueShiftID = rosterGroupInTable.ShifID;
                            break;

                        case DayOfWeek.Wednesday:
                            RosterGroup.WedShiftID = rosterGroupInTable.ShifID;
                            break;

                        case DayOfWeek.Thursday:
                            RosterGroup.ThuShiftID = rosterGroupInTable.ShifID;
                            break;

                        case DayOfWeek.Friday:
                            RosterGroup.FriShiftID = rosterGroupInTable.ShifID;
                            break;

                        case DayOfWeek.Saturday:
                            RosterGroup.SatShiftID = rosterGroupInTable.ShifID;
                            break;

                        case DayOfWeek.Sunday:
                            RosterGroup.SunShiftID = rosterGroupInTable.ShifID;
                            break;
                        }
                    }
                }
            }
            //Save, Delete cai cu trong Db
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                unitOfWork.SetIsDelete <Att_RosterGroup>(context.Att_RosterGroup.Where(m => m.DateStart <= EndMonth && m.DateEnd >= BeginMonth));
                unitOfWork.AddObject(lstRosterGroup_Insert.ToArray());
                unitOfWork.SaveChanges();
            }
        }
 public void NUnit_RosterGroup_Domain_Remove()
 {
     Att_RosterGroupServices service = new Att_RosterGroupServices();
     int rs = 0;
     var model = new Att_RosterGroup { Id = 1 };
     string result = service.Remove<Att_RosterGroupEntity>(model.Id);
     if (result != string.Empty)
     {
         rs += 1;
         Console.WriteLine("Process Success >>> Remove >>> " + model.Id);
     }
 }