//Metodo encargado de consultar un giro empresarial public Giros LlenaTablaDatosGE() { Giros listadatos = new Giros(); DataTable dt = new DataTable(); SqlConnection connection = null; List <CamposGirosEmpresariales> composList = new List <CamposGirosEmpresariales>(); try { using (connection = Conexion.ObtieneConexion("ConexionBD")) { SqlDataReader consulta; connection.Open(); consulta = Ejecuta.ProcedimientoAlmacenado(connection, "Usp_CatGiroEmpresarialConsultar", null); dt.Load(consulta); connection.Close(); } foreach (DataRow row in dt.Rows) { CamposGirosEmpresariales reg = new CamposGirosEmpresariales(); reg.idGiro = Convert.ToInt32(row["idGiro"].ToString()); reg.nombre = row["nombre"].ToString(); composList.Add(reg); } listadatos.ListaRegistros = composList.ToArray(); } catch (Exception e) { Console.WriteLine(e); throw; } return(listadatos); }
public void Put(int id, Giros new_acc) { Giros old_acc = context.Giros.FirstOrDefault(e => e.id == id); old_acc.amount = new_acc.amount; context.SaveChanges(); }
static public void SendGiro(HttpClient httpClient, Giros acc) { string url = DataContext.server_adress + "giro"; var r = httpClient.PostAsync( requestUri: url, content: new StringContent(JsonConvert.SerializeObject(acc), Encoding.UTF8, mediaType: "application/json") ).Result; }
public AddNewGiro(int?idGiro) { InitializeComponent(); BindingContext = giroContext; btnGuardar.Clicked += BtnGuardar_Clicked; var conn = new SQLiteConnection(path); giroContext = conn.Find <Giros>(idGiro); BindingContext = giroContext; }
public IActionResult GetAccFromViewField(string acc_type, string client_type, int client_id, int new_percent = 0, decimal new_amount = 0, bool new_cap = false) { if (acc_type == "giro") { Giros new_acc = new Giros { owner_id = client_id, owner_type = client_type.ToUpper(), create_date = DateTime.Today, amount = 0 }; DataContext.SendGiro(httpClient, new_acc); return(Redirect($"/Bank/Accounts?client_type={client_type}&cl_id={client_id}&account_type=giro")); } else if (acc_type == "deposit") { Deposit new_acc = new Deposit { amount = new_amount, percent = new_percent, owner_id = client_id, owner_type = client_type.ToUpper(), cap = new_cap, create_date = DateTime.Today }; DataContext.SendDeposit(httpClient, new_acc); return(Redirect($"/Bank/Accounts?client_type={client_type}&cl_id={client_id}&account_type=deposit")); } else if (acc_type == "credit") { Credits new_acc = new Credits { amount = new_amount, owner_id = client_id, owner_type = client_type.ToUpper(), percent = new_percent, create_date = DateTime.Today }; DataContext.SendCredit(httpClient, new_acc); return(Redirect($"/Bank/Accounts?client_type={client_type}&cl_id={client_id}&account_type=credit")); } else { return(Redirect("~/")); } }
public static string insertUpdateData(Giros data) { try { var conn = new SQLiteConnection(path); if (data.IdGiro > 0) { conn.Update(data); } else { conn.Insert(data); } return("Single data file inserted or updated"); } catch (Exception ex) { return(ex.Message); } }
public void Add(Giros acc) { context.Giros.Add(acc); context.SaveChanges(); }
public void Put(int id, [FromBody] Giros new_acc) { repository.Put(id, new_acc); }
public void Post([FromBody] Giros acc) { repository.Add(acc); }