Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBox1.Text.Trim() != "")
                {
                    var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                    var conn   = (ConnectionStringsSection)config.GetSection("connectionStrings");
                    conn.ConnectionStrings["ConectionSellerPro"].ConnectionString = "Data Source=" + textBox1.Text + ";Initial Catalog=DBSellerPro;Persist Security Info=True;User ID=sa;Password=sa";
                    config.Save();
                    ConfigurationManager.RefreshSection("connectionStrings");

                    SystemInfoCurrent.initialize();
                    new FrmLogin().Show();
                    Hide();
                }
                else
                {
                    MessageBox.Show("Prencha o campo");
                }
            }
            catch (Exception r)
            {
                MessageBox.Show("error: " + r.Message);
            }
        }
Exemplo n.º 2
0
        private void bunifuThinButton24_Click(object sender, EventArgs e)
        {
            if (txtUser.Text.Trim() != "" && !hint)
            {
                if (txtPassword.Text.Trim() != "" && !hint2)
                {
                    System.Configuration.Configuration c = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None);
                    User us;
                    try
                    {
                        if (UserCurrent.getCurrentUser() != null)
                        {
                            usController = new UserController();
                        }

                        us = usController.Logar(txtUser.Text, txtPassword.Text);
                        if (us != null)
                        {
                            SystemInfoCurrent.initialize();

                            UserCurrent.initialize(us);
                            if (us.FlagFirstLogin)
                            {
                                new FrmUserFirstLogin(us, this).Show();
                            }
                            else
                            {
                                new Main(this).Show();
                            }
                            txtUser.Focus();
                            txtUser.Select(0, 0);
                            Hide();
                            txtPassword.Clear();
                            txtUser.Clear();
                        }
                        else
                        {
                            MessageBox.Show("usuario ou senha incorrestos,\n TRY AGAIN");
                            txtPassword.Clear();
                            txtUser.Clear();
                            txtUser.Focus();
                        }
                    }
                    catch (Exception error)
                    {
                        MessageBox.Show(error.Message);
                        us = null;
                    }
                }
                else
                {
                    MessageBox.Show("Insira a senha");
                    txtPassword.Focus();
                }
            }
            else
            {
                MessageBox.Show("Insira o usuario");
            }
        }
Exemplo n.º 3
0
        public SplashNew()
        {
            InitializeComponent();

            try
            {
                /*
                 * string path = Application.StartupPath + @"/config.json";
                 * var json = new JavaScriptSerializer();
                 * StreamReader reader = new StreamReader(path);
                 * string jsons = "";
                 * string server = "";
                 * while (!reader.EndOfStream)
                 * {
                 *  jsons += reader.ReadLine().ToString();
                 *
                 * }
                 * dynamic datas = json.DeserializeObject(jsons);
                 * reader.Dispose();
                 *
                 * foreach (KeyValuePair<string, object> item in datas)
                 * {
                 *  server = item.Value as string;
                 * }
                 */
                string server = Environment.MachineName;
                var    config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                var    conn   = (ConnectionStringsSection)config.GetSection("connectionStrings");
                conn.ConnectionStrings["ConectionSellerPro"].ConnectionString = "Data Source=" + server + ";Initial Catalog=DBSellerPro;Persist Security Info=True;User ID=sa;Password=sa";
                config.Save();
                ConfigurationManager.RefreshSection("connectionStrings");
                SystemInfoCurrent.initialize();
                ///   FrmLogin frLogin = new FrmLogin();
                // frLogin.Show();

                this.Hide();
            }
            catch (System.ObjectDisposedException error)
            {
                Visible = false;

                MessageBox.Show("erro na conexão com o banco de dados, verifica se o servidor está correcto");
            }
            catch (Exception r)
            {
                Visible = false;

                MessageBox.Show("Erro: Entre em contacto com o suporte - " + r.Message);
            }
            finally
            {
            }


            labelCopyright.Text = "Copyright © 2020-" + DateTime.Now.Year.ToString();
        }
Exemplo n.º 4
0
        public void initDate(Turno t)
        {
            lblValor.Text    = t.Caixa.ToString();;
            lblUser.Text     = UserCurrent.getCurrentUser().Nome;
            lblDataHora.Text = t.Data.ToString();
            string rootPath = Application.StartupPath;

            Company company = SystemInfoCurrent.getCurrentCompany();

            xrlblCompany.Text = company.Empresa;
            xrlblNif.Text     = "NIF: " + company.Nif;
            xrlblTel.Text     = "Telefone: " + company.Tel;
        }
Exemplo n.º 5
0
        public Cabecalho()
        {
            InitializeComponent();

            Company company = SystemInfoCurrent.getCurrentCompany();

            DataCompany.DataSource = company;
            string urlLogo = Application.StartupPath + company.UrlLogo;

            if (File.Exists(urlLogo))
            {
                xrPictureBox2.ImageUrl = urlLogo;
            }
        }
Exemplo n.º 6
0
        public void load()
        {
            try
            {
                string       path   = Application.StartupPath + @"/config.json";
                var          json   = new JavaScriptSerializer();
                StreamReader reader = new StreamReader(path);
                string       jsons  = "";
                string       server = "";
                while (!reader.EndOfStream)
                {
                    jsons += reader.ReadLine().ToString();
                }
                dynamic datas = json.DeserializeObject(jsons);
                reader.Dispose();

                foreach (KeyValuePair <string, object> item in datas)
                {
                    server = item.Value as string;
                }
                var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                var conn   = (ConnectionStringsSection)config.GetSection("connectionStrings");
                conn.ConnectionStrings["ConectionSellerPro"].ConnectionString = "Data Source=" + server + ";Initial Catalog=DBSellerPro;Persist Security Info=True;User ID=sa;Password=sa";
                config.Save();
                ConfigurationManager.RefreshSection("connectionStrings");
                SystemInfoCurrent.initialize();
            }
            catch (System.ObjectDisposedException er)
            {
                MessageBox.Show("erro na conexão com o banco de dados,Feche e abre aplicação");
                error = true;
            }catch (System.Data.SqlClient.SqlException rr)
            {
                MessageBox.Show("erro");
                error = true;
            }
            catch (Exception r)
            {
                MessageBox.Show("Erro: Entre em contacto com o suporte - " + r.Message);
                error = true;
            }
            finally
            {
                finished = true;
            }
        }
Exemplo n.º 7
0
        public void initData(Invoice invoiceData)
        {
            string rootPath = Application.StartupPath;

            Company company = SystemInfoCurrent.getCurrentCompany();

            invoiceDataSource.DataSource = invoiceData;
            xrlblCompany.Text            = company.Empresa;
            xrlblNif.Text      = "NIF: " + company.Nif;
            xrlblTel.Text      = "Telefone: " + company.Tel;
            xrlblAddress.Text += company.Endereco;

            if (File.Exists(rootPath + company.UrlLogo))
            {
                xrPictureLogo.ImageUrl = rootPath + company.UrlLogo;
            }



            // xrlblSite.Text = company.UrlSite;
            xrlblSite.Text = "Software de gestão desenvolvido e assistido pela Fenitech Soluctions, " + SystemInfoCurrent.SystemInfo.UrlSite;
        }
Exemplo n.º 8
0
        public void save()
        {
            _companyController = new CompanyController();
            if (!haveEmptyField())
            {
                Company company = new Company()
                {
                    Id          = cp.Id,
                    Empresa     = txtNome.Text,
                    Nif         = TxtNIF.Text,
                    CompanyID   = txtComercialNumber.Text == string.Empty ? "NA" : txtComercialNumber.Text,
                    Email       = txtEmail.Text,
                    Endereco    = txtAddress.Text,
                    Tel         = txtTel.Text,
                    Tel1        = txtTel2.Text,
                    Fax         = txtFax1.Text,
                    Fax2        = txtFax2.Text,
                    UrlSite     = txtSite.Text,
                    ContaBanco1 = txtContaBanco1.Text,
                    ContaBanco2 = txtContaBanco2.Text,

                    CidadeId      = _cityController.ListALL()[cmbCity.SelectedIndex].Id,
                    CompanyTypeId = _companyTypeController.ListALL()[cmbEmpresa.SelectedIndex].Id,
                    UrlLogo       = @"\Logo\logo.png",
                };

                _companyController.update(company);
                SystemInfoCurrent.setCurrentCompany(company);
                Focus();
                panel1.Enabled = false;
                Focus();
            }
            else
            {
                MessageBox.Show("Preencha todos os campos obrigatórios");
            }
        }