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; }
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 ); }
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); }
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[10]; 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[10]; 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; }
public static void GetRosterGroup(List<Guid> lstProfileID, DateTime? DateFrom, DateTime? DateTo, string userLogin, out List<Att_RosterEntity> lstRosterTypeGroup, out List<Att_RosterGroup> lstRosterGroup) { var _attRoster = new Att_RosterServices(); var _attRosterGroup = new Att_RosterGroupServices(); string status = string.Empty; lstRosterGroup = new List<Att_RosterGroup>(); lstRosterTypeGroup = new List<Att_RosterEntity>(); string E_APPROVED = RosterStatus.E_APPROVED.ToString(); string E_ROSTERGROUP = RosterType.E_ROSTERGROUP.ToString(); var lstobject = new List<object>(); lstobject.AddRange(new object[10]); lstobject[8] = 1; lstobject[9] = int.MaxValue; var lstobject1 = new List<object>(); lstobject1.AddRange(new object[6]); lstobject1[4] = 1; lstobject1[5] = int.MaxValue; if (DateFrom == null || DateTo == null) { lstRosterTypeGroup = _attRoster.GetData<Att_RosterEntity>(lstobject, ConstantSql.hrm_att_sp_get_Roster, userLogin, ref status).Where(m => lstProfileID.Contains(m.ProfileID) && m.Status == E_APPROVED && m.Type == E_ROSTERGROUP).ToList<Att_RosterEntity>(); lstRosterGroup = _attRosterGroup.GetData<Att_RosterGroupEntity>(lstobject1, ConstantSql.hrm_att_sp_get_RosterGroup,userLogin, ref status).Where(m => m.DateStart != null && m.DateEnd != null).ToList<Att_RosterGroupEntity>().CopyData<List<Att_RosterGroup>>(); } else { lstRosterTypeGroup = _attRoster.GetData<Att_RosterEntity>(lstobject, ConstantSql.hrm_att_sp_get_Roster, userLogin, ref status).Where(m => lstProfileID.Contains(m.ProfileID) && m.Status == E_APPROVED && m.Type == E_ROSTERGROUP && m.DateStart <= DateTo).ToList<Att_RosterEntity>(); lstRosterGroup = _attRosterGroup.GetData<Att_RosterGroupEntity>(lstobject1, ConstantSql.hrm_att_sp_get_RosterGroup, userLogin, ref status).Where(m => m.DateStart != null && m.DateEnd != null && m.DateStart <= DateTo && m.DateEnd >= DateFrom).ToList<Att_RosterGroupEntity>().CopyData<List<Att_RosterGroup>>(); } }
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); } }