public MA_PROFILE_FUNCTIONAL UpdateProfileFunction(SessionInfo sessioninfo, MA_PROFILE_FUNCTIONAL profilefunction) { using (EFUnitOfWork unitOfWork = new EFUnitOfWork()) { var checkDuplicate = unitOfWork.MA_PROFILE_FUNCTIONALRepository.GetAll().FirstOrDefault(p => p.USER_PROFILE_ID == profilefunction.USER_PROFILE_ID && p.FUNCTIONAL_ID == profilefunction.FUNCTIONAL_ID && p.ID != profilefunction.ID); if (checkDuplicate != null) { throw this.CreateException(new Exception(), Messages.DUPLICATE_DATA); } var foundprofilefunction = unitOfWork.MA_PROFILE_FUNCTIONALRepository.All().FirstOrDefault(p => p.ID == profilefunction.ID); if (foundprofilefunction == null) { throw this.CreateException(new Exception(), Messages.DATA_NOT_FOUND); } else { foundprofilefunction.ID = profilefunction.ID; foundprofilefunction.ISAPPROVABLE = profilefunction.ISAPPROVABLE; foundprofilefunction.ISREADABLE = profilefunction.ISREADABLE; foundprofilefunction.ISWRITABLE = profilefunction.ISWRITABLE; foundprofilefunction.USER_PROFILE_ID = profilefunction.USER_PROFILE_ID; foundprofilefunction.FUNCTIONAL_ID = profilefunction.FUNCTIONAL_ID; unitOfWork.Commit(); } } return(profilefunction); }
public void ValidateProfileFunctionTest() { ProfileFunctionBusiness_Accessor target = new ProfileFunctionBusiness_Accessor(); // TODO: Initialize to an appropriate value MA_PROFILE_FUNCTIONAL data = null; // TODO: Initialize to an appropriate value bool expected = false; // TODO: Initialize to an appropriate value bool actual; actual = target.ValidateProfileFunction(data); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
public void CreateProfileFunctionTest() { ProfileFunctionBusiness target = new ProfileFunctionBusiness(); // TODO: Initialize to an appropriate value SessionInfo sessioninfo = null; // TODO: Initialize to an appropriate value MA_PROFILE_FUNCTIONAL profilefunction = null; // TODO: Initialize to an appropriate value MA_PROFILE_FUNCTIONAL expected = null; // TODO: Initialize to an appropriate value MA_PROFILE_FUNCTIONAL actual; actual = target.CreateProfileFunction(sessioninfo, profilefunction); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
public static object Update(SessionInfo sessioninfo, MA_PROFILE_FUNCTIONAL record) { try { ProfileFunctionBusiness _profilefunctionbusiness = new ProfileFunctionBusiness(); //record.ISREADABLE = record.ISREADABLE == null ? false : true; //record.ISWRITABLE = record.ISWRITABLE == null ? false : true; //record.ISAPPROVABLE = record.ISAPPROVABLE == null ? false : true; var updated = _profilefunctionbusiness.UpdateProfileFunction(sessioninfo, record); return(new { Result = "OK" }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public MA_PROFILE_FUNCTIONAL CreateProfileFunction(SessionInfo sessioninfo, MA_PROFILE_FUNCTIONAL profilefunction) { using (EFUnitOfWork unitOfWork = new EFUnitOfWork()) { if (ValidateProfileFunction(profilefunction)) { unitOfWork.MA_PROFILE_FUNCTIONALRepository.Add(profilefunction); unitOfWork.Commit(); } else { throw this.CreateException(new Exception(), Messages.DUPLICATE_DATA); } } return(profilefunction); }
private bool ValidateProfileFunction(MA_PROFILE_FUNCTIONAL data) { List <MA_PROFILE_FUNCTIONAL> oldData = null; using (EFUnitOfWork unitOfWork = new EFUnitOfWork()) { oldData = unitOfWork.MA_PROFILE_FUNCTIONALRepository.GetAll().Where(t => t.FUNCTIONAL_ID == data.FUNCTIONAL_ID && t.USER_PROFILE_ID == data.USER_PROFILE_ID).ToList(); if (oldData.Count > 0) { return(false); } else { return(true); } } }
public static object Update(MA_PROFILE_FUNCTIONAL record) { return(ProfileFunctionalUIP.Update(SessionInfo, record)); }