public IHttpActionResult GetModules([FromBody] business_base_class _auth) { try { if (cls_token.validate(_auth)) { long?iduser = cls_token.GetLoginId(_auth.Token.Key); if (iduser != null) { List <cls_module> modulelist = cls_module.GetModules(iduser.Value); if (modulelist != null) { return(Ok(modulelist)); } else { return(Ok("null")); } } else { return(Ok("null")); } } else { return(Unauthorized()); } } catch (Exception e) { log.insertLog(e, 0, 0); return(InternalServerError(e)); } }
public IHttpActionResult GetAll([FromBody] business_base_class b) { try { if (cls_token.validate(b)) { long loginid = cls_token.GetLoginId(b.Token.Key).Value; long idcompany = cls_login.GetCompanyIdByIdLogin(loginid); return(Ok(cls_receipt_type.GetAll())); } else { return(Unauthorized()); } } catch (Exception e) { log.insertLog(e, 0, 0); return(InternalServerError(e)); } }
public IHttpActionResult RemoveOrder([FromBody] business_base_class c) { try { if (cls_token.validate(c)) { long loginid = cls_token.GetLoginId(c.Token.Key).Value; long idcompany = cls_login.GetCompanyIdByIdLogin(loginid); cls_order_header.deleteOrder(c.Id); return(Ok(c)); } else { return(Unauthorized()); } } catch (Exception e) { return(InternalServerError(e)); } }
public IHttpActionResult GetByInternalId(business_base_class c) { try { if (cls_token.validate(c)) { long loginid = cls_token.GetLoginId(c.Token.Key).Value; long idcompany = cls_login.GetCompanyIdByIdLogin(loginid); cls_customer cust = cls_customer.GetCustomerByInternalID(c.Id); return(Ok(cust)); } else { return(Unauthorized()); } } catch (Exception e) { log.insertLog(e, 0, 0); return(InternalServerError(e)); } }
public IHttpActionResult GetAll([FromBody] business_base_class c) { try { if (Business.base_class.cls_token.validate(c)) { try { long loginid = cls_token.GetLoginId(c.Token.Key).Value; long idcompany = cls_login.GetCompanyIdByIdLogin(loginid); filter_paged_response r = cls_login.GetLogins(idcompany); return(Ok(r)); } catch (Exception e) { log.insertLog(e, 0, 0); filter_paged_response fpr = new filter_paged_response(); fpr.Debug.Add(e.Message); fpr.Debug.Add(e.StackTrace); return(Ok(e)); } } else { return(Unauthorized()); } } catch (Exception e) { log.insertLog(e, 0, 0); filter_paged_response fpr = new filter_paged_response(); fpr.Debug.Add(e.Message); fpr.Debug.Add(e.StackTrace); return(InternalServerError(e)); } }
public IHttpActionResult GetAll([FromBody] business_base_class c) { try { if (cls_token.validate(c)) { long loginid = cls_token.GetLoginId(c.Token.Key).Value; // Obtenemos la informacion del usuario que realiza la consulta cls_login user = cls_login.Get(loginid); List <cls_order_header> orderlist = new List <cls_order_header>(); // Muestra todos los pedidos de la compaƱia if (user.Roles[0].Name == "Administrator" || user.Roles[0].Name == "Administrador") { long idcompany = cls_login.GetCompanyIdByIdLogin(loginid); orderlist = cls_order_header.GetAllByCompanyId(idcompany); } // Muestra todos los pedidos del usuario else { orderlist = cls_order_header.GetAllByUserId(user.Id); } return(Ok(orderlist)); } else { return(Unauthorized()); } } catch (Exception e) { return(Ok(e)); } }