Exemplo n.º 1
0
        public async Task <ActionResult> Login(LoginViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            ChequeDAO Usuarios = new ChequeDAO();

            // This doesn't count login failures towards account lockout
            // To enable password failures to trigger account lockout, change to shouldLockout: true
            var user = Usuarios.RetornarPorEmail(model.Email);

            var result = await SignInManager.PasswordSignInAsync(user, model.Password, model.RememberMe, shouldLockout : false);

            switch (result)
            {
            case SignInStatus.Success:
                return(RedirectToLocal(returnUrl));

            case SignInStatus.LockedOut:
                return(View("Lockout"));

            case SignInStatus.RequiresVerification:
                return(RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe }));

            case SignInStatus.Failure:
            default:
                ModelState.AddModelError("", "Usuario ou Senha Invalido");

                //return View(model);
                return(View(model));
            }
        }
Exemplo n.º 2
0
        public MantenimientoCheque()
        {
            InitializeComponent();
            this.ControlBox    = false;
            this.Text          = "MANTENIMIENTO CHEQUE";
            this.StartPosition = FormStartPosition.Manual;
            this.Location      = new Point(50, 20);

            objBancoDao    = new BancoDAO();
            objMonedaDao   = new MonedaDAO();
            objChequeraDao = new ChequeDAO();

            objChequera = new Cheque();

            cmbBanco();
            cmbMoneda(cmb_Banco.SelectedValue.ToString());
            gridParams();

            txt_NroCuenta.Text = cargarNroCuenta(cmb_Banco.SelectedValue.ToString(), cmb_Moneda.SelectedValue.ToString());

            cmb_Banco.SelectedIndexChanged  += Cmb_Banco_SelectedIndexChanged;
            cmb_Moneda.SelectedIndexChanged += Cmb_Moneda_SelectedIndexChanged;
            grd_Cheque.CellClick            += Grd_Cheque_CellClick;


            objListaChequera      = objChequeraDao.getChequera(Ventas.UNIDADNEGOCIO);
            grd_Cheque.DataSource = objListaChequera;
            grd_Cheque.Refresh();
        }
Exemplo n.º 3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            ChequeDAO daoch  = new ChequeDAO();
            int       lastch = daoch.getLastCheque() + 1;

            idCheque.Text = "";//+ lastch;
        }
        public static ClientResponse listar_reporte(int CampaniaID, int ProductoID, int InstitucionEducativaID, String FechaInicial, String FechaFinal, int paginaActual, int RegistroXpagina)
        {
            ClientResponse response;

            try
            {
                using (ChequeDAO dbChq = new ChequeDAO())
                {
                    DateTime?dFechaInicial = null;
                    if (FechaInicial != "")
                    {
                        dFechaInicial = Convert.ToDateTime(FechaInicial);
                    }

                    DateTime?dFechaFinal = null;
                    if (FechaFinal != "")
                    {
                        dFechaFinal = Convert.ToDateTime(FechaFinal);
                    }

                    response = dbChq.listarReporte(CampaniaID, ProductoID, InstitucionEducativaID, dFechaInicial, dFechaFinal, paginaActual, RegistroXpagina);
                }
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(response);
        }
Exemplo n.º 5
0
        public PartialViewResult ChequePartial()
        {
            List <Models.ChequeModel> lista = new List <Models.ChequeModel>();

            ChequeDAO valores = new ChequeDAO();

            return(PartialView("_ChequeView", valores.Lista_Cheque(lista)));
        }
Exemplo n.º 6
0
        private void btnespece_Click(object sender, RoutedEventArgs e)
        {
            decimal t;
            decimal t2;

            Decimal.TryParse(txtEspece.Text, out t);
            Decimal.TryParse(lbltotal.Content.ToString(), out t2);
            if (t > t2)
            {
                decimal rest = t - t2;

                MessageBox.Show("reste de Commande = " + rest + "DT");
                TK_et_FK tk = new TK_et_FK(id);


                tk.ShowDialog();
                CommandeDAO daoc = new CommandeDAO();
                daoc.updateEtat(id);
                ChequeDAO   daoch  = new ChequeDAO();
                int         lastch = daoch.getLastCheque() + 1;
                Payement    pa     = new Payement(1, id, t);
                PayementDAO daop   = new PayementDAO();
                daop.addesp(pa);
                g.PerformRefresh();
                TableDAO table = new TableDAO();
                Commande c     = daoc.getById(id);
                table.update(c.NumTable, false);
                g.dgmois.Items.Refresh();
                this.Close();
            }
            else if (t < t2)
            {
                lbltotal.Content = t2 - t;
                Payement    pa   = new Payement(1, id, t);
                PayementDAO daop = new PayementDAO();
                daop.addesp(pa);
                g.PerformRefresh();
            }
            else
            {
                TK_et_FK tk = new TK_et_FK(id);

                tk.ShowDialog();
                CommandeDAO daoc = new CommandeDAO();
                daoc.updateEtat(id);

                ChequeDAO   daoch  = new ChequeDAO();
                int         lastch = daoch.getLastCheque() + 1;
                Payement    pa     = new Payement(1, id, t);
                PayementDAO daop   = new PayementDAO();
                daop.addesp(pa);
                g.PerformRefresh();
                TableDAO table = new TableDAO();
                Commande c     = daoc.getById(id);
                table.update(c.NumTable, false);
                this.Close();
            }
        }
Exemplo n.º 7
0
 public ActionResult ChequeView(ChequeModel cheque)
 {
     try
     {
         ChequeDAO Insert = new ChequeDAO();
         Insert.Salvar(cheque);
         return(View());
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("", $"{ex}");
         return(View());
     }
 }
Exemplo n.º 8
0
        private void Buscar()
        {
            ChequeDAO oChqDao = new ChequeDAO();
            DataSet   ds      = new DataSet();

            Int32  nCam  = Convert.ToInt32(ddlFCampana.SelectedValue);
            Int32  nCia  = 0;
            Int32  nIns  = 0;
            Int32  nPrd  = 0;
            string sRdlc = "";

            if (ddlFTipoReporte.SelectedValue == "1")
            {
                nCia  = Convert.ToInt32(ddlFiltro.SelectedValue);
                sRdlc = "RepCobbyCia.rdlc";
            }
            if (ddlFTipoReporte.SelectedValue == "2")
            {
                nIns  = Convert.ToInt32(ddlFiltro.SelectedValue);
                sRdlc = "RepCobbyIns.rdlc";
            }
            if (ddlFTipoReporte.SelectedValue == "3")
            {
                nPrd  = Convert.ToInt32(ddlFiltro.SelectedValue);
                sRdlc = "RepCobbyPrd.rdlc";
            }

            Int32 nPend = Convert.ToInt32(chkSoloPendiente.Checked);

            //ReportParameter[] parameters = new ReportParameter[1];
            //parameters[0] = new ReportParameter("EstadoPago", "0");

            ds = oChqDao.getLstCobranza(nCam, nCia, nIns, nPrd, nPend);
            ReportDataSource rptDs = new ReportDataSource();

            rptDs.Value = ds.Tables[0];
            rptDs.Name  = "DSReportCobranza";
            RptVCobranza.LocalReport.DataSources.Clear();
            RptVCobranza.LocalReport.DataSources.Add(rptDs);

            RptVCobranza.LocalReport.ReportEmbeddedResource = sRdlc;
            RptVCobranza.LocalReport.ReportPath             = Server.MapPath(sRdlc);

            //RptVCobranza.LocalReport.SetParameters(parameters);

            RptVCobranza.LocalReport.Refresh();
        }
        public static ClientResponse getChequeXId(int id)
        {
            ClientResponse response;

            try
            {
                using (ChequeDAO dbChq = new ChequeDAO())
                {
                    response = dbChq.getObtenerChequeXId(id);
                }
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(response);
        }
        public static string EliminarCheque(Int32 Id)
        {
            string sRet = "";

            try
            {
                using (ChequeDAO dbChq = new ChequeDAO())
                {
                    dbChq.Eliminar(Id);
                    sRet = "El Cheque ha sido anulado satisfactoriamente";
                }
            }
            catch (Exception ex)
            {
                sRet = ex.Message.ToString();
            }
            return(sRet);
        }
Exemplo n.º 11
0
        public async Task <ActionResult> ForgotPassword(ForgotPasswordViewModel model)
        {
            if (ModelState.IsValid)
            {
                ChequeDAO usu     = new ChequeDAO();
                var       usuario = usu.RetornarPorEmail(model.Email);

                var user = await UserManager.FindByNameAsync(usuario);

                if (user == null) // || !(await UserManager.IsEmailConfirmedAsync(user.Id)))
                {
                    // Don't reveal that the user does not exist or is not confirmed
                    return(View("ForgotPasswordConfirmation"));
                }

                //Gerar nova senha
                string guid         = Guid.NewGuid().ToString().Replace("-", "");
                Random clsRan       = new Random();
                Int32  tamanhoSenha = clsRan.Next(8, 10);
                string senha        = "";
                for (Int32 i = 0; i <= tamanhoSenha; i++)
                {
                    senha += guid.Substring(clsRan.Next(1, guid.Length), 1);
                }

                //Atualizar nova senha
                string code = await UserManager.GeneratePasswordResetTokenAsync(user.Id);

                var result = await UserManager.ResetPasswordAsync(user.Id, code, senha);

                // Envia Email
                await UserManager.SendEmailAsync(user.Id, "Resgate de Senha", user.UserName + ". Foi socilitado um resgate de senha para sua conta.\n" +
                                                 "Favor acesse sua area com a senha: " + senha +
                                                 "  Obs. Recadastre uma nova senha no Menu Usuario\n" +
                                                 "\nEsta é uma menssagem automatica, favor não responder este Email");

                return(RedirectToAction("ForgotPasswordConfirmation", "Account"));
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Exemplo n.º 12
0
        public async Task <ActionResult> ResetPassword(ResetPasswordViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            ChequeDAO usu     = new ChequeDAO();
            var       usuario = usu.RetornarPorEmail(model.Email);                                                          // Pega UserName

            var user = await UserManager.FindByNameAsync(usuario);                                                          // Retorna informações do Usuario

            var result = await SignInManager.PasswordSignInAsync(usuario, model.OldPassword, false, shouldLockout : false); // Verifica se Old Password confere com Usuario

            if (result == SignInStatus.Success)
            {
                string code = await UserManager.GeneratePasswordResetTokenAsync(user.Id); // Pega o code para mudar senha

                if (user == null)
                {
                    // Don't reveal that the user does not exist
                    return(RedirectToAction("ResetPasswordConfirmation", "Account"));
                }
                var resultado = await UserManager.ResetPasswordAsync(user.Id, code, model.Password);

                if (resultado.Succeeded)
                {
                    return(RedirectToAction("ResetPasswordConfirmation", "Account"));
                }
                AddErrors(resultado);
            }
            else
            {
                ModelState.AddModelError("", "Dados do Usuario incorreto");
            }

            return(View());
        }
Exemplo n.º 13
0
        private void Valider_Click(object sender, RoutedEventArgs e)
        {
            double som;
            string s    = somme.Text.ToString();
            string cinC = cinClient.Text.ToString();
            string numC = numCheque.Text.ToString();

            if (somme.Text.ToString() == "" || numCheque.Text.ToString() == "" || nomClient.Text.ToString() == "" || cinClient.Text.ToString() == "")
            {
                MessageBox.Show("Les champs sant obligatoire !");
            }
            else if (!double.TryParse(s, out som))
            {
                MessageBox.Show("Montant doit etre un reel !");
            }

            else if (!double.TryParse(cinC, out som))
            {
                MessageBox.Show("CIN doit etre un entier !");
            }
            else if (!double.TryParse(numC, out som))
            {
                MessageBox.Show("Numéro du compte doit etre un entier !");
            }
            else if (nomClient.Text == "")
            {
                MessageBox.Show("Nom et prénom incorect !");
            }
            decimal sum;

            decimal.TryParse(somme.Text, out sum);
            if (prix == sum)
            {
                TK_et_FK tk = new TK_et_FK(com);


                tk.ShowDialog();
                CommandeDAO daoc = new CommandeDAO();
                daoc.updateEtat(com);
                decimal   some;
                DateTime  d;
                ChequeDAO daoch = new ChequeDAO();
                DateTime.TryParse(dateCheque.Text, out d);
                Decimal.TryParse(somme.Text, out some);
                int    lastch = daoch.getLastCheque() + 1;
                Cheque cheque = new Cheque(some, d, nomClient.Text, cinClient.Text, numCheque.Text);
                daoch.add(cheque);
                Payement    pa   = new Payement(1, lastch, com, sum);
                PayementDAO daop = new PayementDAO();
                daop.addPaycheque(pa);
                g.PerformRefresh();
                TableDAO table = new TableDAO();
                Commande c     = daoc.getById(com);
                table.update(c.NumTable, false);
                this.Close();
                p.Close();
            }
            else
            {
                decimal res = prix - sum;
                this.p.txtEspece.Text   = "" + res;
                this.p.lbltotal.Content = "" + res;
                decimal   some;
                DateTime  d;
                ChequeDAO daoch = new ChequeDAO();
                DateTime.TryParse(dateCheque.Text, out d);
                Decimal.TryParse(somme.Text, out some);
                int    lastch = daoch.getLastCheque() + 1;
                Cheque cheque = new Cheque(some, d, nomClient.Text, cinClient.Text, numCheque.Text);
                daoch.add(cheque);
                Payement    pa   = new Payement(1, lastch, com, sum);
                PayementDAO daop = new PayementDAO();
                daop.addPaycheque(pa);
                g.PerformRefresh();

                this.Close();
            }
        }
        public static ClientResponse GrabarCheque(List <string> arr)
        {
            int     txtID          = 0;
            int     ddlCampana     = 0;
            int     ddlInstitucion = 0;
            int     ddlCia         = 0;
            int     ddlProducto    = 0;
            int     ddlBanco       = 0;
            int     ddlMoneda      = 0;
            decimal txtMonto       = 0;
            string  txtFecha       = string.Empty;
            string  txtNroCheque   = string.Empty;

            try
            {
                int.TryParse(arr[0], out txtID);
                int.TryParse(arr[1], out ddlCampana);
                int.TryParse(arr[2], out ddlInstitucion);
                int.TryParse(arr[3], out ddlCia);
                int.TryParse(arr[4], out ddlProducto);
                int.TryParse(arr[5], out ddlBanco);
                int.TryParse(arr[6], out ddlMoneda);
                decimal.TryParse(arr[9], out txtMonto);
                txtFecha     = arr[7];
                txtNroCheque = arr[8];

                DateTime FechaDate = DateTime.Parse(txtFecha);
                Cheque   pCheque   = new Cheque()
                {
                    ID                     = txtID,
                    CampaniaID             = ddlCampana,
                    InstitucionEducativaID = ddlInstitucion,
                    CIASeguroID            = ddlCia,
                    ProductoID             = ddlProducto,
                    BancoID                = ddlBanco,
                    MonedaID               = ddlMoneda,
                    Fecha                  = FechaDate,
                    NroCheque              = txtNroCheque,
                    Monto                  = txtMonto
                };

                using (ChequeDAO dbChq = new ChequeDAO())
                {
                    if (pCheque.ID == 0)
                    {
                        pCheque.FechaCreacion   = DateTime.Now.Date;
                        pCheque.Activo          = true;
                        pCheque.UsuarioCreacion = UserId;
                        response = dbChq.Agregar(pCheque);
                    }
                    else
                    {
                        pCheque.FechaActualizacion   = DateTime.Now.Date;
                        pCheque.Activo               = true;
                        pCheque.UsuarioActualizacion = UserId;
                        response = dbChq.Grabar(pCheque);
                        //dbChq.Grabar(pCheque);
                        //sRet = "'El cheque se ha Actualizado Satisfactoriamente.'";
                    }
                }
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(response);
        }