Exemplo n.º 1
0
        public bool ResetPassword(string newPassword, string randomId, string email)
        {
            var creationResult = false;

            try
            {
                var ServiceInstance = ServiceLayerProvider.GetInstance();
                var searchPassword  = Utilities.Encrypt(newPassword);
                var result          = ServiceInstance.CurrentServicelayerInstance.PASSRESET.Where(x => x.Code == randomId.ToUpper() && x.Name == email).FirstOrDefault();
                if (result != null)
                {
                    var user = ServiceInstance.CurrentServicelayerInstance.BusinessPartners.Where(x => x.EmailAddress == email).FirstOrDefault();
                    if (user != null)
                    {
                        user.U_Password = Utilities.Encrypt(newPassword);
                        ServiceInstance.CurrentServicelayerInstance.UpdateObject(user);
                        var commit = ServiceInstance.CurrentServicelayerInstance.SaveChanges();
                        if (commit != null)
                        {
                            creationResult = true;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                creationResult = false;
                Utilities.LogException(ex);
            }
            return(creationResult);
        }
Exemplo n.º 2
0
        public bool ConfirmEmail(string validationId, string email)
        {
            var confirmed = false;

            try
            {
                var ServiceInstance = ServiceLayerProvider.GetInstance();

                var result = ServiceInstance.CurrentServicelayerInstance.EMAILCONFIRMATION.Where(x => x.Code == validationId.ToUpper() && x.Name == email).FirstOrDefault();
                if (result != null)
                {
                    var user = ServiceInstance.CurrentServicelayerInstance.BusinessPartners.Where(x => x.EmailAddress == email).FirstOrDefault();
                    if (user != null)
                    {
                        user.U_Confirmed = "Y";
                        ServiceInstance.CurrentServicelayerInstance.UpdateObject(user);
                        var commit = ServiceInstance.CurrentServicelayerInstance.SaveChanges();
                        if (commit != null)
                        {
                            confirmed = true;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                confirmed = false;
            }
            return(confirmed);
        }
Exemplo n.º 3
0
        public List <Worker> GetWorkers([Optional] string agent)
        {
            List <Worker> workersList = new List <Worker>();

            try
            {
                var ServiceInstance = ServiceLayerProvider.GetInstance();

                var workers = ServiceInstance.CurrentServicelayerInstance.WORKERSUDO.ToList <WORKERS>();

                foreach (var w in workers)
                {
                    workersList.Add(
                        new Worker()
                    {
                        Agent           = w.U_Agent,
                        BirthDate       = w.U_BirthDate.ToString(),
                        CivilId         = w.U_CivilId,
                        Code            = w.U_ItemCode,
                        Education       = w.U_Education,
                        Gender          = w.U_Gender,
                        Height          = w.U_Height,
                        Language        = w.U_Language,
                        MaritalStatus   = w.U_MaritalStatus,
                        Nationality     = w.U_Nationality,
                        Passport        = w.U_Passport,
                        PassportExpDate = MapField <DateTime>(w.U_PassportExpDate).ToString(),
                        PassportIssDate = MapField <DateTime>(w.U_PassportIssDate).ToString(),
                        PassportNumber  = w.U_PassportNumber,
                        PassportPoIssue = w.U_PassportPoIssue,
                        Photo           = w.U_Photo,
                        Religion        = w.U_Religion,
                        SerialNumber    = w.U_Serial,
                        Status          = w.U_Status,
                        Video           = w.U_Video,
                        Weight          = w.U_Weight.ToString()
                    }
                        );
                }
            }
            catch (Exception ex)
            {
                Utilities.LogException(ex);
            }
            return(workersList);
        }
Exemplo n.º 4
0
 public string CreatePasswordReset(string email)
 {
     try
     {
         var random          = Utilities.RandomString();
         var ServiceInstance = ServiceLayerProvider.GetInstance();
         var password        = new PASSRESET();
         password.Code = random;
         password.Name = email;
         ServiceInstance.CurrentServicelayerInstance.AddToPASSRESET(password);
         ServiceInstance.CurrentServicelayerInstance.SaveChanges();
         return(random);
     }
     catch (Exception ex)
     {
         Utilities.LogException(ex);
         return(string.Empty);
     }
 }
Exemplo n.º 5
0
 public string GenerateConfirmationToken(string email)
 {
     try
     {
         var random          = Utilities.RandomString();
         var ServiceInstance = ServiceLayerProvider.GetInstance();
         var password        = new EMAILCONFIRMATION();
         password.Code = random;
         password.Name = email;
         ServiceInstance.CurrentServicelayerInstance.AddToEMAILCONFIRMATION(password);
         ServiceInstance.CurrentServicelayerInstance.SaveChanges();
         return(random);
     }
     catch (Exception ex)
     {
         Utilities.LogException(ex);
         return(string.Empty);
     }
 }