예제 #1
0
        public void NUnit_RosterGroup_Domain_Get()
        {
            Att_RosterGroupServices service = new Att_RosterGroupServices();
            string status = string.Empty;
            var    repo   = service.GetAllUseEntity <Att_RosterGroupEntity>(ref status);

            Console.Write("Total Record: " + repo.Count());
        }
        /// <summary>
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Att_ChangeRosterGroupTableModel GetById(string id)
        {
            Att_ChangeRosterGroupTableModel result = new Att_ChangeRosterGroupTableModel();
            List <Guid> SelectedIds         = new List <Guid>();
            var         rosterGroupServices = new Att_RosterGroupServices();
            string      status       = string.Empty;
            var         date         = DateTime.Now;
            var         services     = new Sys_AllSettingServices();
            var         key          = AppConfig.HRM_ATT_CONFIG_NAME_ROSTERGROUP.ToString();
            var         configEntity = services.GetData <Sys_AllSettingEntity>(key, ConstantSql.hrm_sys_sp_get_AllSettingByKey, UserLogin, ref status).ToList().FirstOrDefault();



            if (!string.IsNullOrEmpty(id))
            {
                if (id.IndexOf('-') > 1)
                {
                    SelectedIds = id.Split(',').Select(s => Guid.Parse(s)).ToList();
                    if (SelectedIds != null && SelectedIds.Count > 0)
                    {
                        if (id != "Create")
                        {
                            var rosterGroupEntity = services.GetData <Att_RosterGroupEntity>(Common.DotNetToOracle(id), ConstantSql.hrm_att_sp_get_RosterGroupById, UserLogin, ref status).FirstOrDefault();
                            if (rosterGroupEntity != null && rosterGroupEntity.DateStart != null)
                            {
                                date = rosterGroupEntity.DateStart.Value;
                            }
                            result.Table = rosterGroupServices.GetTableRosterGroupByMonth(date, ModifyType.E_EDIT);
                            if (configEntity != null)
                            {
                                result.lstType = configEntity.Name.Split(',').ToList();
                            }
                            return(result);
                        }
                    }
                }
                else
                {
                    if (configEntity != null)
                    {
                        result.lstType = configEntity.Value1.Split(',').ToList();
                    }
                    result.Table = rosterGroupServices.GetTableRosterGroupByMonth(date, ModifyType.E_CREATE);
                    return(result);
                }
            }



            return(null);
        }
예제 #3
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

                          );
        }
예제 #4
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);
            }
        }
예제 #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
                                  );
            }
        }
예제 #6
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);
        }
        public Guid Post([Bind] FormDataCollection grouppermissionInfo)
        {
            Guid      groupId = Guid.Empty;
            DataTable tb      = new DataTable();


            var lstResource = grouppermissionInfo.ToList();

            lstResource.Add(new KeyValuePair <string, string>("last_100", ""));
            #region Add Title Column
            foreach (var item in lstResource)
            {
                var str = item.Key.Split('_');
                if (int.Parse(str[1]) > 1)
                {
                    break;
                }
                tb.Columns.Add(str[0]);
            }
            #endregion

            #region Add Row
            var      count    = 1;
            var      index    = 0;
            string[] itemData = new string[8];

            foreach (var item in lstResource)
            {
                var flag = false;

                var str = item.Key.Split('_');
                if (int.Parse(str[1]) != count)
                {
                    flag = false;
                }
                if (int.Parse(str[1]) == count)
                {
                    if (tb.Columns.Contains(str[0]))
                    {
                        flag            = true;
                        itemData[index] = item.Value;
                        index++;
                    }
                }
                if (flag == false)
                {
                    DataRow dr = tb.NewRow();
                    dr.ItemArray = itemData;
                    tb.Rows.Add(dr);
                    itemData = new string[8];
                    count++;
                    index = 0;

                    if (int.Parse(str[1]) == count)
                    {
                        if (tb.Columns.Contains(str[0]))
                        {
                            flag            = true;
                            itemData[index] = item.Value;
                            index++;
                        }
                    }
                }
            }
            #endregion

            var rosterGroupServices = new Att_RosterGroupServices();

            rosterGroupServices.SaveRosterGroup(DateTime.Now, tb);

            return(groupId);
        }