Ejemplo n.º 1
0
        public ActionResult CheckExistProfileInOrgStructure(List<Guid> selectedIds)
        {
            string status = string.Empty;
            string message = string.Empty;
            var service = new Cat_OrgStructureServices();
            var listModel = new List<CatOrgStructureModel>();
            var listEntity = service.GetDataNotParam<Cat_OrgStructureTreeViewEntity>(ConstantSql.hrm_cat_sp_get_OrgStructure_Data_SumProfile, UserLogin, ref status);
            listModel = listEntity.Translate<CatOrgStructureModel>();
            for (int i = 0; i < selectedIds.Count; i++)
            {
                if (GetCountProfile(listModel, selectedIds[i], new int[2])[0] <= 0)
                {
                    //delete
                    message += service.Remove<Cat_OrgStructureEntity>(selectedIds[i]) + ",";

                }
                else
                {
                    message += listModel.Single(m => m.ID == selectedIds[i]).OrgStructureName + ",";

                }
            }
            message = message.Substring(0, message.LastIndexOf(','));

            return Json(message, JsonRequestBehavior.AllowGet);
            //var hrService = new Hre_ProfileServices();
            //var lstObj = new List<object>();
            //lstObj.Add(selectedIds);
            //lstObj.Add(null);
            //lstObj.Add(null);
            //var lstProfile = hrService.GetData<Hre_ProfileModel>(lstObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).ToList();

            //if(lstProfile.Count == 0 || lstProfile == null){
            //    rs = true;
            //}





        }