/// <summary>
        /// This method Update a User registered
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        /// <param name="finger"></param>
        /// <param name="photo"></param>
        public string update(int id, string name, string lastname, string nickname, string ci, string phono, string height, string weight, string skillful, string position, string birthday, string patchphoto, byte[] fingerOne, byte[] fingerTwo)
        {
            try
            {
                beginTransaction();

                MySqlCommand cmd;
                string       cmdString = "UPDATE " + "players" +
                                         " SET name=@name,last_name=@lastname,nickname=@nickname,ci=@ci,phono=@phono,height=@height,weight=@weight,skillful_leg=@skillful " +
                                         ",position=@position,birthday=@birthday,image=@image,fingerOne=@fingerOne,fingerTwo=@fingerTwo " +
                                         " WHERE id= @id";

                cmd = new MySqlCommand(cmdString, myConnection);
                cmd.Parameters.Add("@id", MySqlDbType.Int16);
                cmd.Parameters.Add("@name", MySqlDbType.VarChar, 45);
                cmd.Parameters.Add("@lastname", MySqlDbType.VarChar, 45);
                cmd.Parameters.Add("@nickname", MySqlDbType.VarChar, 40);
                cmd.Parameters.Add("@ci", MySqlDbType.VarChar, 20);
                cmd.Parameters.Add("@phono", MySqlDbType.VarChar, 30);
                cmd.Parameters.Add("@height", MySqlDbType.VarChar, 10);
                cmd.Parameters.Add("@weight", MySqlDbType.VarChar, 10);
                cmd.Parameters.Add("@skillful", MySqlDbType.VarChar, 40);
                cmd.Parameters.Add("@position", MySqlDbType.VarChar, 40);
                cmd.Parameters.Add("@birthday", MySqlDbType.Date);
                cmd.Parameters.Add("@image", MySqlDbType.Text);
                cmd.Parameters.Add("@fingerOne", MySqlDbType.LongBlob);
                cmd.Parameters.Add("@fingerTwo", MySqlDbType.LongBlob);
                cmd.Parameters["@id"].Value        = id;
                cmd.Parameters["@name"].Value      = name;
                cmd.Parameters["@lastname"].Value  = lastname;
                cmd.Parameters["@nickname"].Value  = nickname;
                cmd.Parameters["@ci"].Value        = ci;
                cmd.Parameters["@phono"].Value     = phono;
                cmd.Parameters["@height"].Value    = height;
                cmd.Parameters["@weight"].Value    = weight;
                cmd.Parameters["@skillful"].Value  = skillful;
                cmd.Parameters["@position"].Value  = position;
                cmd.Parameters["@birthday"].Value  = DateTime.Parse(birthday);
                cmd.Parameters["@image"].Value     = patchphoto;
                cmd.Parameters["@fingerOne"].Value = fingerOne;
                cmd.Parameters["@fingerTwo"].Value = fingerTwo;
                cmd.ExecuteNonQuery();
                ftp ftpClient = new ftp(@"ftp://sidbol.com", ConstactsCreadentials.userName, ConstactsCreadentials.pass);

                /* Upload a File */
                ftpClient.upload("public_html/afc/app/webroot/img/players/sm_" + patchphoto + ".jpg", Application.StartupPath + "\\Images\\sm_" + patchphoto + ".jpg");
                myTrans.Commit();
            }
            catch (Exception e)
            {
                myTrans.Rollback();
                return("***************** There is problem, please try again ***********************");
            }
            finally
            {
                myConnection.Close();
            }
            return("***** DATOS DEL JUGADOR ACTUALIZADO CORRECTAMENTE *****");
        }
Beispiel #2
0
        private void getUerData(string keysTemplate)
        {
            try
            {
                MakeReport("Jugador no Encontrado en la Base de Datos de AFC ");
                ClassConnectDataBase classBiometric = new ClassConnectDataBase();
                DataTable            table          = classBiometric.getDatawithTwoFinger(keysTemplate);


                name         = table.Rows[0]["Name"].ToString();
                last_name    = table.Rows[0]["last_name"].ToString();
                nickname     = table.Rows[0]["nickname"].ToString();
                ci           = table.Rows[0]["ci"].ToString();
                height       = table.Rows[0]["height"].ToString();
                weight       = table.Rows[0]["weight"].ToString();
                skillful_leg = table.Rows[0]["skillful_leg"].ToString();
                position     = table.Rows[0]["position"].ToString();
                birthday     = table.Rows[0]["birthday"].ToString();


                ftp ftpClient = new ftp(@"ftp://sidbol.com", ConstactsCreadentials.userName, ConstactsCreadentials.pass);

                /* Upload a File */
                ftpClient.download("public_html/afc/app/webroot/img/players/sm_" + table.Rows[0]["image"].ToString() + ".jpg", Application.StartupPath + "\\Images\\sm_" + table.Rows[0]["image"].ToString() + ".jpg");

                pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
                pictureBox1.Image    = Image.FromFile(Application.StartupPath + "\\Images\\sm_" + table.Rows[0]["image"].ToString() + ".jpg");

                UserName(name, last_name, nickname, ci, height, weight, skillful_leg, position, birthday);
                btn();
            }
            catch
            {
                //Message("*************** There is a Problem, please try again ******************");
            }
        }
        /// <summary>
        /// this method do an insert to register user
        /// </summary>
        /// <param name="name"></param>
        /// <param name="lastname"></param>
        /// <param name="nickname"></param>
        /// <param name="height"></param>
        /// <param name="weight"></param>
        /// <param name="skillful"></param>
        /// <param name="position"></param>
        /// <param name="birthday"></param>
        /// <param name="patchphoto"></param>
        /// <param name="fingerOne"></param>
        /// <param name="fingerTwo"></param>
        /// <returns></returns>
        public string insert(string name, string lastname, string nickname, string ci,
                             string phono, string height, string weight, string skillful, string position,
                             string birthday, string patchphoto, byte[] fingerOne, byte[] fingerTwo, string idDivision, string idteam)
        {
            try
            {
                beginTransaction();

                MySqlCommand cmd;
                string       cmdString = "INSERT INTO players(name,last_name,nickname,ci,phono,height,weight,skillful_leg,position,birthday,image,fingerOne,fingerTwo)values(@name,@lastname,@nickname,@ci,@phono,@height,@weight,@skillful,@position,@birthday,@image,@fingerOne,@fingerTwo)";
                cmd = new MySqlCommand(cmdString, myConnection);
                cmd.Parameters.Add("@name", MySqlDbType.VarChar, 45);
                cmd.Parameters.Add("@lastname", MySqlDbType.VarChar, 45);
                cmd.Parameters.Add("@nickname", MySqlDbType.VarChar, 40);
                cmd.Parameters.Add("@ci", MySqlDbType.VarChar, 20);
                cmd.Parameters.Add("@phono", MySqlDbType.VarChar, 30);
                cmd.Parameters.Add("@height", MySqlDbType.VarChar, 10);
                cmd.Parameters.Add("@weight", MySqlDbType.VarChar, 10);
                cmd.Parameters.Add("@skillful", MySqlDbType.VarChar, 40);
                cmd.Parameters.Add("@position", MySqlDbType.VarChar, 40);
                cmd.Parameters.Add("@birthday", MySqlDbType.Date);
                cmd.Parameters.Add("@image", MySqlDbType.Text);
                cmd.Parameters.Add("@fingerOne", MySqlDbType.Blob);
                cmd.Parameters.Add("@fingerTwo", MySqlDbType.Blob);
                cmd.Parameters["@name"].Value      = name;
                cmd.Parameters["@lastname"].Value  = lastname;
                cmd.Parameters["@nickname"].Value  = nickname;
                cmd.Parameters["@ci"].Value        = ci;
                cmd.Parameters["@phono"].Value     = phono;
                cmd.Parameters["@height"].Value    = height;
                cmd.Parameters["@weight"].Value    = weight;
                cmd.Parameters["@skillful"].Value  = skillful;
                cmd.Parameters["@position"].Value  = position;
                cmd.Parameters["@birthday"].Value  = DateTime.Parse(birthday);
                cmd.Parameters["@image"].Value     = patchphoto;
                cmd.Parameters["@fingerOne"].Value = fingerOne;
                cmd.Parameters["@fingerTwo"].Value = fingerTwo;
                cmd.ExecuteNonQuery();
                int idPlayer = Convert.ToInt32(cmd.LastInsertedId);



                /* Create Object Instance */
                ftp ftpClient = new ftp(@"ftp://sidbol.com", ConstactsCreadentials.userName, ConstactsCreadentials.pass);

                /* Upload a File */
                ftpClient.upload("public_html/afc/app/webroot/img/players/sm_" + patchphoto + ".jpg", Application.StartupPath + "\\Images\\sm_" + patchphoto + ".jpg");
                myTrans.Commit();



                DataTable tabla           = this.getDivisionTeamsID(idDivision, idteam);
                string    idDivisionQuery = tabla.Rows[0]["id"].ToString();


                tabla = this.getChampionsId(idDivision);
                string idchampionShip = tabla.Rows[0]["championship_id"].ToString();

                insertDivisionTeamsPLayers(idPlayer.ToString(), idDivisionQuery, idchampionShip);
            }
            catch (Exception e)
            {
                myTrans.Rollback();
                return(e.Message + "*************** Ha ocurrido un error , porfavor contacte con SIDBOL ********************");
            }
            finally
            {
                myConnection.Close();
            }
            return("***** JUGADOR REGISTRADO CORRECTAMENTE *****");
        }