protected void ASPxButton1_Click(object sender, EventArgs e) { try { var objPicking = new WSPicking.SwiftExpressWSPicking(); var fieldValuess = ASPxGridView1.GetSelectedFieldValues(new[] { "PICKING_HEADER", "FF" }); foreach (var header in from object[] item in fieldValuess where item[1].ToString() != "1" select item[0].ToString()) { objPicking.UpdatePickingFreigth(Session["connectionString"].ToString(), header); } objPicking.Dispose(); ASPxGridView2.DataSource = null; ASPxGridView2.DataBind(); Session["GridManifiesto"] = null; GetPicking(); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true); } }
protected bool ValidPickingSbo(string erpDoc) { var objPicking = new WSPicking.SwiftExpressWSPicking(); var pResult = ""; var bResult = false; var dsSap = new DataSet(); var ds = new DataSet(); if (erpDoc == "") { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: Debe ingresar una referencia válida');", true); return(false); } try { ds = (DataSet)Session["DATOS"]; dsSap = objPicking.GetSapPicking(Session["connectionString"].ToString(), erpDoc, ref pResult); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true); } try { if (pResult == "") { var dvSap = new DataView(dsSap.Tables[0], "", "SKU", DataViewRowState.CurrentRows); if (dvSap.Count == ds.Tables[1].Rows.Count) { foreach (DataRowView rowSap in dvSap) { var customerDifferent = ds.Tables[0].Select("CODE_CUSTOMER = '" + rowSap["CUSTOMER_ID"] + "'").Length == 1; var isDifferent = ds.Tables[1].Select("CODE_SKU = '" + rowSap["SKU"] + "' AND SCANNED = " + rowSap["QTY_SOURCE"] + "").Length == 1; if (isDifferent) { bResult = true; } else { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: No concuerdan los productos.');", true); return(false); } if (customerDifferent) { bResult = true; } else { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: No concuerdan los codigos de cliente.');", true); return(false); } } } else { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: No concuerda la cantidad de productos.');", true); return(false); } } else { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + pResult + ".');", true); return(false); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true); } return(bResult); }