Ejemplo n.º 1
0
        //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);
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
        public AddNewGiro(int?idGiro)
        {
            InitializeComponent();

            BindingContext      = giroContext;
            btnGuardar.Clicked += BtnGuardar_Clicked;

            var conn = new SQLiteConnection(path);

            giroContext    = conn.Find <Giros>(idGiro);
            BindingContext = giroContext;
        }
Ejemplo n.º 5
0
        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("~/"));
            }
        }
Ejemplo n.º 6
0
 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);
     }
 }
Ejemplo n.º 7
0
 public void Add(Giros acc)
 {
     context.Giros.Add(acc);
     context.SaveChanges();
 }
Ejemplo n.º 8
0
 public void Put(int id, [FromBody] Giros new_acc)
 {
     repository.Put(id, new_acc);
 }
Ejemplo n.º 9
0
 public void Post([FromBody] Giros acc)
 {
     repository.Add(acc);
 }