Ejemplo n.º 1
0
        private void FrmSetupInvoiceNotes_Load(object sender, EventArgs e)
        {
            Services.get_GUI get_GUI = new get_GUI();
            DataTable a =  get_GUI.GetSetupByStore(StaticClass.storeId);
            for (var i = 1; i < 10; i++)
            {
                this.tabControl1.TabPages[1].Controls["cretextbox" + i].Text = a.Rows[0][24+i].ToString();
            }
            textBox1.Text = a.Rows[0][34].ToString();
            try
            {
                byte[] barrImg = (byte[])a.Rows[0]["Logo"];
                string strfn = Convert.ToString(DateTime.Now.ToFileTime());
                FileStream fs = new FileStream(strfn, FileMode.CreateNew, FileAccess.Write);
                fs.Write(barrImg, 0, barrImg.Length);
                fs.Flush();
                fs.Close();

                pictureBox1.Image = Image.FromFile(strfn);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);

            }
        }
Ejemplo n.º 2
0
        public void FrmLogin_Load(object sender, EventArgs e)
        {
            //OleDbConnection m_cnADONetConnection = new OleDbConnection();
            //OleDbDataAdapter m_daDataAdapter;
            //OleDbCommandBuilder m_cbCommandBuilder;
            //DataTable m_dtDict = new DataTable();

            //m_cnADONetConnection.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + System.Windows.Forms.Application.StartupPath + @"\ConfigDatabase.mdb";

            //m_cnADONetConnection.Open();
            //m_daDataAdapter = new OleDbDataAdapter("Select * From DatabaseInfo", m_cnADONetConnection);
            //m_cbCommandBuilder = new OleDbCommandBuilder(m_daDataAdapter);
            //m_daDataAdapter.Fill(m_dtDict);
            //if (m_dtDict.Rows.Count != 0)
            //{
            //    StaticClass.mode = m_dtDict.Rows[0]["Mode"].ToString();
            //    if (m_dtDict.Rows[0]["InstanceName"].ToString() == "" )
            //    {
            //        StaticClass.serverName = m_dtDict.Rows[0]["ServerName"].ToString();
            //    }
            //    else
            //    {
            //        StaticClass.serverName = m_dtDict.Rows[0]["ServerName"].ToString() + "\\" + m_dtDict.Rows[0]["InstanceName"].ToString();
            //    }
                
            //    StaticClass.databaseName = m_dtDict.Rows[0]["DatabaseName"].ToString();
            //    Services.get_GUI.serverName = StaticClass.serverName;
            //    Services.get_GUI.databaseName = StaticClass.databaseName;
               
            //}
           
            serviceGet = new ServiceGet();
            getGui = new get_GUI();

            label5.Text = "Máy : " + StaticClass.stationId;
            button45.changeColor(Color.White, Color.Red);
            button46.changeColor(Color.White,Color.FromArgb(0,150,0));
            button9.changeColor(Color.White, Color.Red);
            button7.changeColor(Color.White, Color.FromArgb(0, 150, 0));
            button13.changeColor(Color.White,Color.Gray);
            button24.changeColor(Color.White, Color.Yellow);
            button25.changeColor(Color.White, Color.Yellow);
            button26.changeColor(Color.White, Color.Yellow);
            button27.changeColor(Color.White, Color.Yellow);
            button28.changeColor(Color.White, Color.Yellow);
            button29.changeColor(Color.White, Color.Yellow);
            button30.changeColor(Color.White, Color.Yellow);
            button31.changeColor(Color.White, Color.Yellow);
            button32.changeColor(Color.White, Color.Yellow);
            button33.changeColor(Color.White, Color.Yellow);
            button34.changeColor(Color.White, Color.Yellow);
            button35.changeColor(Color.White, Color.Yellow);
            button36.changeColor(Color.White, Color.Yellow);
            button37.changeColor(Color.White, Color.Yellow);
            button38.changeColor(Color.White, Color.Yellow);
            button39.changeColor(Color.White, Color.Yellow);
            button40.changeColor(Color.White, Color.Yellow);
            button41.changeColor(Color.White, Color.Yellow);
            button42.changeColor(Color.White, Color.Yellow);
            button43.changeColor(Color.White, Color.Yellow);
            button44.changeColor(Color.White, Color.Yellow);
            button48.changeColor(Color.White, Color.Yellow);
            button49.changeColor(Color.White, Color.Yellow);
            button50.changeColor(Color.White, Color.Yellow);
            button51.changeColor(Color.White, Color.Yellow);
            button52.changeColor(Color.White, Color.Yellow);
            button53.changeColor(Color.White,Color.Orange);
            button54.changeColor(Color.White,Color.Yellow);
            button55.changeColor(Color.White,Color.OrangeRed);


            panel2.Visible = false;
            panel1.Visible = true;
            textBox1.Clear();
            textBox2.Clear();
            //bool focus = textBox1.Focus();
            //bool f = textBox1.Focused;
            this.textBox1.Focus();
            this.Refresh();

            DataTable setup =  getGui.GetSetupByStore(StaticClass.storeId);
            string path = setup.Rows[0]["Company_Info_5"].ToString();
            FileInfo fi = new FileInfo(path);
            if(path != ""&& fi.Exists)
            {
                pictureBox1.Image = Image.FromFile(path);
            }
            label3.Text = setup.Rows[0]["Invoice_Notes_10"].ToString();
            
        }
Ejemplo n.º 3
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            GetDatabaseInfo getDatabaseInfo = new GetDatabaseInfo();
            if (!getDatabaseInfo.isconfiged)
            {
                FrmDelete requestconn = new FrmDelete();
                requestconn.label1.Text =
                    "Chưa có kết nối database.\n Bạn có muốn chọn database không?";
                if (requestconn.ShowDialog() == DialogResult.OK)
                {
                    FrmConfigDatabase frmConfigDatabase = new FrmConfigDatabase();
                    frmConfigDatabase.ShowDialog();
                }
            }
            else
            {
                
                
                
                if (DAO.DataProvider.TestConnection(getDatabaseInfo.mode, getDatabaseInfo.serverName,
                                                getDatabaseInfo.databaseName, getDatabaseInfo.user, getDatabaseInfo.pass))
                {
                    Services.get_GUI.serverName = getDatabaseInfo.serverName;
                    Services.get_GUI.databaseName = getDatabaseInfo.databaseName;
                    Services.get_GUI.Mode = getDatabaseInfo.mode;
                    Services.get_GUI.UserName = getDatabaseInfo.user;
                    Services.get_GUI.Password = getDatabaseInfo.pass;
                    Services.get_GUI getGUI = new get_GUI();
                    if (getGUI.GetSetupByStore(StaticClass.storeId) == null)
                    {
                        FrmDelete requestconn = new FrmDelete();
                        requestconn.label1.Text =
                        "Kết nối không thành công.\n Bạn có muốn chọn database không?";
                        if (requestconn.ShowDialog() == DialogResult.OK)
                        {
                            FrmConfigDatabase frmConfigDatabase = new FrmConfigDatabase();
                            frmConfigDatabase.ShowDialog();
                            return;
                        }

                    }
                    Lc.Check();
                    
                    if (StaticClass.version == Lc.Version.Demo)
                    {
                        
                        FrmRegisterInfo frmRegisterInfo;
                        int num = getGUI.GetNumOfInvoice();
                        if (num > 50)
                        {
                            frmRegisterInfo = new FrmRegisterInfo("Quá 100 hóa đơn.", false);
                            //frmRegisterInfo.ShowDialog();
                            Application.Run(frmRegisterInfo);
                            //if (MessBox2Choice.ShowBox("Quá 100 hóa đơn.\n Bạn có muốn đăng kí không?", Color.Red) == DialogResult.Yes)
                            //{
                            //    Application.Run(new FrmRegister());
                            //}
                        }
                        else
                        {
                            frmRegisterInfo = new FrmRegisterInfo("Bạn còn " + (100 - num).ToString() + " hóa đơn để thử\n với phiên bản Demo", true);
                            //frmRegisterInfo.ShowDialog();
                            frmRegisterInfo.ShowDialog();
                            //Alert.Show("Bạn còn " + (100 - num).ToString()+" hóa đơn để thử\n với phiên bản Demo");
                            Application.Run(new FrmLogin());
                        }
                    }
                    else
                    {
                        Application.Run(new FrmLogin());
                        //Application.Run(new FrmGeneralSetup());
                    }
                }
                else
                {
                    FrmDelete requestconn = new FrmDelete();
                    requestconn.label1.Text =
                    "Kết nối không thành công.\n Bạn có muốn chọn database không?";
                    if (requestconn.ShowDialog() == DialogResult.OK)
                    {
                        FrmConfigDatabase frmConfigDatabase = new FrmConfigDatabase();
                        frmConfigDatabase.ShowDialog();
                    }
                }

            }
            //Application.Run(new FrmCustomer());
        }