public bool IsWithRecommendation(int id) { string sql = string.Format("SELECT 1 FROM [dbo].[Recommendations] [r] WHERE [r].[EmployeeId] = {0} AND [r].[IsExpired] = 0 AND [r].[IsDeleted] = 0", id.ToString()); string CheckThis = SCObjects.ReturnText(sql, UserConnectionString); return(CheckThis.Length > 0); }
public bool _IsEmployee(int userid) { string sql = string.Format("SELECT [dbo].[fnIsEmployee]({0})", userid.ToString()); var checkThis = SCObjects.ReturnText(sql, UserConnectionString); return(checkThis.Equals("1")); }
public string NextEmployeeNo() { var UserConnectionString = _dbContext.Database.GetDbConnection().ConnectionString; var item = SCObjects.ReturnText("SELECT REPLICATE('0',4 - LEN(COUNT([a].[EmployeeNo]) + 1)) + CAST((COUNT([a].[EmployeeNo]) + 1) AS VARCHAR) FROM [dbo].[Accounts] [a]", UserConnectionString); return(item); }
public UserAccess UserAccess(int UserId) { var _isAdmin = IsAdministrator(UserId); var _isRater = IsRater(UserId); var _isApprover = IsApprover(UserId); var access = new UserAccess { Dashboard = true, //Maitenance Company = _isAdmin, Branch = _isAdmin, Department = _isAdmin, Position = _isAdmin, EmployeeCategory = _isAdmin, //Settings Ratings = (_isRater || _isAdmin), RatingTable = (_isRater || _isAdmin), KeyResultArea = (_isRater || _isAdmin), BehavioralKRA = (_isRater || _isAdmin), EmployeeKRAAssignment = (_isRater || _isAdmin), PeerCriteria = (_isRater || _isAdmin), //Accounts Users = _isAdmin, UserRoles = _isAdmin, ApproverAssignment = _isAdmin, //Employees Employee = _isAdmin, RaterAssignment = _isAdmin, //Evaluation CreateEvaluation = _isRater, Approval = _isApprover, }; if (access.Company || access.Branch || access.Department || access.Position || access.EmployeeCategory) { access.Maintenance = true; } if (access.Ratings || access.RatingTable || access.KeyResultArea || access.BehavioralKRA || access.EmployeeKRAAssignment) { access.Settings = true; } if (access.Users || access.UserRoles || access.ApproverAssignment) { access.Accounts = true; } if (access.Employee || access.RaterAssignment) { access.Employees = true; } if (access.CreateEvaluation || access.Approval) { access.Evaluation = true; } var isWithEvaluation = SCObjects.ReturnText(string.Format("SELECT [dbo].[fnIsWithEvaluation]({0})", UserId.ToString()), UserConnectionString); access.IsWithEvaluation = isWithEvaluation.Length > 0; return(access); }
public bool IsValidPassword(int id, string password) { string sql = string.Format("EXEC [dbo].[spUserAccount] @Id = {0},@QueryType = 1", id.ToString()); var checkthis = SCObjects.ReturnText(sql, UserConnectionString); var oldpassword = Security.Decrypt(checkthis); return(oldpassword.Equals(password)); }
public int EmployeeCount() { string sql = @"SELECT COUNT([uat].[AccountId]) FROM [dbo].[UserAccessTypes] [uat] INNER JOIN [dbo].[UserTypes] [ut] ON [ut].[Id] = [uat].[UserTypeId] WHERE [uat].[IsDeleted] = 0 AND [ut].[Description] LIKE '%employee%'"; string checkThis = SCObjects.ReturnText(sql, UserConnectionString); return(int.Parse(checkThis)); }
public DashboardAccess DashboardAccessPerUser(int userid) { var _isAdmin = IsAdministrator(userid); var _isRater = IsRater(userid); var _isApprover = IsApprover(userid); var item = new DashboardAccess { IsAdministrator = _isAdmin, IsRater = _isRater, IsApprover = _isApprover }; var isWithEvaluation = SCObjects.ReturnText(string.Format("SELECT [dbo].[fnIsWithEvaluation]({0})", userid.ToString()), UserConnectionString); item.IsEmployee = isWithEvaluation.Length > 0; return(item); }
public bool IsWithSecondApproval(int userid) { var checkThis = SCObjects.ReturnText(string.Format("SELECT [dbo].[fnIsWithSecondApproval]({0})", userid.ToString()), UserConnectionString); return(checkThis.Equals("1")); }
public decimal GetKRAPercentage() { var item = SCObjects.ReturnText("EXEC [dbo].[spEvaluationSettings] @QueryType = 1", UserConnectionString); return(decimal.Parse(item)); }
public int PendingForApproval(int userid) { var count = SCObjects.ReturnText(string.Format(@"SELECT [dbo].[fnGetPendingApprovalCount]({0})", userid.ToString()), UserConnectionString); return(int.Parse(count)); }
public int ApprovedEvaluation(int userid) { var count = SCObjects.ReturnText(string.Format(@"SELECT [dbo].[fnGetApprovedEvaluationCount]({0})", userid), UserConnectionString); return(int.Parse(count)); }