private void LoadGridData(int pageIndex) { if (Session["SP_Parameters"] != null && Session["SP_Name"] != null) { int recordCount; Dictionary <string, string> Params = new Dictionary <string, string>((Dictionary <string, string>)Session["SP_Parameters"]); Params.Add("PageIndex", pageIndex.ToString()); Params.Add("PageSize", ddlPageSize.SelectedValue); DataTable dt = Queries.GetResultsFromStoreProcedure((string)Session["SP_Name"], ref Params).Tables[0]; if (Session["AddDelOption"] != null && (bool)Session["AddDelOption"]) { dt.Columns.Add("Action"); dt.Columns["Action"].SetOrdinal(1); for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i]["Action"] = "x"; } } if (dt.Rows.Count > 0) { recordCount = int.Parse(dt.Rows[0]["CountResults"].ToString()); } else { recordCount = 0; } dt.Columns.Remove("CountResults"); //if(Session["HeaderFilterList"] != null) //{ // AddHeaderTemplates(dt); //} GRV.DataSource = dt; if (Session["ShowFixedHeader"] != null && !(bool)Session["ShowFixedHeader"]) { GRV.ShowHeader = true; } else { GRV.ShowHeader = false; } GRV.DataBind(); setHeaders(dt.Clone()); //Lightweight datatable PopulatePager(recordCount, pageIndex, 10); } }
public ActionResult SelecionarLotes(FormCollection form) { //TODO: Tratar nenhuma GRV marcada para importação DataTable tabelaOriginal = new DataTable(); var marcados = form.GetValues("marcados"); DataTable query = ((DataTable)TempData["arq"]) .AsEnumerable() .Where(r => marcados.Contains(r.Field <string>("Processo"))) .CopyToDataTable(); var IdLeilao = query.Rows[0]["IdLeilao"].ToString(); foreach (DataRow item in query.Rows) { var placa = item[1].ToString(); //try //{ // PWSPatioxDetran ws = new PWSPatioxDetran(); // var retorno = ws.ConsultaVeiculo(placa, "ROOT"); // JavaScriptSerializer js = new JavaScriptSerializer(); //var c = js.Deserialize<PWSPatioxDetran.RetornoConsultaVeiculo>(retorno); // GRV lGRV = new GRV() // { // Chassi = c.Chassi, // Cor = c.DescricaoCor, // Placa = c.Placa, // Marca_Modelo = c.DescricaoMarca, // Tipo_Veiculo = c.DescricaoTipo, // Id_Deposito = int.Parse(item[13].ToString().Substring(0, 3)), // Numero_Formulario_GRV = item[0].ToString() // }; // GRVRepositorio GRVRep = new GRVRepositorio(); // GRVRep.Inserir(lGRV, int.Parse(IdLeilao)); //} //catch //{ GRV lGRV = new GRV() { chassi = item[2].ToString(), cor = item[4].ToString(), placa = item[1].ToString(), marca_modelo = item[3].ToString(), tipo_veiculo = item[5].ToString(), //Id_Deposito = int.Parse(item[13].ToString().Substring(0, 3)), numero_formulario_grv = item[0].ToString() //Chassi = item[6].ToString(), //Cor = item[8].ToString(), //Placa = item[5].ToString(), //Marca_Modelo = item[7].ToString(), //Tipo_Veiculo = item[9].ToString(), ////Id_Deposito = int.Parse(item[17].ToString().Substring(0, 3)), //Numero_Formulario_GRV = item[1].ToString(), //Status = item[2].ToString(), //Lote = item[4].ToString(), }; RepositorioGlobal.GRV.Inserir(lGRV, int.Parse(IdLeilao)); } return(RedirectToAction("Index", "Lote", new { id = IdLeilao })); }