private RefCanjeInfo FnCargarCanje() { RefCanjeInfo canje = new RefCanjeInfo(); canje.Id = 0; canje.Premio = Convert.ToInt32(lblIdPremio.Text); canje.Empleado = idUsuario; canje.Puntos_prem = int.Parse(lblPuntoPre.Text); canje.Puntos_disp = int.Parse(lblPuntos.Text); canje.Estado = "I"; canje.Observacion = ""; return(canje); }
protected void btn_canjear_Click(object sender, EventArgs e) { ReferidosLogi refCanje = new ReferidosLogi(); List <RefCanjeInfo> listaCanje = new List <RefCanjeInfo>(); RefCanjeInfo canje = new RefCanjeInfo(); try { CargaPremiosChe(); if (int.Parse(lblPuntos.Text) == 0 || int.Parse(lblPuntos.Text) < int.Parse(lblPuntos.Text.ToString())) { ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Los puntos " + lblPuntos.Text + " no son suficientes para canjeae el premio. " + "');", true); return; } else if (int.Parse(lblPuntoPre.Text) > int.Parse(lblPuntos.Text.ToString())) { ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Los puntos " + lblPuntos.Text + " no son suficientes para canjeae el premio. " + "');", true); return; } listaCanje = refCanje.InsertarPremiosCanje(FnCargarCanje()); string listInsertLog = refCanje.rf_InsertLog("ILOG", idUsuario, idUsuario.ToString(), "", "COLA1", "Solicitud de canje de puntos"); canje = (RefCanjeInfo)listaCanje[0]; FnEnviarCorreo(canje.Id); FnCargarUsuarioCanje(); if (listaCanje.Count > 0) { ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Registro exitoso." + "');", true); } Response.Redirect("~/Referidos/ConsultaPuntos.aspx"); } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + ex.Message + "');", true); } }