예제 #1
0
        void login()
        {
            if (checkbOnline.Checked)
            {
                DangNhapBUS.DANGNHAP("den1.mssql8.gear.host", "nv1");
            }
            else
            {
                DangNhapBUS.DANGNHAP(cmbServerIP.Text, cmbDatabase.Text);
            }

            if (DangNhapBUS.Instance.KiemTraUser(txtMaNhanVien.Text, txtMatKhau.Text))
            {
                IdNhanVien = txtMaNhanVien.Text;
                IdChucDanh = DangNhapBUS.Instance.IdChucDanh(IdNhanVien);
                Form f = new MainGUI();
                //Xử lý khi đóng form con thì sẽ chạy event show lại form này
                f.FormClosed   += F_FormClosed;
                f.StartPosition = FormStartPosition.CenterScreen;
                f.Show();
                this.Hide();
                txtMaNhanVien.Text = "";
                txtMatKhau.Text    = "";
            }
            else
            {
                MessageBox.Show("Mã nhân viên hoặc mật khẩu không đúng!!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
예제 #2
0
        private void bntDangNhap_Click(object sender, EventArgs e)
        {
            //Kiểm tra tài khoản hoặc mật khẩu để trống.
            if (String.IsNullOrEmpty(txtTaiKhoan.Text) || String.IsNullOrEmpty(txtMatKhau.Text))
            {
                MessageBox.Show("Nhập tên tài khoản và mật khẩu.");
                txtTaiKhoan.Focus();
                return;
            }
            //Lấy ra CanBoGiaoVien theo tên tài khoản và mật khẩu. nêu == null là sai tên tài khoản hoặc mật khẩu.
            CanBoGiaoVien user = dangNhapBUS.DangNhap(txtTaiKhoan.Text, txtMatKhau.Text);

            if (user == null)
            {
                MessageBox.Show("Sai tên tài khoản hoặc mật khẩu.");
                txtTaiKhoan.Focus();
                return;
            }
            //Xóa dữ liệu.
            txtTaiKhoan.Clear();
            txtMatKhau.Clear();
            //Mở form chính và ản form đăng nhâp.
            MainGUI main = new MainGUI(user);

            this.Hide();
            main.ShowDialog();
            //Sau khi đóng form main thì mở lại form đăng nhập.
            this.Show();
        }
예제 #3
0
 public AddTaskGUI(MainGUI mainGUI)
 {
     InitializeComponent();
     _mainGUI     = mainGUI;
     _validate    = new Validate();
     _taskService = new TaskService();
 }
예제 #4
0
        private void btnThongKe_Click(object sender, EventArgs e)
        {
            //Đổ dữ liệu vào report.
            this.dsGiaoVienLopTableAdapter.Fill(this.dsGiaoVienLopDataSet.dsGiaoVienLop, cmbLop.SelectedValue.ToString());
            //Lấy ra form main để tham chiếu đên user đã đăng nhập.
            MainGUI main = (MainGUI)this.MdiParent;

            this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] {
                new ReportParameter("TenLop", cmbLop.Text),
                new ReportParameter("NguoiLap", main.User.HoTen)
            });
            this.reportViewer1.RefreshReport();
        }
예제 #5
0
        private void btnThongKe_Click(object sender, EventArgs e)
        {
            //Đổ dữ liệu lên report.
            this.HoSoHocSinhTableAdapter.Fill(this.QLHocSinhDataSet.HoSoHocSinh, cmbLop.SelectedValue.ToString());
            //Lấy ra form main để tham chiếu đến user đã đăng nhập.
            MainGUI mainForm = (MainGUI)this.MdiParent;

            this.rpvTTHocSinh.LocalReport.SetParameters(new ReportParameter[] {
                new ReportParameter("TenLop", cmbLop.Text),
                new ReportParameter("NguoiLap", mainForm.User.HoTen)
            });
            this.rpvTTHocSinh.RefreshReport();
        }
 void login()
 {
     if (DangNhapBUS.Instance.KiemTraUser(txtMaNhanVien.Text, txtMatKhau.Text))
     {
         IdNhanVien = txtMaNhanVien.Text;
         IdChucDanh = DangNhapBUS.Instance.IdChucDanh(IdNhanVien);
         Form f = new MainGUI();
         //Xử lý khi đóng form con thì sẽ chạy event show lại form này
         f.FormClosed   += F_FormClosed;
         f.StartPosition = FormStartPosition.CenterScreen;
         f.Show();
         this.Hide();
         txtMaNhanVien.Text = "";
         txtMatKhau.Text    = "";
     }
     else
     {
         MessageBox.Show("Mã nhân viên hoặc mật khẩu không đúng!!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
예제 #7
0
 protected void checkLogin()
 {
     if (tbUsername.Text == "" || tbPassword.Text == "")
     {
         MessageBox.Show(this, "Vui lòng điền đầy đủ tài khoản và mật khẩu!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         DataSet ds = DBConnection_MySQL.getData("SELECT * FROM TAIKHOAN WHERE TAIKHOAN='"
                                                 + tbUsername.Text + "' AND MATKHAU='" + tbPassword.Text + "'");
         if (ds == null || ds.Tables[0].Rows.Count == 0)
         {
             MessageBox.Show(this, "Tài khoản hoặc mật khẩu không đúng!\n" + DBConnection_MySQL.ErrorString, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             this.Hide();
             var mainGUI = new MainGUI();
             mainGUI.Closed += (s, args) => this.Close();
             mainGUI.Show();
         }
     }
 }
 void login()
 {
     // Kiểm tra đăng nhập
     if (DangNhapBUS.KiemTraUser(dataSource(cboChiNhanh.SelectedIndex), txtMaNhanVien.Text, txtMatKhau.Text))
     {
         IdNhanVien    = txtMaNhanVien.Text;
         IdChucDanh    = idChucDanh(IdNhanVien);
         IndexChiNhanh = cboChiNhanh.SelectedIndex;
         Form f = new MainGUI();
         //Xử lý khi đóng form con thì sẽ chạy event show lại form này
         f.FormClosed   += F_FormClosed;
         f.StartPosition = FormStartPosition.CenterScreen;
         f.Show();
         this.Hide();
         txtMaNhanVien.Text = "";
         txtMatKhau.Text    = "";
     }
     else
     {
         MessageBox.Show("Mã nhân viên hoặc mật khẩu không đúng!!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         Application.Restart();
     }
 }
예제 #9
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            #region KURSORY i okno
            StaticHelpers.StaticHelper.DeviceManager = graphics;
            WindowController.window = (Form)Form.FromHandle(this.Window.Handle);
            MouseCursorController.LoadCustomCursor(@"Content/Cursors/TronNormal.ani");
            MouseCursorController.LoadCustomCursor(@"Content/Cursors/TronBusy.ani");
            MouseCursorController.LoadCustomCursor(@"Content/Cursors/TronAlternate.ani");
            MouseCursorController.LoadCustomCursor(@"Content/Cursors/gam1232.ani");

            MouseCursorController.stage = Controlers.CursorEnum.CursorStage.Normal;
            #endregion

            #region Light Shadow
            light = new LightsAndShadows.Light(0.7f, 0.4f, new Vector3(-2800, 4000, -2800));
            shadow = new LightsAndShadows.Shadow();
            LoadModelsFromFile._light = light;
            #endregion
            #region PresentationParameters
            PresentationParameters pp = graphics.GraphicsDevice.PresentationParameters;
            pp.DepthStencilFormat = DepthFormat.Depth24Stencil8;

            #endregion
            #region PointsForLaser
            pointsForLasers.Add(new List<PointInTime>());
            pointsForLasers[0].Add(new PointInTime(new Vector3(100, 40, 100), 0));
            pointsForLasers[0].Add(new PointInTime(new Vector3(1600, 40, 300), 20000));
            pointsForLasers[0].Add(new PointInTime(new Vector3(3000, 40, 260), 40000));
            pointsForLasers[0].Add(new PointInTime(new Vector3(1300, 40, 900), 60000));
            pointsForLasers[0].Add(new PointInTime(new Vector3(400, 40, 1500), 80000));
            pointsForLasers[0].Add(new PointInTime(new Vector3(1299, 40, 1900), 100000));
            pointsForLasers[0].Add(new PointInTime(new Vector3(100, 40, 3000), 120000));

            #endregion
            #region Curve
            curvesForLaser.Add(new Curve3D(pointsForLasers[0],CurveLoopType.Oscillate));
            #endregion
            #region Laser

            #endregion

            hiDefShadowEffect = Content.Load<Effect>("Effects/Shadows");
            animHiDefShadowEffect = Content.Load<Effect>("Effects/AnimatedShadow");
            device = GraphicsDevice;
            device.DepthStencilState = DepthStencilState.Default;
            shadow.RenderTarget = new RenderTarget2D(device, 4096, 4096, false, pp.BackBufferFormat, DepthFormat.Depth24Stencil8);

            spriteBatch = new SpriteBatch(GraphicsDevice);
            StaticHelpers.StaticHelper._spr_font = Content.Load<SpriteFont>("Fonts/FPS");// you have on your project

            StaticHelpers.StaticHelper.Content = Content;
            StaticHelpers.StaticHelper.Device = device;
            endGamePicture = Content.Load<Texture2D>("Textures/t³okoñcowe");
            #region Tekstury
            List<Texture2D> texture = new List<Texture2D>();
            //alphy do terenu
            texture.Add(Content.Load<Texture2D>("HeighMaps/texturemap_grass")); // alpha pomiedzy trawa 0 i trawa1
            texture.Add(Content.Load<Texture2D>("HeighMaps/texturemap_grass1")); // alpha pomiedzy 1 2
            texture.Add(Content.Load<Texture2D>("HeighMaps/texturemap_sand"));
            texture.Add(Content.Load<Texture2D>("HeighMaps/texturemap_forest_cover"));
            texture.Add(Content.Load<Texture2D>("HeighMaps/texturemap_stone")); // alpha pomiedzy 4 5
            texture.Add(Content.Load<Texture2D>("HeighMaps/texturemap_grass1")); // alpha pomiedzy 5 6
            texture.Add(Content.Load<Texture2D>("HeighMaps/texturemap_snow")); // alpha pomiedzy ciemne7 i jasne 8
            //0 - 6

            //tekstury terenu
            texture.Add(Content.Load<Texture2D>("Textures/Ground/grass0")); //
            texture.Add(Content.Load<Texture2D>("Textures/Ground/grass"));  // to mo¿na wyci¹æ
            texture.Add(Content.Load<Texture2D>("Textures/Ground/grass1")); // to mo¿na wyci¹æ
            texture.Add(Content.Load<Texture2D>("Textures/Ground/sand"));  //
            texture.Add(Content.Load<Texture2D>("Textures/Ground/forest_cover")); //
            texture.Add(Content.Load<Texture2D>("Textures/Ground/rock"));  //
            texture.Add(Content.Load<Texture2D>("Textures/Ground/dirt"));  // to mo¿na wyci¹æ
            texture.Add(Content.Load<Texture2D>("Textures/Ground/rock"));  // to mo¿na wyci¹æ
            //7 - 14
            //heighmapa terenu
            texture.Add(Content.Load<Texture2D>("HeighMaps/terrain"));
            //15
            //tekstura od zaznaczenia
            texture.Add(Content.Load<Texture2D>("Textures/select2"));
            //16
            //mapy rozmieszczenia obiektow i bilboardow (w zaleznosci ile czego bedzie to sobie pododajesz)
            texture.Add(Content.Load<Texture2D>("HeighMaps/grassMap"));
            texture.Add(Content.Load<Texture2D>("Textures/Bilboard/tree"));
            texture.Add(Content.Load<Texture2D>("HeighMaps/iguyMap"));
            texture.Add(Content.Load<Texture2D>("Textures/Bilboard/igua"));
            texture.Add(Content.Load<Texture2D>("HeighMaps/szuwaryMap"));
            texture.Add(Content.Load<Texture2D>("Textures/Bilboard/szuwary"));
            //17 - 22

            //mapy rozmieszczenia obiektow (w zaleznosci ile czego bedzie to sobie pododajesz)
            texture.Add(Content.Load<Texture2D>("HeighMaps/koamienMap"));
            texture.Add(Content.Load<Texture2D>("HeighMaps/trawaMap"));
            texture.Add(Content.Load<Texture2D>("HeighMaps/kzak1Map"));
            //23 - 25
            texture.Add(Content.Load<Texture2D>("Textures/circle"));
            #endregion

            camera = new FreeCamera(
            new Vector3(texture[4].Width * 1 / 2, texture[4].Width * 1 / 20, texture[4].Width * 1 / 2),
            MathHelper.ToRadians(0), // Turned around 153 degrees
            MathHelper.ToRadians(-45), // Pitched up 13 degrees
            GraphicsDevice);

            quadTree.Add(new QuadTree(Vector2.Zero, texture, device, 3, Content, (FreeCamera)camera));

            water = new Water(device, Content, texture[4].Width, 3);
            foreach (QuadTree q in quadTree)
            {
                q.Cull = true;
            }
            StaticHelpers.StaticHelper.heights = quadTree[0].Vertices.heightDataToControl;
            StaticHelpers.StaticHelper.width = (int)Math.Sqrt(quadTree[0].Vertices.heightDataToControl.Length);
            StaticHelpers.StaticHelper.length = (int)Math.Sqrt(quadTree[0].Vertices.heightDataToControl.Length);

            PathFinderManager.PathFinderManagerInitialize(128);

            #region loadFromFile

            Controlers.LoadModelsFromFile.Load();
            foreach (InteractiveModel i in LoadModelsFromFile.listOfAllInteractiveModelsFromFile)
            {

                // Console.WriteLine(models.GetType().BaseType.Name);
                if (i.GetType().BaseType == typeof(Building) || i.GetType().BaseType == typeof(Material) || i.GetType().BaseType == typeof(EnviroModels) || i.GetType().BaseType==typeof(AllieBuilding))
                {

                    IModel.Add(i);
                }
                else
                {
                    if (i.GetType() == typeof(Beetle))
                    {
                        ((Beetle)i).Ants = models;
                        ((Beetle)i).removeMyself();
                    }
                    else if (i.GetType() == typeof(Spider))
                    {
                        ((Spider)i).Ants = models;
                        ((Spider)i).removeMyself();

                    }
                    models.Add(i);
                }
            }
            #endregion
            PathFinderManager.blockAllNodes(IModel);
            //for (int i = 0; i < PathFinderManager.GridSize; i += 1)
            //{
            //    for (int J = 0; J < PathFinderManager.GridSize; J += 1)
            //    {
            //        if (PathFinderManager.tileList[i, J].walkable == false || PathFinderManager.tileList[i, J].haveMineral == true || PathFinderManager.tileList[i, J].haveBuilding == true)
            //        {
            //            inter.Add(new InteractiveModel(new LoadModel(Content.Load<Model>("Models/log2"),new Vector3(PathFinderManager.tileList[i,J].centerPosition.X,StaticHelpers.StaticHelper.GetHeightAt(PathFinderManager.tileList[i,J].centerPosition.X,PathFinderManager.tileList[i,J].centerPosition.Y),PathFinderManager.tileList[i,J].centerPosition.Y),Vector3.Zero,new Vector3(1f,0.3f,1f),device,light)));
            //        }
            //    }
            //}

            /////////////// nie wiem czy to powinno byæ czy nie wiêc zakomentowa³em tylko
            //
            //            mapR = new MapRender(texture[15], 3);
            //            Console.WriteLine(GraphicsDevice.Viewport.Bounds);

            //e.Ant = models[0];
            // e.Enemy = spider;
            //  e.Ants = Enemys;

            WindowController.setWindowSize(1366, 768, false);
            //models.Add(new AntPeasant(new LoadModel(StaticHelpers.StaticHelper.Content.Load<Model>("Models/mrowka_01"), Vector3.Zero, Vector3.Zero, new Vector3(0.3f), StaticHelpers.StaticHelper.Device, light)));
            // models.Add(new TownCenter(new LoadModel(StaticHelpers.StaticHelper.Content.Load<Model>("Models/domek"), Vector3.Zero, Vector3.Zero, new Vector3(0.23f), StaticHelpers.StaticHelper.Device, light)));
            ////models.Add(new Queen(new LoadModel(StaticHelpers.StaticHelper.Content.Load<Model>("Models/grasshopper"), new Vector3(300,40,300), Vector3.Zero, new Vector3(0.23f), StaticHelpers.StaticHelper.Device, StaticHelpers.StaticHelper.Content,light)));
            ////models[models.Count - 1].Model.switchAnimation("Idle");

            List<String> aa = new List<string>();
            aa.Add("s1");
            aa.Add("s2");
            aa.Add("Gater");
            SoundController.SoundController.content = Content;
            SoundController.SoundController.Initialize(aa);

            List<String> PlayList = new List<string>();
            PlayList.Add("Kwai");
            PlayList.Add("MarketGarden");
            PlayList.Add("Escape");
            SoundController.SoundController.InitializeBackground(PlayList);

            // models[models.Count - 1].Model.switchAnimation("Idle");

            // models.Add(new Cancer(new LoadModel(Content.Load<Model>("Models/crab"), new Vector3(0, 40, 0), new Vector3(0), new Vector3(0.4f), GraphicsDevice,  light), models));

              models.Add(new Cancer(new LoadModel(Content.Load<Model>("Models/crab"), new Vector3(1375, 40, 2500), new Vector3(0), new Vector3(0.4f), GraphicsDevice, Content, light), models));

              models[models.Count - 1].Model.switchAnimation("Idle");

             models.Add(new SunDew(new LoadModel(Content.Load<Model>("Models/rosiczka"), new Vector3(1574, 40, 2100), new Vector3(0), new Vector3(0.8f), GraphicsDevice, Content, light), models));
            models[models.Count - 1].Model.switchAnimation("Idle");
            models.Add(new SunDew(new LoadModel(Content.Load<Model>("Models/rosiczka"), new Vector3(2400, 40, 805), new Vector3(0), new Vector3(0.8f), GraphicsDevice, Content, light), models));
            models[models.Count - 1].Model.switchAnimation("Idle");
            models.Add(new SunDew(new LoadModel(Content.Load<Model>("Models/rosiczka"), new Vector3(1700, 40, 1111), new Vector3(0), new Vector3(0.8f), GraphicsDevice, Content, light), models));
            models[models.Count - 1].Model.switchAnimation("Idle");
            // models.Add(new Spider(new LoadModel(Content.Load<Model>("Models/spider"), new Vector3(250, 40, 250), new Vector3(0), new Vector3(0.4f), GraphicsDevice, Content, light), models));
            // models[models.Count - 1].Model.switchAnimation("Idle");

            ////models.Add(new Grasshopper(new LoadModel(Content.Load<Model>("Models/grasshopper"), new Vector3(50, 40, 50), new Vector3(0), new Vector3(0.4f), GraphicsDevice, Content, light), models));
            ////models[models.Count - 1].Model.switchAnimation("Idle");

            // models.Add(new StrongAnt(new LoadModel(Content.Load<Model>("Models/strongAnt"),new Vector3(120,40,20),new Vector3(0),new Vector3(0.4f),GraphicsDevice,Content,light)));
            //// models[models.Count - 1].Model.switchAnimation("Idle");

            // models.Add(new AntPeasant(new LoadModel(Content.Load<Model>("Models/ant"), new Vector3(100, 40, 10), new Vector3(0), new Vector3(0.4f), GraphicsDevice, Content, light)));

               // Console.WriteLine("QuadNode: " + QuadNodeController.QuadNodeList.Count);

            BBoxRender.InitializeBBoxDebuger(device);

               // IModel.Add(new BeetleBuilding(new LoadModel(Content.Load<Model>("Models/h4"), new Vector3(700, 60, 900), new Vector3(0), new Vector3(0.4f), GraphicsDevice, light)));
              //  IModel.Add(new GrassHopperBuilding(new LoadModel(Content.Load<Model>("Models/h3"), new Vector3(900, 40, 1100), new Vector3(0), new Vector3(0.4f), GraphicsDevice, light)));

            Console.WriteLine(QuadNodeController.QuadNodeList2.Count);

            #region trigger end game
            theEnd = new Trigger((new LoadModel(Content.Load<Model>("Models/endNode"), new Vector3(1375, 40, 2500), new Vector3(0), new Vector3(4f), GraphicsDevice, light)));
            IModel.Add(theEnd);
            #endregion

            IModel.Add(new Laser((new LoadModel(Content.Load<Model>("Models/laser"), new Vector3(0, 40, 0), new Vector3(0), new Vector3(2f), GraphicsDevice, light)), curvesForLaser[0]));
            timeTriggers.Add(new LaserTrigger((Laser)IModel[IModel.Count - 1], 100));

            control = new Logic.Control(texture[11], quadTree[0]);
            gui = new MainGUI(StaticHelpers.StaticHelper.Content, control,models);

            control.Models_Colision = IModel;

            Player.addMaterial(new Wood(),200);
            Player.addMaterial(new Stone(), 200);
            Player.addMaterial(new Hyacynt(), 200);
            Player.addMaterial(new Dicentra(), 200);
            Player.addMaterial(new Chelidonium(), 200);

            miniMap = new MiniMap(models);
            foreach(InteractiveModel m in IModel) {
                if (m is Laser || m is GrassHopperBuilding || m is BeetleBuilding)
                    miniMap.addObjects(m);
                }
            intro = new List<Texture2D>();
            intro.Add( Content.Load<Texture2D>("Textures/1"));
            intro.Add(Content.Load<Texture2D>("Textures/2"));
            intro.Add(Content.Load<Texture2D>("Textures/3"));
            intro.Add(Content.Load<Texture2D>("Textures/4"));

            _intro = intro[0];
        }