public IHttpActionResult GetNavigation(int?roleId) { try { SqlParameter[] param = { new SqlParameter("@roleId", roleId == null?0:roleId), }; var data = _spService.ExcuteSpAnonmious("prc_getMenu", param, 1).Tables[0].AsEnumerable().GroupBy(g => g.Field <string>("Category")).Select(s => new { Icon = s.First().Field <string>("Icon"), Category = s.First().Field <string>("Category"), Url = s.First().Field <string>("Url"), Actions = s.Select(ss => new { Action = ss.Field <string>("Action"), Url = ss.Field <string>("Url"), }).ToList(), }).ToList(); return(Ok(data)); } catch (Exception ex) { return(ResponseMessage(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message))); } }
public IHttpActionResult GetPermissions(long roleId = 1) { try { DataTable dt = new DataTable(); SqlParameter[] param = { new SqlParameter("@roleId", roleId), }; DataSet data = _spService.ExcuteSpAnonmious("prc_getPermission", param, 2); var roles = data.Tables[0].AsEnumerable().Select(s => new Role { Id = s.Field <long>("Id"), RoleName = s.Field <string>("RoleName") }).ToList(); var permission = data.Tables[1].AsEnumerable().GroupBy(g => g.Field <string>("Category")).Select(s => new CategoryPermissionModel { Category = s.First().Field <string>("Category"), Role = s.First().Field <string>("Role"), RoleId = s.First().Field <long>("RoleId"), Actions = s.GroupBy(gg => gg.Field <string>("Action")).Select(ss => new ActionPermissionModel { ActionId = ss.First().Field <long>("ActionId"), Action = ss.First().Field <string>("Action"), PermissionModel = ss.Select(sss => new PermissionModel { PermissionId = sss.Field <long>("PermissionId"), Permission = sss.Field <string>("Permission"), IsAllowed = sss.Field <bool>("IsAllowed"), RolePermissionId = sss.Field <long>("RolePermissionId") }).ToList(), }).ToList(), }).ToList(); return(Ok(new ArrayList() { roles, permission })); } catch (Exception ex) { return(ResponseMessage(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message))); } }
public IHttpActionResult GetCompanys() { try { SqlParameter[] param = { }; DataSet data = _spService.ExcuteSpAnonmious("prc_getCompanies", param, 1); return(Ok(data)); } catch (Exception ex) { return(ResponseMessage(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message))); } }
private DataSet GetDataList(ProductGroupSearchModel model) { try { SqlParameter[] param = { new SqlParameter("@companyId", model.CompanyId), new SqlParameter("@id", model.Id), new SqlParameter("@search", model.Search), }; return(_spService.ExcuteSpAnonmious("[prc_getProductGroups]", param, 1)); } catch (Exception ex) { throw ex; } }
public IHttpActionResult GetReportInfo(int id, int?clientId) { try { SqlParameter[] param = { new SqlParameter("@reportId", id), new SqlParameter("@clientId", clientId) }; var data = _spService.ExcuteSpAnonmious("prc_getReportInfo", param, 3); return(Ok(data)); } catch (Exception ex) { return(ResponseMessage(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message))); } }
private DataSet GetDataList(ProductSearchModel model) { try { SqlParameter[] param = { new SqlParameter("@companyId", model.CompanyId), new SqlParameter("@id", model.Id), new SqlParameter("@CurrentPage", model.page), new SqlParameter("@PageSize", model.pageSize), }; return(_spService.ExcuteSpAnonmious("prc_getProducts", param, 2)); } catch (Exception ex) { throw ex; } }
public IHttpActionResult SpCall() { try { SqlParameter[] param = { }; _spService.ExcuteSpAnonmious("spCalls", param, 1); return(Ok("SpCalls called Successfully.")); } catch (Exception ex) { return(ResponseMessage(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message))); } }
public IHttpActionResult FilterLog(LogModel model) { try { //DateTime startDate = DateTime.Parse(model.From,"",) SqlParameter[] param = { new SqlParameter("@email", model.Email), new SqlParameter("@clientId", model.ClientId), new SqlParameter("@from", model.ClientId), new SqlParameter("@to", model.Id), }; var data = _spService.ExcuteSpAnonmious("prc_getLogs", param, 1); return(Ok(data.Tables[0])); } catch (Exception ex) { return(ResponseMessage(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message))); } }