public HttpResponseMessage UpdateStock(int UID, int PID, string cant, int unit, string key) { Data2.Class.Struct_Producto PD = Data2.Class.Struct_Producto.Get_SingleArticle(UID, PID); if (PD != null && UserInfo.UserID == UID) { Data2.Class.Struct_Unidades U = new Data2.Class.Struct_Unidades(PD.IdUnidad); if (PD.IdUnidad != unit) { Data2.Connection.D_StaticWebService SWS = new Data2.Connection.D_StaticWebService(); int IdUser = SWS.GetUserByPrivateKey(key); if (IdUser != 0) { PD.IdUnidad = unit; PD.Actualizar(IdUser); } } if (PD.UpdateStock(cant) == true) { return(Request.CreateResponse(HttpStatusCode.OK, "ok")); } else { return(Request.CreateResponse(HttpStatusCode.OK, "error")); } } else { return(Request.CreateResponse(HttpStatusCode.OK, "error")); } }
public HttpResponseMessage SA(string K, string ss, string sc, string ip = "-1") { Data2.Connection.D_Articles.SearchCondition SC = Data2.Connection.D_Articles.SearchCondition.PorDescripcion; if (sc == "ci") { SC = Data2.Connection.D_Articles.SearchCondition.PorCodigoInterno; } if (sc == "cb") { SC = Data2.Connection.D_Articles.SearchCondition.PorCodigoBarra; } if (sc == "de") { SC = Data2.Connection.D_Articles.SearchCondition.PorDescripcion; } int IdProvider = -1; try { IdProvider = int.Parse(ip); } catch { IdProvider = -1; } Data2.Connection.D_StaticWebService SWS = new Data2.Connection.D_StaticWebService(); int IdUser = SWS.GetUserByPrivateKey(K); if (ss != null) { List <Data2.Class.Struct_Producto> _List = Data2.Class.Struct_Producto.SearchProducto(IdUser, ss, SC, IdProvider); if (_List != null && _List.Count > 0) { try { JavaScriptSerializer JSS = new JavaScriptSerializer(); JSS.MaxJsonLength = Int32.MaxValue; string result = JSS.Serialize(_List); return(Request.CreateResponse(HttpStatusCode.OK, result)); } catch (Exception E) { Data2.Statics.Log.ADD(E.Message, null); return(Request.CreateResponse(HttpStatusCode.OK, "null")); } } else { return(Request.CreateResponse(HttpStatusCode.OK, "null")); } } else { return(Request.CreateResponse(HttpStatusCode.OK, "null")); } }
public HttpResponseMessage GetFacturasDisponibles(string KEY) { Data2.Connection.D_StaticWebService SWS = new Data2.Connection.D_StaticWebService(); int IdUser = SWS.GetUserByPrivateKey(KEY); if (IdUser != 0) { return(Request.CreateResponse(HttpStatusCode.OK, SWS.GetFacturasDisponibles(IdUser))); } else { return(Request.CreateResponse(HttpStatusCode.OK, "null")); } }
public HttpResponseMessage SendPrinterCommand(string KEY, string COMMAND) { Data2.Connection.D_StaticWebService SWS = new Data2.Connection.D_StaticWebService(); int IdUser = SWS.GetUserByPrivateKey(KEY); if (IdUser != 0) { Data2.Connection.D_PrinterConfig PC = new Data2.Connection.D_PrinterConfig(); bool execution = false; switch (COMMAND.ToUpper()) { case "PRINTZ": PC.InsertPrintAction(Conversion.ObtenerLocal(IdUser), Data2.PublicsEnum.Enum_Printer.PrintActions.PRINT_Z); execution = true; break; case "PRINTX": PC.InsertPrintAction(Conversion.ObtenerLocal(IdUser), Data2.PublicsEnum.Enum_Printer.PrintActions.PRINT_X); execution = true; break; case "AVANZARPAPEL": PC.InsertPrintAction(Conversion.ObtenerLocal(IdUser), Data2.PublicsEnum.Enum_Printer.PrintActions.PRINT_AVANZAR_PAPEL); execution = true; break; default: execution = false; break; } if (execution) { return(Request.CreateResponse(HttpStatusCode.OK, "OK")); } else { return(Request.CreateResponse(HttpStatusCode.OK, "null")); } } else { return(Request.CreateResponse(HttpStatusCode.OK, "null")); } }
public HttpResponseMessage GetPrintAction(string KEY) { Data2.Connection.D_StaticWebService SWS = new Data2.Connection.D_StaticWebService(); int IdUser = SWS.GetUserByPrivateKey(KEY); if (IdUser != 0) { Data2.Class.XmlSerializaers.PrinterAction PA = Data2.Class.XmlSerializaers.PrinterAction.GetLastPrinterAction(Conversion.ObtenerLocal(IdUser)); if (PA != null) { return(Request.CreateResponse(HttpStatusCode.OK, PA.GetSerializad())); } else { return(Request.CreateResponse(HttpStatusCode.OK, "null")); } } else { return(Request.CreateResponse(HttpStatusCode.OK, "null")); } }
public HttpResponseMessage SendConfirmation(string KEY, int IDCOMMAND) { Data2.Connection.D_StaticWebService SWS = new Data2.Connection.D_StaticWebService(); int IdUser = SWS.GetUserByPrivateKey(KEY); if (IdUser != 0) { Data2.Connection.D_PrinterConfig PC = new Data2.Connection.D_PrinterConfig(); if (PC.ConfirmCommand(Conversion.ObtenerLocal(IdUser), IDCOMMAND)) { return(Request.CreateResponse(HttpStatusCode.OK, "OK")); } else { return(Request.CreateResponse(HttpStatusCode.OK, "null")); } } else { return(Request.CreateResponse(HttpStatusCode.OK, "null")); } }
public HttpResponseMessage GetPrintConfiguration(string KEY) { Data2.Connection.D_StaticWebService SWS = new Data2.Connection.D_StaticWebService(); int IdUser = SWS.GetUserByPrivateKey(KEY); if (IdUser != 0) { Data2.Class.Struct_PrintConfiguration PC = Data2.Class.Struct_PrintConfiguration.GetPrintConfiguration(IdUser); if (PC != null) { return(Request.CreateResponse(HttpStatusCode.OK, PC.GetSerializad())); } else { return(Request.CreateResponse(HttpStatusCode.OK, "null")); } } else { return(Request.CreateResponse(HttpStatusCode.OK, "null")); } }
public HttpResponseMessage GetDatosFactura(string KEY, string F) { try { Data2.Connection.D_StaticWebService SWS = new Data2.Connection.D_StaticWebService(); int IdUser = SWS.GetUserByPrivateKey(KEY); if (IdUser != 0) { int IdFactura = int.Parse(F); string returnString = SWS.GetDatosFacturas(IdUser, IdFactura).GetSerializad(); return(Request.CreateResponse(HttpStatusCode.OK, returnString)); } else { return(Request.CreateResponse(HttpStatusCode.OK, "null")); } } catch (Exception E) { return(Request.CreateResponse(HttpStatusCode.OK, E.Message)); } }
public HttpResponseMessage GetDetallesFactura(string KEY, string F) { try { Data2.Connection.D_StaticWebService SWS = new Data2.Connection.D_StaticWebService(); int IdUser = SWS.GetUserByPrivateKey(KEY); if (IdUser != 0) { int IdFactura = int.Parse(F); //string returnString = SWS.GetDetalleFactura(IdUser, IdFactura); return(Request.CreateResponse(HttpStatusCode.OK, "null")); } else { return(Request.CreateResponse(HttpStatusCode.OK, "null")); } } catch { return(Request.CreateResponse(HttpStatusCode.OK, "null")); } }
public HttpResponseMessage SendTicket(string KEY, string F, string S) { try { Data2.Connection.D_StaticWebService SWS = new Data2.Connection.D_StaticWebService(); int IdUser = SWS.GetUserByPrivateKey(KEY); if (IdUser != 0) { int IdFactura = int.Parse(F); string returnString = SWS.UpdateFacturaTicket(IdUser, IdFactura, S); return(Request.CreateResponse(HttpStatusCode.OK, returnString)); } else { return(Request.CreateResponse(HttpStatusCode.OK, "null")); } } catch { return(Request.CreateResponse(HttpStatusCode.OK, "null")); } }
public HttpResponseMessage SC(string K, string ss) { Data2.Connection.D_StaticWebService SWS = new Data2.Connection.D_StaticWebService(); int iduser = SWS.GetUserByPrivateKey(K); if (iduser != 0) { List <Data2.Class.Struct_Cliente> MyList = Data2.Class.Struct_Cliente.SearchClient(ss, iduser); if (MyList != null) { string R = Data2.Statics.Conversion.GetJasonFromList <List <Data2.Class.Struct_Cliente> >(MyList); return(Request.CreateResponse(HttpStatusCode.OK, R)); } else { return(Request.CreateResponse(HttpStatusCode.OK, "null")); } } else { return(Request.CreateResponse(HttpStatusCode.OK, "null")); } }
public HttpResponseMessage SSC(string K, int idc) { Data2.Connection.D_StaticWebService SWS = new Data2.Connection.D_StaticWebService(); int iduser = SWS.GetUserByPrivateKey(K); if (iduser != 0) { Data2.Class.Struct_Cliente MyClient = Data2.Class.Struct_Cliente.GetClient(idc, iduser); if (MyClient != null) { string R = Data2.Statics.Conversion.GetJasonFromObject <Data2.Class.Struct_Cliente>(MyClient); return(Request.CreateResponse(HttpStatusCode.OK, R)); } else { return(Request.CreateResponse(HttpStatusCode.OK, "null")); } } else { return(Request.CreateResponse(HttpStatusCode.OK, "null")); } }