Exemplo n.º 1
0
    public static LegalPerson SelectDate(string cnpj)
    {
        LegalPerson lp = new LegalPerson();
        IDbConnection objConexao;
        IDbCommand objComando;
        IDataReader objReader;
        string sql = "SELECT * FROM tbl_juridica WHERE jud_cnpj = ?cnpj";
        objConexao = Mapped.Connection();
        objComando = Mapped.Command(sql, objConexao);
        objComando.Parameters.Add(Mapped.Parameter("?cnpj", cnpj));
        objReader = objComando.ExecuteReader();
        while (objReader.Read())
        {
            
            lp.Cnpj = Convert.ToString(objReader["jud_cnpj"]);
            

        }
        objConexao.Close();
        objComando.Dispose();
        objConexao.Dispose();
        objReader.Dispose();

        return lp;
    }
Exemplo n.º 2
0
    public static int Insert(LegalPerson leg)
    {
        int valor = 0;
        try
        {
            IDbConnection objConexao;
            IDbCommand objCommand;

            string sql = "INSERT INTO TBL_JURIDICA (JUD_CNPJ, JUD_RAZAO_SOCIAL, JUD_AREA_ATUACAO, PES_ID, jud_created, jud_updated) VALUES (?cnpj, ?company, ?area, ?person, (select now()), (select now()));";

            objConexao = Mapped.Connection();
            objCommand = Mapped.Command(sql, objConexao);
            objCommand.Parameters.Add(Mapped.Parameter("?cnpj", leg.Cnpj));
            objCommand.Parameters.Add(Mapped.Parameter("?company", leg.CompanyName));
            objCommand.Parameters.Add(Mapped.Parameter("?area", leg.Area));
            objCommand.Parameters.Add(Mapped.Parameter("?person", leg.Person.Id));
            objCommand.ExecuteNonQuery();
            objConexao.Close();
            objConexao.Dispose();
            objCommand.Dispose();
        }

        catch
        {
            valor = -2;
        }

        return valor;
    }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {

            if (!IsPostBack)
            {
                //Cidade
                //Carregar um DropDownList com o Banco de Dados 
                DataSet ds = CityDB.SelectAll();
                ddlCity.DataSource = ds;
                ddlCity.DataTextField = "CID_NOME";
                // Nome da coluna do Banco de dados 
                ddlCity.DataValueField = "CID_ID"; // ID da coluna do Banco 
                ddlCity.DataBind();
                ddlCity.Items.Insert(0, "Cidade");

                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                //Logradouro
                //Carregar um DropDownList com o Banco de Dados 
                DataSet ds1 = PatioDB.SelectAll();
                ddlPatio.DataSource = ds1;
                ddlPatio.DataTextField = "LOG_TIPO";
                // Nome da coluna do Banco de dados 
                ddlPatio.DataValueField = "LOG_ID"; // ID da coluna do Banco 
                ddlPatio.DataBind();
                ddlPatio.Items.Insert(0, "Logradouro");

                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                //Estado
                //Carregar um DropDownList com o Banco de Dados 
                DataSet ds2 = StateDB.SelectAll();
                ddlUF.DataSource = ds2;
                ddlUF.DataTextField = "UF_NOME";
                // Nome da coluna do Banco de dados 
                ddlUF.DataValueField = "UF_ID"; // ID da coluna do Banco 
                ddlUF.DataBind();
                ddlUF.Items.Insert(0, "UF");

                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                LegalPerson lp = new LegalPerson();
                lp = LegalPersonDB.SelectDate(TxtRealName.Text);
                TxtRealName.Text = lp.Cnpj;

            }
        }
        catch
        {
            Response.Redirect("../../index.aspx");
        }
    }
        static void Main(string[] args)
        {
            Person[] people;

            Console.Write("Entre com a quantidade de pagadores: ");
            int n = int.Parse(Console.ReadLine());

            people = new Person[n];

            Console.WriteLine();

            for (int i = 0; i < n; i++)
            {
                Console.WriteLine($"Entre com os dados do {i + 1}º: ");
                Console.Write("Física ou Jurídica (f/j)? ");
                char d = char.Parse(Console.ReadLine());
                Console.Write("Nome: ");
                string name = Console.ReadLine();
                Console.Write("Renda anual: ");
                double annualIncome = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);

                if (d == 'f')
                {
                    Console.Write("Despesas médicas: ");
                    double medicalExpenses = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);

                    people[i] = new IndividualPerson(name, annualIncome, medicalExpenses);
                }
                else if (d == 'j')
                {
                    Console.Write("Número de empregados: ");
                    int numEmployees = int.Parse(Console.ReadLine());

                    people[i] = new LegalPerson(name, annualIncome, numEmployees);
                }

                Console.WriteLine();
            }

            Console.WriteLine("Imposto pago:");
            foreach (Person person in people)
            {
                Console.WriteLine(person);
            }
        }
        private void policeNumberInput_TextChanged(object sender, EventArgs e)
        {
            insuranseCaseInput.Items.Clear();
            Regex regex = new Regex("[1-9]{1}[0-9]*");

            if (regex.IsMatch(policeNumberInput.Text))
            {
                GetAllLegalPersonPoliciesCommand command = new GetAllLegalPersonPoliciesCommand();
                int         legalClientId = Int32.Parse(policeNumberInput.Text);
                LegalPerson legalPerson   = new LegalPerson();
                legalPerson.Id = legalClientId;
                List <InsurancePolicy> policyList = command.getAllLegalPersonPolicies(legalPerson);
                foreach (InsurancePolicy policy in policyList)
                {
                    insuranseCaseInput.Items.AddRange(policy.InsuranceCaseList.ToArray());
                }
            }
        }
Exemplo n.º 6
0
        public async Task Store(LegalPersonDto dto)
        {
            LegalPerson person = new LegalPerson(dto.CompanyName, dto.TradeName);

            StoreAddress(dto, person);
            StoreDocument(dto, person);

            if (!person.Validate())
            {
                NotifyDomainValidations(person.ValidationResult);
            }

            if (!_notifier.HasNotification())
            {
                _legalPersonRepository.Add(person);
                await _unitOfWork.Commit();
            }
        }
Exemplo n.º 7
0
        public static bool RegisterUser(LegalPerson person)
        {
            try
            {
                var dt = new DataTable();
                dt.Columns.Add("Contatos");//ProductID

                foreach (var contact in person.Contatos)
                {
                    dt.Rows.Add(contact.Contact);
                }

                using (SqlConnection con = new Commands().Con())
                {
                    using (SqlCommand cmd = new SqlCommand("RegisterLegalPerson", con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        cmd.Parameters.AddWithValue("@Contatos", dt);
                        cmd.Parameters.Add("@Name", SqlDbType.VarChar).Value          = person.NomeFantasia;
                        cmd.Parameters.Add("@CNPJ", SqlDbType.VarChar).Value          = person.CNPJ;
                        cmd.Parameters.Add("@DataFundacao", SqlDbType.DateTime).Value = person.DataFundacao;
                        //cmd.Parameters.Add("@Contato", SqlDbType.VarChar).Value = person.Contato;
                        //cmd.Parameters.Add("@ContatoSecundario", SqlDbType.VarChar).Value = person.ContatoSecundario;
                        cmd.Parameters.Add("@Senha", SqlDbType.VarChar).Value       = person.Senha;
                        cmd.Parameters.Add("@Email", SqlDbType.VarChar).Value       = person.Email;
                        cmd.Parameters.Add("@Logradouro", SqlDbType.VarChar).Value  = person.Rua;
                        cmd.Parameters.Add("@CEP", SqlDbType.VarChar).Value         = person.CEP;
                        cmd.Parameters.Add("@Bairro", SqlDbType.VarChar).Value      = person.Bairro;
                        cmd.Parameters.Add("@Cidade", SqlDbType.VarChar).Value      = person.Cidade;
                        cmd.Parameters.Add("@Estado", SqlDbType.VarChar).Value      = person.Estado;
                        cmd.Parameters.Add("@Complemento", SqlDbType.VarChar).Value = person.Complemento;
                        cmd.Parameters.Add("@Numero", SqlDbType.VarChar).Value      = person.Numero;

                        con.Open();
                        return(cmd.ExecuteNonQuery() > 0 ? true : false);
                    }
                }
            }
            catch
            {
                return(false);
            }
        }
Exemplo n.º 8
0
        public async Task <IActionResult> EditLegalPerson(LegalPersonViewModel legalPersonViewModel)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var client      = legalPersonViewModel.Client;
                    var legalPerson = new LegalPerson
                    {
                        IdEdrpou      = legalPersonViewModel.Client.IdClient,
                        Director      = legalPersonViewModel.LegalPerson.Director,
                        Name          = legalPersonViewModel.LegalPerson.Name,
                        OwnershipType = legalPersonViewModel.LegalPerson.OwnershipType
                    };

                    await _clientRepository.UpdateAsync(entity : client);

                    await _legalPersonRepository.UpdateAsync(legalPerson);

                    var userId = HttpContext.Session.Get <string>(key: "IdIdentity");

                    var user = await _userManager.FindByIdAsync(userId : userId);

                    user.UserName    = legalPersonViewModel.Client.Login;
                    user.Email       = legalPersonViewModel.Client.Login;
                    user.PhoneNumber = legalPersonViewModel.Client.TelNumber;

                    await _userManager.UpdateAsync(user : user);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClientExists(id: legalPersonViewModel.Client.IdClient))
                    {
                        return(NotFound());
                    }

                    throw;
                }

                return(RedirectToAction(actionName: nameof(Index)));
            }

            return(View(model: legalPersonViewModel));
        }
Exemplo n.º 9
0
 public void delete_leg_person([QueryString("legPersonId")] int legPersonId)
 {
     using (ContragentContext db = new ContragentContext())
     {
         var item = new LegalPerson {
             ID = legPersonId
         };
         db.Entry(item).State = EntityState.Deleted;
         try
         {
             db.SaveChanges();
         }
         catch (DbUpdateConcurrencyException)
         {
             ModelState.AddModelError("",
                                      String.Format("Item with id {0} no longer exists in the database.", legPersonId));
         }
     }
 }
        private void submitLegal_Click(object sender, EventArgs e)
        {
            if (companyComboBox.SelectedItem == null || insurerComboBox.SelectedItem == null ||
                policeCategoryComboBox.SelectedItem == null || String.IsNullOrEmpty(policeCoastNumericUpDown.Text) ||
                String.IsNullOrEmpty(policeAmountNumericUpDown.Text) || String.IsNullOrEmpty(startDateDateTimePicker.Text) ||
                String.IsNullOrEmpty(endDateDateTimePicker.Text))
            {
                label1.Text = "Проверьте заполнение всех полей.";
            }
            else
            {
                InsurancePolicy policy = new InsurancePolicy();
                LegalPerson     client = new LegalPerson();
                client                = (LegalPerson)companyComboBox.SelectedItem;
                policy.Client         = client;
                policy.Insurer        = (Insurer)insurerComboBox.SelectedItem;
                policy.Category       = (InsuranceCategory)policeCategoryComboBox.SelectedItem;
                policy.Cost           = policeCoastNumericUpDown.Value;
                policy.Amount         = policeAmountNumericUpDown.Value;
                policy.SignDate       = startDateDateTimePicker.Value;
                policy.ExpirationDate = endDateDateTimePicker.Value;

                RegisterNewPolice command = new RegisterNewPolice();
                bool result = command.registerNewPolice(policy);
                if (result == true)
                {
                    companyComboBox.ResetText();
                    insurerComboBox.ResetText();
                    policeCategoryComboBox.ResetText();
                    policeCoastNumericUpDown.ResetText();
                    policeAmountNumericUpDown.ResetText();
                    startDateDateTimePicker.ResetText();
                    endDateDateTimePicker.ResetText();

                    label1.Text = "Полис успешно зарегистрирован.";
                }
                if (result == false)
                {
                    label1.Text = "Не удалось зарегистрировать полис.";
                }
            }
        }
Exemplo n.º 11
0
 public void legpeople_UpdateItem([QueryString("legPersonID")] int leg_personID)
 {
     using (ContragentContext db = new ContragentContext())
     {
         LegalPerson item = null;
         item = db.LegalPeople.Find(leg_personID);
         if (item == null)
         {
             ModelState.AddModelError("",
                                      String.Format("Item with id {0} was not found", leg_personID));
             return;
         }
         item.UpdateDate = new DateTimeOffset(DateTime.Now);
         TryUpdateModel(item);
         if (ModelState.IsValid)
         {
             db.SaveChanges();
         }
     }
     Response.Redirect("~/LegalsList");
 }
        public async Task Update(LegalPersonDto dto)
        {
            LegalPerson person = await _legalPersonRepository.GetById(dto.Id);

            UpdateLegalPerson(dto, person);

            await _updateAddressService.Update(person.AddressId, dto.Address);

            await _updateDocumentService.Update(person.DocumentId, dto.Document);

            if (!person.Validate())
            {
                NotifyDomainValidations(person.ValidationResult);
            }

            if (!_notifier.HasNotification())
            {
                _legalPersonRepository.Update(person);
                await _unitOfWork.Commit();
            }
        }
Exemplo n.º 13
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,InstallerUserName,CompanyName,NameCEO,EmailAddress,PhoneNumber,City,State,Address,PostalCode,RegistrationNumber,EconomicCode,RecipientName,InstallationLocation,GasometerType,GasometerNumber,PersonNumber,Attachment")] LegalPerson legalPerson)
        {
            if (id != legalPerson.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await UnitOfWork.LegalPersonRepository.UpdateAsync(legalPerson);

                    await UnitOfWork.SaveAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LegalPersonExists(legalPerson.LegalPersonId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }

                return(RedirectToAction(nameof(Index)));
            }

            var cities     = UnitOfWork.CityRepository.GetAll();
            var states     = UnitOfWork.StateRepository.GetAll();
            var installers = UnitOfWork.InstallerRepository.GetAll();

            ViewData["Cities"]            = new SelectList(cities, "CityName", "CityName", legalPerson.City);
            ViewData["States"]            = new SelectList(states, "StateName", "StateName", legalPerson.State);
            ViewData["InstallerUserName"] = new SelectList(installers, "InstallerUserName", "InstallerUserName", legalPerson.InstallerUserName);

            return(View(legalPerson));
        }
Exemplo n.º 14
0
 public static void ValidateIssuer(LegalPerson expect, LegalPerson actual)
 {
     Assert.NotNull(expect);
     Assert.NotNull(actual);
     Assert.Equal(expect.Email, actual.Email);
     Assert.Equal(expect.FederalTaxNumber, actual.FederalTaxNumber);
     Assert.Equal(expect.MunicipalTaxNumber, actual.MunicipalTaxNumber);
     Assert.Equal(expect.Name, actual.Name);
     Assert.Equal(expect.Type, actual.Type);
     Assert.Equal(expect.Address.AdditionalInformation, actual.Address.AdditionalInformation);
     Assert.Equal(expect.Address.City.Code, actual.Address.City.Code);
     Assert.Equal(expect.Address.City.Name, actual.Address.City.Name);
     Assert.Equal(expect.Address.Country, actual.Address.Country);
     Assert.Equal(expect.Address.District, actual.Address.District);
     Assert.Equal(expect.Address.Number, actual.Address.Number);
     Assert.Equal(expect.Address.PostalCode, actual.Address.PostalCode);
     Assert.Equal(expect.Address.State, actual.Address.State);
     Assert.Equal(expect.Address.Street, actual.Address.Street);
     Assert.Equal(expect.SpecialTaxRegime, actual.SpecialTaxRegime);
     Assert.Equal(expect.TaxRegime, actual.TaxRegime);
     Assert.Equal(expect.TradeName, actual.TradeName);
 }
Exemplo n.º 15
0
        private ApplicationDetailsViewModel GetApplicationDetails(CreditApplication creditApplication)
        {
            ApplicationDetailsViewModel applicationDetailsModel = new ApplicationDetailsViewModel();

            if (creditApplication.Client.ClientGroup == ClientGroup.PrivatePerson)
            {
                LegalPerson client = unitOfWork.GetRepository <LegalPerson>().GetById(creditApplication.ClientId);
                applicationDetailsModel.ClientName = client.FirstName + " " + client.LastName;
            }
            else
            {
                applicationDetailsModel.ClientName = unitOfWork.GetRepository <JuridicalPerson>().GetById(creditApplication.ClientId).Name;
            }
            AutoMapper.Mapper.Map(creditApplication, applicationDetailsModel);
            var contract = applicationDetailsModel.Attachments.FirstOrDefault(x => x.IsContract);

            if (contract != null)
            {
                applicationDetailsModel.Attachments.Remove(contract);
                applicationDetailsModel.Contract = contract;
            }
            return(applicationDetailsModel);
        }
Exemplo n.º 16
0
        public void Save(LegalPerson legalPerson)
        {
            var _LegalPersons = (List <LegalPerson>)cache.Get(dbName);

            if (_LegalPersons == null)
            {
                _LegalPersons = new List <LegalPerson>();
            }

            if (legalPerson.Id > 0)
            {
                var legalPersonModif = _LegalPersons.FirstOrDefault(x => x.Id == legalPerson.Id);
                _LegalPersons.Remove(legalPersonModif);
            }
            else
            {
                legalPerson.Id = GetNextId();
            }

            _LegalPersons.Add(legalPerson);

            cache.Add(dbName, _LegalPersons, null);
        }
Exemplo n.º 17
0
        public async Task <IActionResult> Create([Bind("LegalPersonId,InstallerUserName,CompanyName,NameCEO,EmailAddress,PhoneNumber,City,State,Address,PostalCode,RegistrationNumber,EconomicCode,RecipientName,InstallationLocation,GasometerType,GasometerNumber,PersonNumber,Attachment")] LegalPerson legalPerson)
        {
            if (ModelState.IsValid)
            {
                legalPerson.LegalPersonId   = Guid.NewGuid();
                legalPerson.UserLegalPerson = true;
                await UnitOfWork.LegalPersonRepository.InsertAsync(legalPerson);

                await UnitOfWork.SaveAsync();

                return(RedirectToAction(nameof(Index)));
            }

            var cities     = UnitOfWork.CityRepository.GetAll();
            var states     = UnitOfWork.StateRepository.GetAll();
            var installers = UnitOfWork.InstallerRepository.GetAll();

            ViewData["Cities"]            = new SelectList(cities, "CityName", "CityName", legalPerson.City);
            ViewData["States"]            = new SelectList(states, "StateName", "StateName", legalPerson.State);
            ViewData["InstallerUserName"] = new SelectList(installers, "InstallerUserName", "InstallerUserName", legalPerson.InstallerUserName);

            return(View(legalPerson));
        }
Exemplo n.º 18
0
        static void Main9()
        {
            var murilo = new PhysicalPerson
            {
                Name = "Murilo",
                CPF  = 11233433.ToString()
            };

            var caelum = new LegalPerson
            {
                Name = "Murilo",
                CNPJ = 11233433.ToString()
            };

            var _session = NHibernateHelper.OpenSession();
            var userDAO  = new UserDAO(_session);

            userDAO.Add(murilo);
            userDAO.Add(caelum);

            _session.Close();
            Console.Read();
        }
Exemplo n.º 19
0
 public Task <Result <LegalPerson> > PutAsync(string company_id, LegalPerson item, CancellationToken cancellationToken = default(CancellationToken))
 {
     throw new NotImplementedException();
 }
Exemplo n.º 20
0
        public void Add_Valid_Person_Without_Address()
        {
            var person = new LegalPerson("Varig", "Varig do Brasil", "03.309.337/0001-73");

            Assert.True(person.CompanyName == "Varig");
        }
Exemplo n.º 21
0
        public void Add_Valid_IdDocument()
        {
            var person = new LegalPerson("Varig", "Varig do Brasil", "03.309.337/0001-73");

            Assert.True(person.IdDocument == "03.309.337/0001-73");
        }
Exemplo n.º 22
0
 public bool InsertOrUpdate(LegalPerson LegalPerson)
 {
     return(_epr.InsertOrUpdate(LegalPerson));
 }
Exemplo n.º 23
0
 public async Task RegisterLegalPersonAsync(LegalPerson legalPerson)
 {
     await RemoteAdminService.RegisterLegalPersonAsync(legalPerson.GetLegalPersonDC());
 }
Exemplo n.º 24
0
 public void Delete(LegalPerson person)
 {
     _context.LegalPeople.Remove(person);
 }
Exemplo n.º 25
0
        private void btnFind_Click(object sender, EventArgs e)
        {
            string doc   = txtDocFind.Text,
                   Error = string.Empty;

            if (doc.Length == 11)//TAMANHO DO CPF
            {
                if (NaturalPerson.VerifyCPF(doc))
                {
                    isCPF = true;
                    if (NaturalPersonBLL.HasCPF(doc))
                    {
                        var person = NaturalPersonBLL.GetUserByCPF(doc);

                        txtName.Text = person.Nome;
                        txtDoc.Text  = person.CPF;
                        txtPass.Text = txtConfirmPass.Text = txtGeneratedPass.Text = string.Empty;

                        btnChangePass.Enabled = true;
                    }
                    else
                    {
                        Error += "CPF não encontrado na base de dados.";
                    }
                }
                else
                {
                    Error += "CPF Inválido.";
                }
            }
            else
            {
                if (doc.Length == 14)//TAMANHO DO CNPJ
                {
                    if (LegalPerson.VerifyCNPJ(doc))
                    {
                        isCPF = false;
                        if (LegalPersonBLL.HasCNPJ(doc))
                        {
                            var person = LegalPersonBLL.GetUserByCNPJ(doc);

                            txtName.Text = person.NomeFantasia;
                            txtDoc.Text  = person.CNPJ;
                            txtPass.Text = txtConfirmPass.Text = txtGeneratedPass.Text = string.Empty;

                            btnChangePass.Enabled = true;
                        }
                        else
                        {
                            Error += "CNPJ não encontrado na base de dados.";
                        }
                    }
                    else
                    {
                        Error += "CNPJ Inválido.";
                    }
                }
                else
                {
                    //NÃO É NEM CPF NEM CNPJ
                    Error += "Não é um CPF ou CNPJ válido.";
                }
            }

            if (!(string.IsNullOrEmpty(Error)) && !(string.IsNullOrWhiteSpace(Error)))
            {
                MessageBox.Show(Error);
            }
        }
Exemplo n.º 26
0
 public async Task RegisterLegalPersonAsync(LegalPerson legalPerson, string password)
 {
     await _developerService.RegisterLegalPersonAsync(legalPerson.ToLegalPersonDataContract(), password);
 }
        public void Seed(WindowsStoreContext context)
        {
            #region Platform
            var platform1 = new Platform
            {
                PlatformCategory = PlatformCategory.Windows10Universal,
                Title            = "ویندوز 10، یونیورسال"
            };
            var platform2 = new Platform
            {
                PlatformCategory = PlatformCategory.Windows10Desktop,
                Title            = "ویندوز 10، خانواده دسکتاپ"
            };
            var platform3 = new Platform
            {
                PlatformCategory = PlatformCategory.Windows10Mobile,
                Title            = "ویندوز 10، خانواده موبایل"
            };
            var platform4 = new Platform
            {
                PlatformCategory = PlatformCategory.Windows10XBox,
                Title            = "ویندوز 10، خانواده XBox"
            };
            var platform5 = new Platform
            {
                PlatformCategory = PlatformCategory.Windows10Iot,
                Title            = "ویندوز 10، خانواده IOT"
            };
            var platform6 = new Platform
            {
                PlatformCategory = PlatformCategory.Windows10HoloLens,
                Title            = "ویندوز 10، خانواده HoloLens"
            };

            context.Platforms.AddRange(
                new Platform[] { platform1, platform2, platform3, platform4, platform5, platform6 });

            #endregion

            #region AppCategory
            var appCategory1 = new AppCategory {
                AppType = AppType.Application, Title = "کسب و کار"
            };
            var appCategory2 = new AppCategory {
                AppType = AppType.Application, Title = "توسعه نرم افزار"
            };
            var appCategory3 = new AppCategory {
                AppType = AppType.Application, Title = "غذا و آشپزی"
            };
            var appCategory4 = new AppCategory {
                AppType = AppType.Application, Title = "خانواده"
            };
            var appCategory5 = new AppCategory {
                AppType = AppType.Application, Title = "سبک زندگی"
            };
            var appCategory6 = new AppCategory {
                AppType = AppType.Application, Title = "موسیقی"
            };
            var appCategory7 = new AppCategory {
                AppType = AppType.Application, Title = "مسافرت-نقشه"
            };
            var appCategory8 = new AppCategory {
                AppType = AppType.Application, Title = "خبر-آب‌ و‌ هوا"
            };
            var appCategory9 = new AppCategory {
                AppType = AppType.Application, Title = "تصویر و ویدیو"
            };
            var appCategory10 = new AppCategory {
                AppType = AppType.Application, Title = "خرید"
            };
            var appCategory11 = new AppCategory {
                AppType = AppType.Application, Title = "ابزار"
            };
            var appCategory12 = new AppCategory {
                AppType = AppType.Application, Title = "کتاب‌ها و مراجع"
            };
            var appCategory13 = new AppCategory {
                AppType = AppType.Application, Title = "خرید"
            };
            var appCategory14 = new AppCategory {
                AppType = AppType.Application, Title = "اجتماعی"
            };
            var appCategory15 = new AppCategory {
                AppType = AppType.Application, Title = "ورزش"
            };
            var appCategory16 = new AppCategory {
                AppType = AppType.Application, Title = "ابزار"
            };
            var appCategory17 = new AppCategory {
                AppType = AppType.Game, Title = "اکشن"
            };
            var appCategory18 = new AppCategory {
                AppType = AppType.Game, Title = "کارت و تخته"
            };
            var appCategory19 = new AppCategory {
                AppType = AppType.Game, Title = "آموزشی"
            };
            var appCategory20 = new AppCategory {
                AppType = AppType.Game, Title = "پلتفرمر"
            };
            var appCategory21 = new AppCategory {
                AppType = AppType.Game, Title = "معمایی"
            };
            var appCategory22 = new AppCategory {
                AppType = AppType.Game, Title = "پرواز"
            };
            var appCategory23 = new AppCategory {
                AppType = AppType.Game, Title = "تیراندازی"
            };
            var appCategory24 = new AppCategory {
                AppType = AppType.Game, Title = "شبیه‌سازی"
            };
            var appCategory25 = new AppCategory {
                AppType = AppType.Game, Title = "استراتژی"
            };
            var appCategory26 = new AppCategory {
                AppType = AppType.Game, Title = "کلمات"
            };

            context.AppCategories.AddRange(new AppCategory[] {
                appCategory1, appCategory2, appCategory3, appCategory4, appCategory5,
                appCategory6, appCategory7, appCategory8, appCategory9, appCategory10,
                appCategory11, appCategory12, appCategory13, appCategory14, appCategory15,
                appCategory16, appCategory17, appCategory18, appCategory19, appCategory20,
                appCategory21, appCategory22, appCategory23, appCategory24, appCategory25,
                appCategory26
            }
                                           );
            #endregion

            #region Role
            var AdminRole = new Role {
                Title = "Admin", Name = "Admin"
            };
            var developerRole = new Role {
                Title = "Developer", Name = "Developer"
            };
            context.Roles.AddRange(new Role[] { AdminRole, developerRole });
            #endregion

            #region LegalPerson
            var paasteelCompany = new LegalPerson
            {
                PrimaryEmail = "*****@*****.**",
                Name         = "پاستیل",
                Membership   = new Membership
                {
                    CreateDate = DateTime.Now,
                    FailedPasswordAttemptCount = 0,
                    IsApproved                   = true,
                    IsIdentityVerified           = true,
                    IsLockedOut                  = true,
                    Password                     = SecurityHelper.ComputeSha256Hash("12345"),
                    VerificationCodeLastSendDate = DateTime.Now,
                    VerificationCode             = 0
                }
            };

            var paasteelAppProvider = new LegalPerson
            {
                PrimaryEmail = "*****@*****.**",
                Name         = "(گرد آورنده: پاستیل)",
                Membership   = new Membership
                {
                    CreateDate = DateTime.Now,
                    FailedPasswordAttemptCount = 0,
                    IsApproved                   = true,
                    IsIdentityVerified           = true,
                    IsLockedOut                  = true,
                    Password                     = SecurityHelper.ComputeSha256Hash("12345"),
                    VerificationCodeLastSendDate = DateTime.Now,
                    VerificationCode             = 0
                }
            };
            context.LegalPeople.AddRange(new LegalPerson[] { paasteelCompany, paasteelAppProvider });
            #endregion

            #region Natural Person
            var mehrdad = new NaturalPerson
            {
                PrimaryEmail = "*****@*****.**",
                FirstName    = "مهرداد",
                LastName     = "تاجدینی",
                Age          = 29,
                Sexuality    = Sexuality.Male,
                Membership   = new Membership
                {
                    CreateDate = DateTime.Now,
                    FailedPasswordAttemptCount = 0,
                    IsApproved                   = true,
                    IsIdentityVerified           = true,
                    IsLockedOut                  = true,
                    Password                     = SecurityHelper.ComputeSha256Hash("12345"),
                    VerificationCodeLastSendDate = DateTime.Now,
                    VerificationCode             = 0
                }
            };
            mehrdad.Roles.Add(AdminRole);
            mehrdad.Roles.Add(developerRole);

            var vahid = new NaturalPerson
            {
                PrimaryEmail = "*****@*****.**",
                FirstName    = "وحید",
                LastName     = "انصاری",
                Age          = 29,
                Sexuality    = Sexuality.Male,
                Membership   = new Membership
                {
                    CreateDate = DateTime.Now,
                    FailedPasswordAttemptCount = 0,
                    IsApproved                   = true,
                    IsIdentityVerified           = true,
                    IsLockedOut                  = true,
                    Password                     = SecurityHelper.ComputeSha256Hash("12345"),
                    VerificationCodeLastSendDate = DateTime.Now,
                    VerificationCode             = 0
                }
            };
            vahid.Roles.Add(AdminRole);
            vahid.Roles.Add(developerRole);

            context.NaturalPeople.AddRange(new NaturalPerson[] { mehrdad, vahid });
            #endregion

            #region App
            var paasteelApp = new App
            {
                Guid                 = Guid.Empty,
                Developer            = paasteelCompany,
                Name                 = "پاستیل",
                Description          = "پاستیل",
                Icon128X128          = new byte[1],
                Icon256X256          = new byte[1],
                AppCategory          = appCategory16,
                State                = AppState.Unpublished,
                CpuArchitectureFlags = CpuArchitecture.Arm,
            };
            paasteelApp.Platforms.Add(platform1);
            paasteelApp.AppVersions.Add(new AppVersion()
            {
                Downloads   = 0,
                PublishDate = DateTime.Now,
                Description = "پاستیل",
                Version     = "1.0.0.0",
                Size        = 0
            });
            context.Apps.Add(paasteelApp);
            #endregion

            context.SaveChanges();
        }
Exemplo n.º 28
0
 public void Add(LegalPerson person)
 {
     _context.LegalPeople.Add(person);
 }
Exemplo n.º 29
0
 public void Update(LegalPerson person)
 {
     _context.LegalPeople.Update(person);
 }
Exemplo n.º 30
0
        private void btnChangePass_Click(object sender, EventArgs e)
        {
            List <TextVerifyDTO> textVerify = new List <TextVerifyDTO>();

            string Error = string.Empty;

            if (isCPF)
            {
                var user = new NaturalPerson
                           (
                    txtDoc.Text,
                    txtPass.Text
                           );

                textVerify.Add(new TextVerifyDTO(user.Senha, "Senha", 5, 10));

                foreach (string erro in TelaDeCadastro.NullOrEmpty(textVerify))
                {
                    Error += erro + "\n";
                }

                if (txtPass.Text.Length >= 5 && txtPass.Text != txtConfirmPass.Text)
                {
                    Error += "A senha confirmada está divergente da digitada no campo 'Senha'.\n";
                }

                if (string.IsNullOrEmpty(Error) || string.IsNullOrWhiteSpace(Error))
                {
                    if (NaturalPersonBLL.UpdatePass(user))
                    {
                        MessageBox.Show("A senha foi alterada com sucesso.", "Senha Alterada");
                        btnClean_Click(sender, e);
                    }
                    else
                    {
                        MessageBox.Show("Ocorreu um erro e a senha não foi alterada. Entrar em contato com o Administrador caso o erro persista.", "Senha não alterada");
                        btnClean_Click(sender, e);
                    }
                }
                else
                {
                    MessageBox.Show(Error);
                }
            }
            else
            {
                var user = new LegalPerson
                           (
                    txtDoc.Text,
                    txtPass.Text
                           );

                textVerify.Add(new TextVerifyDTO(user.Senha, "Senha", 5, 10));

                foreach (string erro in TelaDeCadastro.NullOrEmpty(textVerify))
                {
                    Error += erro + "\n";
                }

                if (txtPass.Text.Length >= 5 && txtPass.Text != txtConfirmPass.Text)
                {
                    Error += "A senha confirmada está divergente da digitada no campo 'Senha'.\n";
                }

                if (string.IsNullOrEmpty(Error) || string.IsNullOrWhiteSpace(Error))
                {
                    if (LegalPersonBLL.UpdatePass(user))
                    {
                        MessageBox.Show("A senha foi alterada com sucesso.", "Senha Alterada");
                        btnClean_Click(sender, e);
                    }
                    else
                    {
                        MessageBox.Show("Ocorreu um erro e a senha não foi alterada. Entrar em contato com o Administrador caso o erro persista.", "Senha não alterada");
                        btnClean_Click(sender, e);
                    }
                }
                else
                {
                    MessageBox.Show(Error);
                }
            }
        }
        public ActionResult PostLegalPerson(LegalPerson person)
        {
            if (person != null)
            {
                Run("PersonController.PostLegalPerson(id)",
                    () =>
                    {
                        LegalPerson.AddOrUpdate(i => i.Id, person);

                        NotificationViewModel.AddToCookie("Processo finalizado com sucesso!", "Sucesso!", 10000, NotificationIconType.Success);
                    }, person.Id);

                return RedirectToRoute("Person", new { id = person.Id });
            }
            else
            {
                NotificationViewModel.AddToCookie("Ocorreu um problema ao salvar o registro!", iconType: NotificationIconType.Error);
            }

            return RedirectToRoute("Error", new { RedirectUrl = string.Format("~/cadastro/pessoa") });
        }
Exemplo n.º 32
0
 public CompanyClientDeleteAsyncTests()
 {
     _companyReturn = File.ReadAllText(@"..\..\..\..\UnitTests\FileToTest\company-return-example.json");
     _company       = GenerateObjectToTest.Company();
 }
Exemplo n.º 33
0
 public async Task UpdateNaturalPersonAsync(LegalPerson legalPerson)
 {
     await RemoteAdminService.UpdateLegalPersonAsync(legalPerson.GetLegalPersonDC());
 }
 private void UpdateLegalPerson(LegalPersonDto dto, LegalPerson person)
 {
     person.UpdateCompanyName(dto.CompanyName);
     person.UpdateTradeName(dto.TradeName);
 }