public datosZonaAgDestino[] GetZonaAgDestino(string ZonaAgChecked, string usuarioUnidadNegocioID) { List <datosZonaAgDestino> list = new List <datosZonaAgDestino>(); if (ZonaAgChecked == "true") { var devolucion = new List <datosZonaAgDestino>(); DsAgrupacionesAgencias ds = new DsAgrupacionesAgencias(); IAgencia agencia = AgenciaFactory.GetAgencia(); ds = agencia.GetZonasByUsuarioALL(Convert.ToInt32(usuarioUnidadNegocioID)); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { datosZonaAgDestino devolu = new datosZonaAgDestino { Value = ds.Tables[0].Rows[i]["AgrupacionID"].ToString(), Text = ds.Tables[0].Rows[i]["AgrupacionNombre"].ToString() }; devolucion.Add(devolu); } JavaScriptSerializer ser = new JavaScriptSerializer(); ser.MaxJsonLength = Int32.MaxValue; string json = ser.Serialize(devolucion); datosZonaAgDestino[] dtos = ser.Deserialize <datosZonaAgDestino[]>(json); return(dtos); } else { List <GetAgenciasAllCompleto> lstGetAgenciasAllCompleto = new List <GetAgenciasAllCompleto>(); RemitosFaltantesDominio _repo = new RemitosFaltantesDominio(); lstGetAgenciasAllCompleto = _repo.GetAgenciasAllCompleto(); var devolucion = new List <datosZonaAgDestino>(); foreach (var item in lstGetAgenciasAllCompleto) { datosZonaAgDestino devolu = new datosZonaAgDestino { Value = item.AgenciaID.ToString(), Text = item.RazonSocial.ToString() }; devolucion.Add(devolu); } JavaScriptSerializer ser = new JavaScriptSerializer(); ser.MaxJsonLength = Int32.MaxValue; string json = ser.Serialize(devolucion); datosZonaAgDestino[] dtos = ser.Deserialize <datosZonaAgDestino[]>(json); return(dtos); } }
public datosZonaAgDestino[] GetZonaAgDestino(string ZonaAgChecked, string usuarioUnidadNegocioID) { List <datosZonaAgDestino> list = new List <datosZonaAgDestino>(); if (ZonaAgChecked == "true") { var devolucion = new List <datosZonaAgDestino>(); DsAgrupacionesAgencias ds = new DsAgrupacionesAgencias(); IAgencia agencia = AgenciaFactory.GetAgencia(); ds = agencia.GetZonasByUsuarioALL(Convert.ToInt32(usuarioUnidadNegocioID)); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { datosZonaAgDestino devolu = new datosZonaAgDestino { Value = ds.Tables[0].Rows[i]["AgrupacionID"].ToString(), Text = ds.Tables[0].Rows[i]["AgrupacionNombre"].ToString() }; devolucion.Add(devolu); } JavaScriptSerializer ser = new JavaScriptSerializer(); ser.MaxJsonLength = Int32.MaxValue; string json = ser.Serialize(devolucion); datosZonaAgDestino[] dtos = ser.Deserialize <datosZonaAgDestino[]>(json); return(dtos); } else { var devolucion = new List <datosZonaAgDestino>(); IDestinosFleteCol destinosFletes = DestinosFleteColFactory.GetDestinoFleteCol(); destinosFletes.TipoOrigenDestino = NegociosSisPackInterface.SisPack.TipoOrigenDestino.Agencia; DsDestinosFlete ds = destinosFletes.GetDestinosFletesDataSetByUVentaTipoOrigen(); DsDestinosFlete dsTemp = new DsDestinosFlete(); DataRow[] rowArray = ds.Datos.Select("UnidadNegocioID = " + usuarioUnidadNegocioID, "DestinoFleteDescrip"); foreach (DataRow row in rowArray) { dsTemp.Tables[0].ImportRow(row); } for (int i = 0; i < dsTemp.Tables[0].Rows.Count; i++) { datosZonaAgDestino devolu = new datosZonaAgDestino { Value = dsTemp.Tables[0].Rows[i]["DestinoFleteID"].ToString(), Text = dsTemp.Tables[0].Rows[i]["DestinoFleteDescrip"].ToString() }; devolucion.Add(devolu); } JavaScriptSerializer ser = new JavaScriptSerializer(); ser.MaxJsonLength = Int32.MaxValue; string json = ser.Serialize(devolucion); datosZonaAgDestino[] dtos = ser.Deserialize <datosZonaAgDestino[]>(json); return(dtos); } }
public datosZonaAgDestino[] GetZonaAgDestino(string ZonaAgChecked, string usuarioUnidadNegocioID) { List <datosZonaAgDestino> list = new List <datosZonaAgDestino>(); if (ZonaAgChecked == "true") { var devolucion = new List <datosZonaAgDestino>(); DsAgrupacionesAgencias ds = new DsAgrupacionesAgencias(); IAgencia agencia = AgenciaFactory.GetAgencia(); ds = agencia.GetZonasByUsuarioALL(Convert.ToInt32(usuarioUnidadNegocioID)); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { datosZonaAgDestino devolu = new datosZonaAgDestino { Value = ds.Tables[0].Rows[i]["AgrupacionID"].ToString(), Text = ds.Tables[0].Rows[i]["AgrupacionNombre"].ToString() }; devolucion.Add(devolu); } JavaScriptSerializer ser = new JavaScriptSerializer(); ser.MaxJsonLength = Int32.MaxValue; string json = ser.Serialize(devolucion); datosZonaAgDestino[] dtos = ser.Deserialize <datosZonaAgDestino[]>(json); return(dtos); } else { DataSet ds = new DataSet(); ds.Tables.Add(new DataTable()); Config.Conexion.LlenarTypeDataSet(ds.Tables[0], System.Data.CommandType.StoredProcedure, "GetAgenciasAllCompleto"); var devolucion = new List <datosZonaAgDestino>(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { datosZonaAgDestino devolu = new datosZonaAgDestino { Value = ds.Tables[0].Rows[i]["AgenciaID"].ToString(), Text = ds.Tables[0].Rows[i]["RazonSocial"].ToString() }; devolucion.Add(devolu); } JavaScriptSerializer ser = new JavaScriptSerializer(); ser.MaxJsonLength = Int32.MaxValue; string json = ser.Serialize(devolucion); datosZonaAgDestino[] dtos = ser.Deserialize <datosZonaAgDestino[]>(json); return(dtos); //////////////////////////////////////////////////////// //var devolucion = new List<datosZonaAgDestino>(); //IDestinosFleteCol destinosFletes = DestinosFleteColFactory.GetDestinoFleteCol(); //destinosFletes.TipoOrigenDestino = NegociosSisPackInterface.SisPack.TipoOrigenDestino.Agencia; //DsDestinosFlete ds = destinosFletes.GetDestinosFletesDataSetByUVentaTipoOrigen(); //DsDestinosFlete dsTemp = new DsDestinosFlete(); //DataRow[] rowArray = ds.Datos.Select("UnidadNegocioID = " + usuarioUnidadNegocioID, "DestinoFleteDescrip"); //foreach (DataRow row in rowArray) //{ // dsTemp.Tables[0].ImportRow(row); //} //for (int i = 0; i < dsTemp.Tables[0].Rows.Count; i++) //{ // datosZonaAgDestino devolu = new datosZonaAgDestino // { // Value = dsTemp.Tables[0].Rows[i]["DestinoFleteID"].ToString(), // Text = dsTemp.Tables[0].Rows[i]["DestinoFleteDescrip"].ToString() // }; // devolucion.Add(devolu); //} //JavaScriptSerializer ser = new JavaScriptSerializer(); //ser.MaxJsonLength = Int32.MaxValue; //string json = ser.Serialize(devolucion); //datosZonaAgDestino[] dtos = ser.Deserialize<datosZonaAgDestino[]>(json); //return dtos; } }