public Dictionary <Componente, Precio> ObtenerListaPrecios(CUIT cuit)
 {
     return(_accesoADatos.Leer("ObtenerListaPrecios", ParametroId(cuit))
            .AsEnumerable()
            .Select(ToComponentProveedor)
            .ToDictionary(cp => cp.Key, cp => cp.Value));
 }
예제 #2
0
파일: Form1.cs 프로젝트: dadais216/gdd
        public Form1(string userId, string rolId)
        {
            InitializeComponent();

            if (util.getVal("SELECT id FROM LOS_SIN_VOZ.Rol WHERE nombre = 'Proveedor'").ToString() == rolId)
            {
                lblProveedor.Hide();
                CUIT.Hide();

                proveedorId = util.getVal("SELECT Proveedor FROM LOS_SIN_VOZ.Usuario WHERE id=" + userId).ToString();
            }
            calendarioPublicacion.MinDate = fecha;
            calendarioVencimiento.MinDate = fecha;
        }
 public override int GetHashCode()
 {
     return(Id.GetHashCode() & ApYNom.GetHashCode() & EstaEliminado.GetHashCode() & Dni.GetHashCode() & Dni.GetHashCode() & FechaNacimiento.GetHashCode() & Telefono.GetHashCode()
            & Celular.GetHashCode() & Legajo.GetHashCode() & FechaIncio.GetHashCode() & CategoriaId.GetHashCode() & CUIT.GetHashCode());
 }
예제 #4
0
 public override string ToString()
 {
     return(string.Format("{0} ({1})", RazonSocial, CUIT.Formato()));
 }
예제 #5
0
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                CUIT cuit = new CUIT(model.Cuit);
                if (cuit.EsValido)
                {
                    var empresaAux = db.Empresa.Where(x => x.Cuit == model.Cuit).FirstOrDefault();
                    if (empresaAux == null)
                    {
                        var user = new ApplicationUser {
                            UserName = model.Cuit, Email = model.Email
                        };
                        var result = await UserManager.CreateAsync(user, model.Password);

                        if (result.Succeeded)
                        {
                            Empresa empresa = new Empresa();
                            empresa.RazonSocial      = model.RazonSocial;
                            empresa.NombreFantasia   = model.NombreFantasia;
                            empresa.Cuit             = model.Cuit;
                            empresa.IdActividad      = model.IdActividad;
                            empresa.IdLocalidad      = model.IdLocalidad;
                            empresa.Calle            = model.Calle;
                            empresa.Altura           = model.Altura;
                            empresa.TelefonoFijo     = model.TelefonoFijo;
                            empresa.TelefonoCelular  = model.TelefonoCelular;
                            empresa.Email            = model.Email;
                            empresa.FechaAltaEmpresa = DateTime.Today;
                            db.Empresa.Add(empresa);
                            db.SaveChanges();

                            var currentUser = UserManager.FindByName(user.UserName);

                            var roleresult = UserManager.AddToRole(currentUser.Id, "Empresa");

                            await UserManager.AddClaimAsync(user.Id, new Claim("IdEmpresa", (empresa.IdEmpresa).ToString()));

                            //await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);

                            // Para obtener más información sobre cómo habilitar la confirmación de cuentas y el restablecimiento de contraseña, visite https://go.microsoft.com/fwlink/?LinkID=320771
                            // Enviar correo electrónico con este vínculo
                            string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);

                            var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                            //await UserManager.SendEmailAsync(user.Id, "Confirmar cuenta", "Para confirmar la cuenta, haga clic <a href=\"" + callbackUrl + "\">aquí</a>");

                            var emailBody = "Hola " + empresa.RazonSocial + "!<br /> Para confirmar la cuenta, haga clic <a href=\"" + callbackUrl + "\">aquí</a>";
                            try
                            {
                                //Configuring webMail class to send emails
                                //gmail smtp server
                                WebMail.SmtpServer = "mail.xindicoweb.com.ar";
                                //gmail port to send emails
                                WebMail.SmtpPort = 587;
                                WebMail.SmtpUseDefaultCredentials = true;
                                //sending emails with secure protocol
                                //WebMail.EnableSsl = true;
                                //EmailId used to send emails from application
                                WebMail.UserName = "******";
                                WebMail.Password = "******";

                                //Sender email address.
                                WebMail.From = "*****@*****.**";

                                //Send email
                                WebMail.Send(to: user.Email, subject: "Confirmar Cuenta", body: emailBody, isBodyHtml: true);
                            }
                            catch (Exception e)
                            {
                                var AuthenticationManagerAux = HttpContext.GetOwinContext().Authentication;
                                AuthenticationManagerAux.SignOut();

                                db.Empresa.Remove(empresa);
                                db.SaveChanges();
                                UserManager.Delete(user);
                            }

                            var AuthenticationManager = HttpContext.GetOwinContext().Authentication;
                            AuthenticationManager.SignOut();

                            return(RedirectToAction("RegisterSuccess"));
                        }
                        AddErrors(result);
                    }
                    else
                    {
                        ModelState.AddModelError("Cuit", "Ya Existe una empresa registrada con ese Cuit");
                    }
                }
                else
                {
                    ModelState.AddModelError("Cuit", "Cuit ingresado no es valido");
                }
            }

            // Si llegamos a este punto, es que se ha producido un error y volvemos a mostrar el formulario
            ViewBag.IdActividad = new SelectList(db.Actividad.OrderBy(x => x.Nombre), "IdActividad", "Nombre", model.IdActividad);
            var localidad = db.Localidad.Find(model.IdLocalidad);

            ViewBag.IdProvincia = new SelectList(db.Provincia, "IdProvincia", "Nombre", localidad.IdProvincia);
            var localidades = db.Localidad.OrderBy(x => x.Nombre);

            foreach (var loc in localidades)
            {
                loc.Nombre = loc.Nombre + " (" + loc.CodPostal + ")";
            }
            ViewBag.IdLocalidad = new SelectList(localidades, "IdLocalidad", "Nombre", model.IdLocalidad);

            return(View(model));
        }
예제 #6
0
 public void BajaProveedor(CUIT seleccionado)
 {
     _repositorio.Eliminar(seleccionado);
 }