private void button2_Click(object sender, EventArgs e)
        {
            DataAcsess dataAcsess = new DataAcsess();

            dataAcsess.Name = comboBox1.Text;
            recordUser      = dataAcsess.login();

            if (recordUser[0].num_Este == textBox1.Text.Trim() && recordUser[0].number_hokm == textBox2.Text.Trim())
            {
                this.Hide();
                Main frm1 = new Main();
                Main.Namee    = comboBox1.Text.Trim();
                frm1.Esm      = recordUser[0].name;
                frm1.Family   = recordUser[0].family;
                frm1.Picture  = recordUser[0].pic;
                frm1.PassWord = recordUser[0].number_hokm;
                frm1.UserName = recordUser[0].num_Este;
                frm1.Show();
            }
            else
            {
                MessageBox.Show("کلمه عبور یا رمز اشتباه می باشد");
                textBox1.Text = "";
                textBox2.Text = "";
            }
        }
Exemplo n.º 2
0
 private void Form9_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (auto == 1)
     {
         DataAcsess dataAcsess = new DataAcsess();
         dataAcsess.Name = comboBox1.Text;
         dataAcsess.Id   = Id;
         dataAcsess.updateShow();
     }
 }
        private void Form10_Activated(object sender, EventArgs e)
        {
            DataAcsess dataAcsess = new DataAcsess();

            dataAcsess.Name = Main.Namee;
            DataTable dt = new DataTable();

            dt = dataAcsess.selectALLMessage();
            gridEX1.DataSource = dt;
        }
 private void elButton1_Click(object sender, EventArgs e)
 {
     if (gridEX1.CurrentRow != null)
     {
         DataAcsess dataAcsess = new DataAcsess();
         dataAcsess.Name = Main.Namee;
         dataAcsess.Id   = Convert.ToInt16(gridEX1.CurrentRow.Cells[5].Value.ToString());
         dataAcsess.deleteMessage();
         gridEX1.CurrentRow.Delete();
     }
 }
Exemplo n.º 5
0
        private void Form1_Load(object sender, EventArgs e)
        {
            DataAcsess dataAcsess = new DataAcsess();

            dataAcsess.Name = Namee;
            int ab = dataAcsess.selectNewMessage();

            if (ab == 0)
            {
                lbl_count.Text  = "";
                lbl_2count.Text = "";
            }
            else
            {
                lbl_count.Text  = "" + ab;
                lbl_2count.Text = "" + ab;
            }

            if (Namee == "مسئول ثبت")
            {
                elContainer6.Enabled = false;
                elContainer3.Enabled = false;
            }
            else if (Namee == "مسئول حکم")
            {
                elContainer4.Enabled = false;
                elContainer3.Enabled = false;
            }
            else if (Namee == "مدیر بخش")
            {
            }
            // MessageBox.Show(Name+""+Family);
            lbl_re.Text  = Namee;
            res_lbl.Text = Namee;
            // lbl_mess.Text = "";
            family_lbl.Text = Family;
            name_lbl.Text   = Esm;
            if (Picture == "" || Picture == null || File.Exists(Picture) == false)
            {
                pic.Image = Image.FromFile(G.DIRIMG);
                pic.Tag   = G.DIRIMG;
            }
            else
            {
                pic.Image = Image.FromFile(Picture);
                pic.Tag   = Picture;
            }
        }
        private void btn_edit_Click(object sender, EventArgs e)
        {
            DataAcsess dataAcsess = new DataAcsess();

            dataAcsess.Name     = txtname.Text;
            dataAcsess.Family   = txtfamily.Text;
            dataAcsess.UseName  = txt_userName.Text;
            dataAcsess.Password = txt_pass.Text;
            dataAcsess.Num_Este = Response.Trim();
            int a = dataAcsess.updateUsers();

            if (a == 1)
            {
                MessageBox.Show("ویرایش با موفقیت انجام شد");
            }
            else
            {
                MessageBox.Show("ویرایش با موفقیت انجام نشد");
            }
        }
Exemplo n.º 7
0
        private void pic_Click(object sender, EventArgs e)
        {
            string         filePath = "";
            OpenFileDialog dialog   = new OpenFileDialog();

            dialog.Filter           = "Image files (*.jpg, *.bmp, *.jpe, *.png) | *.jpg; *.bmp; *.jpe; *.png";
            dialog.InitialDirectory = @"C:\Users\User\Pictures";
            dialog.Title            = "لطفا عکس مورد نطر را انتخاب کنید";
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                filePath  = dialog.FileName;
                pic.Image = Image.FromFile(filePath);
                pic.Tag   = filePath;
                DataAcsess dataAcsess = new DataAcsess();
                dataAcsess.Picture = filePath;
                dataAcsess.Name    = Namee;
                dataAcsess.updatePic();
                //File.Copy(G.DIRPHOTO,filePath );
            }
        }
Exemplo n.º 8
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (Auto == 1)
     {
         DataAcsess dataAcsess = new DataAcsess();
         dataAcsess.Name = Main.Namee;
         dataAcsess.Id   = Id;
         dataAcsess.updateShow();
         this.Close();
     }
     else
     {
         if (comboBox1.Text != "" && textBox1.Text != "")
         {
             DataAcsess dataAcsess = new DataAcsess();
             dataAcsess.Name         = comboBox1.Text;
             dataAcsess.TitleMessage = textBox1.Text;
             dataAcsess.MainText     = textBox2.Text;
             dataAcsess.SendFrom     = Main.Namee;
             int a = dataAcsess.insertMessage();
             if (a == 1)
             {
                 MessageBox.Show("پیام ارسال شد");
                 textBox1.Text = "";
                 textBox2.Text = "";
             }
             else
             {
                 MessageBox.Show("مشکل در ارسال پیام");
             }
         }
         else
         {
             MessageBox.Show("لطفا گیرنده و موضوع رو پر کنید");
         }
     }
 }
        // This function is called each mouse up event when checker is selected
        // Used to deside and detect game moves such as game over(win/lose)/checker normal moves etc .
        public static bool OnFinishCheckerMove(ref CheckerPB checkerPB, Point newCheckerPosition)
        {
            // this special case when playing vs computer and player won pc , we dont take last computer move
            if (gameStatus == Constants.GAME_STATUS_END && gameType == Constants.GAME_TYPE_GAME_VS_COMPUTER)
            {
                return(false);
            }

            bool isCheckerPositionChanged = true;

            int jumpSize = Math.Abs(newCheckerPosition.Y - checkerPB.checker.oldPositionOnBord.Y);

            if (!isCheckerCanMove(checkerPB, newCheckerPosition))
            {
                checkerPB.moveToOldPosition();
                isCheckerPositionChanged = false;
            }
            else if (jumpSize == Constants.eatOtherCheckerJumpSize)
            {
                CheckerPB eatenChecker = FindEetenChecker(checkerPB, newCheckerPosition);
                if (eatenChecker == null || eatenChecker.checker.checkerType == checkerPB.checker.checkerType)
                {
                    checkerPB.moveToOldPosition();
                    isCheckerPositionChanged = false;
                }
                else
                {
                    //EATE CHECKER
                    RemoveEatenChecker(eatenChecker.checker.ID);
                    UpdateCheckerPosition(checkerPB, newCheckerPosition);
                    DataAcsess.UpdateServerWithCheckerMove(checkerPB.checker, eatenChecker.checker.ID);
                    updateThisClientOppenentVisibility();
                    if (isThisPlayerTurn)
                    {
                        numberOfeatenCheckers++;
                    }
                    else
                    {
                        numberOfeatenCheckersByOpponent++;
                    }
                }
            }
            else
            {
                UpdateCheckerPosition(checkerPB, newCheckerPosition);
                DataAcsess.UpdateServerWithCheckerMove(checkerPB.checker, null);
                updateThisClientOppenentVisibility();
            }

            if (gameType != Constants.GAME_TYPE_GAME_RESTORE && IsWonGame(newCheckerPosition))
            {
                gameStatus = Constants.GAME_STATUS_END;
                GameForm gameForm = (GameForm)Application.OpenForms["GameForm"];

                if (gameType == Constants.GAME_TYPE_PLAY_ONLINE)
                {
                    gameForm.OnGameWon(loggedInAccountPlayerPlaying);
                }
                else
                {
                    if (isThisPlayerTurn)
                    {
                        gameForm.OnGameWon(new DTO_Player {
                            TEAM_NAME = loggedInAccount.NAME
                        });
                    }
                    else
                    {
                        gameForm.OnGameWon(new DTO_Player {
                            TEAM_NAME = Constants.COMPUTER_TEAM_NAME
                        });
                    }
                }

                DataAcsess.UpdateServerPlayerWon(loggedInAccountPlayerPlaying);
            }

            if ((gameType == Constants.GAME_TYPE_PLAY_ONLINE || gameType == Constants.GAME_TYPE_GAME_VS_COMPUTER))
            {
                DataAcsess.AddGameMovement(currentPlayingGameID, new DTO_MOVEMENT {
                    Checker_ID = checkerPB.checker.ID, Row = newCheckerPosition.X, Col = newCheckerPosition.Y
                });
            }

            return(isCheckerPositionChanged);
        }