protected void btnProcesar_Click(object sender, EventArgs e) { try { AlertSuccess.Visible = false; lblMessageCreate.Text = ""; lblMessageSuccess.Text = ""; lblMessageError.Text = ""; int docEntry = 0; foreach (Telerik.Web.UI.GridDataItem dataitem in RadGrid1.Items) { if ((dataitem.FindControl("CheckBox1") as CheckBox).Checked == true) { docEntry = int.Parse(dataitem["DocEntry"].Text); } } SessionInfoModel session = new SessionInfoModel(); ComplementosController complementos = new ComplementosController(); session = (SessionInfoModel)Session["SessionInfo"]; PagosModel pagos = new PagosModel { CardCode = session.cardcode, CardName = session.cardname, DocCurr = "", DocDate = "", DocEntry = docEntry, DocNum = int.Parse(lblDocNum.Text), DocTotal = 0, lmUUID = lblHideUUIDXML.Text, lmAttachXML = lblHidePathXML.Text }; SAPB1Result result1 = complementos.UpdateOvpm(pagos); if (result1 != null) { if (result1.Status == "Error") { lblMessageError.Text = result1.Messages; } else { lblMessageSuccess.Text = result1.Messages; lblMessageCreate.Text = result1.Messages; AlertSuccess.Visible = true; btnPaso1Tab.Enabled = false; btnPaso2Tab.Enabled = false; btnValidar.Enabled = false; btnProcesar.Enabled = false; } } else { lblMessageSuccess.Text = "Ocurrio un problema al intentar procesar el archivo XML."; } complementos = null; } catch (Exception ex) { lblMessageError.Text = ex.Message; } }
protected void btnProcesar_Click(object sender, EventArgs e) { try { AlertSuccess.Visible = false; lblMessageCreate.Text = ""; lblMessageSuccess.Text = ""; lblMessageError.Text = ""; if (lblHideUUIDXML.Text != "") { SessionInfoModel session = new SessionInfoModel(); List <FacturaModel> facturas = new List <FacturaModel>(); session = (SessionInfoModel)Session["SessionInfo"]; foreach (Telerik.Web.UI.GridDataItem dataitem in RadGridPartidas.Items) { if ((dataitem.FindControl("CheckBox1") as CheckBox).Checked == true) { facturas.Add(new FacturaModel { DocNumPedido = 0, DocEntryPedido = int.Parse(dataitem["DocEntryPedido"].Text), DocEntry = int.Parse(dataitem["DocEntry"].Text), DocNum = int.Parse(dataitem["DocNum"].Text), SeriesName = "", DocType = dataitem["DocType"].Text, CardCode = session.cardcode, CardName = session.cardname, DocDate = "", DocDueDate = "", NumAtCard = "", DocCur = dataitem["Currency"].Text, Rounding = "", Comments = "", Address2 = "", RoundDif = 0, SubTotal = 0, VatSum = 0, DocTotal = 0, LineNum = int.Parse(dataitem["LineNum"].Text), ItemCode = dataitem["ItemCode"].Text, Dscription = dataitem["Dscription"].Text, Quantity = Convert.ToDouble(dataitem["Quantity"].Text), OpenQty = 0, OpenCreQty = Convert.ToDouble(dataitem["OpenCreQty"].Text), Price = Convert.ToDouble(dataitem["Price"].Text), DiscPrcnt = Convert.ToDouble(dataitem["DiscPrcnt"].Text), Currency = dataitem["Currency"].Text, unitMsr = "", WhsCode = "", VatPrcnt = Convert.ToDouble(dataitem["VatPrcnt"].Text), ShipDate = "", SlpCode = 0, FreeTxt = "", LineTotal = Convert.ToDouble(dataitem["LineTotal"].Text), VatSumLine = Convert.ToDouble(dataitem["VatSumLine"].Text), lmUUID = lblHideUUIDXML.Text, lmAttachXML = lblHidePathXML.Text }); } } if (facturas.Count > 0) { FacturasController facturasController = new FacturasController(); SAPB1Result result = facturasController.CreateOpch(facturas); if (result.Status == "Ok") { lblMessageSuccess.Text = result.Messages; lblMessageCreate.Text = result.Messages; AlertSuccess.Visible = true; btnPaso1.Enabled = false; btnPaso2.Enabled = false; btnPaso3.Enabled = false; btnValidar.Enabled = false; btnProcesar.Enabled = false; } else { lblMessageError.Text = result.Messages; } facturasController = null; } else { lblMessageError.Text = "Ocurrio un problema al intentar recuerar la información de las partidas seleccionadas."; } } else { lblMessageError.Text = "Ocurrio un problema con la validación del archivo XML."; } } catch (Exception ex) { lblMessageError.Text = ex.Message; } }