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 && Conversion.ObtenerLocal(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(); if (UID != 0) { PD.IdUnidad = unit; PD.Actualizar(UID); } } 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")); } }
private void ArmarGrilla(Data2.Class.Struct_Producto.ProductDATASET p_PDS) { ListadoArticulos.Controls.Clear(); HtmlGenericControl MyTable = new HtmlGenericControl("table"); MyTable.Attributes.Add("cellspacing", "0"); MyTable.Attributes.Add("border", "1"); MyTable.Attributes.Add("style", "border-collapse:collapse;"); MyTable.Attributes.Add("class", "AtroxTableGrid"); HtmlGenericControl MyTbody = new HtmlGenericControl("tbody"); HtmlGenericControl MyRowHeader = new HtmlGenericControl("tr"); MyRowHeader.Attributes.Add("class", "AtroxHeaderGrid"); MyTbody.Controls.Add(MyRowHeader); MyTable.Controls.Add(MyTbody); Data2.Statics.Log.ADD("Resgistros finales:" + p_PDS.Listado.Count.ToString(), this); string[] Cabeceras = { "Codigo", "Descripcion", "Proveedor", "Cantidad", "Precio Venta", "Setear", "ESTADO" }; for (int a = 0; a < Cabeceras.Length; a++) { HtmlGenericControl HTMLGENERIC = new HtmlGenericControl("th"); HTMLGENERIC.InnerText = Cabeceras[a]; MyRowHeader.Controls.Add(HTMLGENERIC); } Data2.Statics.Log.ADD("Resgistros finales2:" + p_PDS.Listado.Count.ToString(), this); ListadoArticulos.Controls.Add(MyTable); if (p_PDS != null) { List <Data2.Class.Struct_Unidades> UnitsList = Data2.Class.Struct_Unidades.GetAll(); for (int a = 0; a < p_PDS.Listado.Count; a++) { Data2.Statics.Log.ADD(a.ToString(), this); HtmlGenericControl _TR = new HtmlGenericControl("tr"); _TR.Attributes.Add("class", "AtroxRowTable"); HtmlGenericControl _TDCodigo = new HtmlGenericControl("td"); HtmlGenericControl _TDDescripcion = new HtmlGenericControl("td"); HtmlGenericControl _TDProveedor = new HtmlGenericControl("td"); HtmlGenericControl _TDCantidad = new HtmlGenericControl("td"); _TDCantidad.Attributes.Add("Id", "CantCell" + a.ToString()); HtmlGenericControl _TDPrecioVenta = new HtmlGenericControl("td"); HtmlGenericControl _TDEditarBorrar = new HtmlGenericControl("td"); HtmlGenericControl _TDESTADO = new HtmlGenericControl("td"); _TDESTADO.Attributes.Add("style", "Width:150px;"); _TDCodigo.InnerText = p_PDS.Listado[a].CodigoInterno; _TDDescripcion.InnerText = p_PDS.Listado[a].Descripcion; _TDProveedor.InnerText = p_PDS.MyDATATABLE.Rows[a]["NombreProveedor"].ToString(); Data2.Class.Struct_Unidades U = new Data2.Class.Struct_Unidades(p_PDS.Listado[a].IdUnidad); if (U.Decimal == false) { _TDCantidad.InnerText = p_PDS.Listado[a].CantidadINT.ToString(); } else { _TDCantidad.InnerText = p_PDS.Listado[a].CantidadDEC.ToString(); } _TDPrecioVenta.InnerText = p_PDS.Listado[a].PrecioFinal.ToString(); HtmlGenericControl OkStatus = new HtmlGenericControl("div"); OkStatus.Attributes.Add("Id", "Ok" + a.ToString()); OkStatus.Attributes.Add("Class", "OKStatus"); OkStatus.InnerText = "Cambio Guardado"; HtmlGenericControl ErrorStatus = new HtmlGenericControl("div"); ErrorStatus.Attributes.Add("Id", "Error" + a.ToString()); ErrorStatus.Attributes.Add("Class", "ErrorStatus"); ErrorStatus.InnerText = "Error..."; _TDESTADO.Controls.Add(OkStatus); _TDESTADO.Controls.Add(ErrorStatus); HtmlGenericControl TextBOX = new HtmlGenericControl("input"); TextBOX.Attributes.Add("type", "text"); TextBOX.Attributes.Add("ID", "TB" + a.ToString()); TextBOX.Attributes.Add("Class", "AtroxTextBoxMount"); _TDEditarBorrar.Controls.Add(TextBOX); if (UnitsList != null && UnitsList.Count > 0) { HtmlGenericControl ListBox = new HtmlGenericControl("select"); ListBox.Attributes.Add("ID", "SL" + a.ToString()); int hi = 0; for (int b = 0; b < UnitsList.Count; b++) { hi = b; HtmlGenericControl OPT = new HtmlGenericControl("option"); OPT.Attributes.Add("value", UnitsList[b].Id.ToString()); OPT.InnerText = UnitsList[b].Nombre; if (p_PDS.Listado[a].IdUnidad == UnitsList[b].Id) { OPT.Attributes.Add("selected", ""); } ListBox.Controls.Add(OPT); } _TDEditarBorrar.Controls.Add(ListBox); } HtmlGenericControl BUTTON = new HtmlGenericControl("input"); BUTTON.Attributes.Add("type", "Button"); BUTTON.Attributes.Add("value", "Setear"); BUTTON.Attributes.Add("class", "FormButton FirstElement LastElement"); BUTTON.Attributes.Add("onclick", "SetearCantidad(" + Conversion.ObtenerLocal(UserId).ToString() + "," + p_PDS.Listado[a].Id.ToString() + ",\"" + a.ToString() + "\")"); _TDEditarBorrar.Controls.Add(BUTTON); _TR.Controls.Add(_TDCodigo); _TR.Controls.Add(_TDDescripcion); _TR.Controls.Add(_TDProveedor); _TR.Controls.Add(_TDCantidad); _TR.Controls.Add(_TDPrecioVenta); _TR.Controls.Add(_TDEditarBorrar); _TR.Controls.Add(_TDESTADO); MyTbody.Controls.Add(_TR); } } }
void ArmarGrilla() { if (Session[GrillaBusquedaSession] != null) { Data2.Class.Struct_Producto.ProductDATASET PDS = Session[GrillaBusquedaSession] as Data2.Class.Struct_Producto.ProductDATASET; if (PDS.Listado.Count > 0) { HF_results.Value = "1"; tableBody.Controls.Clear(); HtmlGenericControl _table = new HtmlGenericControl("table"); _table.Attributes.Add("cellspacing", "0"); _table.Attributes.Add("border", "1"); _table.Attributes.Add("style", "border-collapse:collapse;width:100%"); HtmlGenericControl _tbody = new HtmlGenericControl("tbody"); HtmlGenericControl _trHeader = new HtmlGenericControl("tr"); _trHeader.Attributes.Add("class", "AtroxHeaderGrid"); string[] tableHeaders = { "0" }; if (modulofacturacion == true) { string[] H = { "Codigo", "Descripcion", "Stock", "Precio de Venta", "Agregar" }; tableHeaders = H; } else { string[] H = { "Codigo", "Descripcion", "Stock", "Precio de Venta" }; tableHeaders = H; } for (int a = 0; a < tableHeaders.Length; a++) { HtmlGenericControl _th = new HtmlGenericControl("th"); _th.InnerText = tableHeaders[a]; _trHeader.Controls.Add(_th); } _tbody.Controls.Add(_trHeader); _table.Controls.Add(_tbody); tableBody.Controls.Add(_table); for (int a = 0; a < PDS.Listado.Count; a++) { HtmlGenericControl _Tr = new HtmlGenericControl("tr"); _Tr.Attributes.Add("class", "AtroxRowTable"); HtmlGenericControl Cell_Codigo = new HtmlGenericControl("td"); Cell_Codigo.InnerText = PDS.Listado[a].CodigoInterno; HtmlGenericControl Cell_Descripcion = new HtmlGenericControl("td"); Cell_Descripcion.InnerText = PDS.Listado[a].Descripcion; HtmlGenericControl Cell_Stock = new HtmlGenericControl("td"); Data2.Class.Struct_Unidades U = new Data2.Class.Struct_Unidades(PDS.Listado[a].IdUnidad); if (U.Decimal == true) { Cell_Stock.InnerText = PDS.Listado[a].CantidadDEC.ToString() + " " + U.Simbolo; } else { Cell_Stock.InnerText = PDS.Listado[a].CantidadINT.ToString() + " " + U.Simbolo; } HtmlGenericControl Cell_PV = new HtmlGenericControl("td"); Cell_PV.InnerText = "$ " + PDS.Listado[a].PrecioFinal.ToString(); HtmlGenericControl Cell_Agregar = new HtmlGenericControl("td"); Cell_Agregar.Attributes.Add("class", "AtroxDarkLink"); HtmlGenericControl Agregar_Link = new HtmlGenericControl("a"); Agregar_Link.Attributes.Add("href", MyURL + "?Add=" + PDS.Listado[a].Id.ToString()); Agregar_Link.InnerText = "Agregar a factura"; Cell_Agregar.Controls.Add(Agregar_Link); _Tr.Controls.Add(Cell_Codigo); _Tr.Controls.Add(Cell_Descripcion); _Tr.Controls.Add(Cell_Stock); _Tr.Controls.Add(Cell_PV); if (modulofacturacion == true) { _Tr.Controls.Add(Cell_Agregar); } _tbody.Controls.Add(_Tr); } } else { HF_results.Value = "0"; } } }