/// <summary>
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Att_ChangeRosterGroupTableModel GetById(string id)
 {
     Att_ChangeRosterGroupTableModel result = new Att_ChangeRosterGroupTableModel();
     string status = string.Empty;
     var services = new Sys_AllSettingServices();
     var configEntity = services.GetData<Sys_AllSettingEntity>(id, ConstantSql.hrm_sys_sp_get_AllSettingByKey, UserLogin, ref status).ToList().FirstOrDefault();
  
     
     return null;
 }
        /// <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 ActionResult DataRosterGroup(string ids)
        {
            List<Guid> selectedIds = new List<Guid>();
            if (!string.IsNullOrEmpty(ids))
            {

                selectedIds = ids.Split(',').Select(s => Guid.Parse(s)).ToList();
            }

            Att_ChangeRosterGroupTableModel result = new Att_ChangeRosterGroupTableModel();

            if (selectedIds.Count > 0)
            {
                int _total = selectedIds.Count;
                int _totalPage = _total / 5 + 1;
                int _pageSize = 5;
                Att_ChangeRosterGroupTableModel dataReturn = new Att_ChangeRosterGroupTableModel();
                for (int _page = 1; _page <= _totalPage; _page++)
                {

                    int _skip = _pageSize * (_page - 1);
                    var _listCurrenPage = selectedIds.Skip(_skip).Take(_pageSize).ToList();
                    var _strDelIDs = string.Join(",", _listCurrenPage);
                    var service = new RestServiceClient<Att_ChangeRosterGroupTableModel>(UserLogin);
                    service.SetCookies(this.Request.Cookies, _Hrm_Hre_Service);
                    dataReturn = service.Get(_Hrm_Hre_Service, "api/Att_ChangeRosterGroupTable/", _strDelIDs);
                    if (result.Table == null)
                    {
                        result.Table = new DataTable();
                        if (result.Table.Rows.Count == 0)
                        {
                            result.Table = dataReturn.Table.Clone();
                        }

                    }
                    if (dataReturn != null)
                    {
                        foreach (DataRow i in dataReturn.Table.Rows)
                        {
                            result.Table.ImportRow(i);
                        }
                    }

                    //    result.Table.ImportRow((DataTable)dataReturn);
                    //  result.Table.ImportRow(dataReturn);

                }
            }
            else {
                var service = new RestServiceClient<Att_ChangeRosterGroupTableModel>(UserLogin);
                service.SetCookies(this.Request.Cookies, _Hrm_Hre_Service);
                result = service.Get(_Hrm_Hre_Service, "api/Att_ChangeRosterGroupTable/", "Create");
            }
            if (result != null)
            {
                result.Ids = string.Empty;
            }



            return View(result);
        }