internal int InsertAndGetId() { try { using (UserRolesDL _userrolesdlDL = new UserRolesDL()) { return(_userrolesdlDL.InsertAndGetId(this)); } } catch { throw; } }
internal int Delete() { try { using (UserRolesDL _userrolesdlDL = new UserRolesDL()) { return(_userrolesdlDL.Delete(this)); } } catch { throw; } }
public List <UserRolesDL> GetUserRoles(string User_Id) { StackFrame stackFrame = new StackFrame(); MethodBase methodBase = stackFrame.GetMethod(); try { OpenEntityConnection(); List <UserRolesDL> objectList = new List <UserRolesDL>(); object[] param1 = { //new SqlParameter("@Company_Id",Company_Id), //new SqlParameter("@Branch_Id", Branch_Id), new SqlParameter("@userId", User_Id) }; var objlist = objPharmaEntities.Database.SqlQuery <UserRolesDL>("exec [dbo].[_SPGetUserRoles] @userId", param1).ToList(); if (objlist != null) { foreach (var obj in objlist) { UserRolesDL objUserRolesDL = new UserRolesDL(); objUserRolesDL.UserId = obj.UserId; objUserRolesDL.RoleId = obj.RoleId; objUserRolesDL.RoleName = obj.RoleName; objUserRolesDL.CheckedValue = obj.CheckedValue; objectList.Add(objUserRolesDL); } } return(objectList); } catch (Exception ex) { catchEntityvalidation((System.Data.Entity.Validation.DbEntityValidationException)ex, System.Runtime.InteropServices.Marshal.GetExceptionCode().ToString(), this.UserNameProperty.ToString(), this.GetType().Name.ToString(), methodBase.Name.ToString()); ex.InnerException.Message.ToString(); return(null); } finally { CloseEntityConnection(); } }