コード例 #1
0
        public ActionResult DeleteConfirmed(byte id)
        {
            cast cast = db.cast.Find(id);

            db.cast.Remove(cast);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
    void drawRays()
    {
        rays.Clear();

        float step = (angle / resolution);

        for (int i = 0; i < resolution; i++)
        {
            float rayAngle = (i - resolution / 2) * step;

            cast newRay  = DrawRay(rayAngle);
            cast lastRay = new cast();

            if (i > 0)
            {
                lastRay = rays[rays.Count - 1];
            }
            else
            {
                lastRay = newRay;
            }

            if (newRay.collider == lastRay.collider)
            {
                rays.Add(newRay);
            }
            else
            {
                findEdge(lastRay, newRay);
            }
        }

        int vertexCount = rays.Count + 1;

        Vector3[] vertices  = new Vector3[vertexCount];
        int[]     triangles = new int[3 * (vertexCount - 2)];

        vertices[0] = Vector3.zero;
        for (int i = 0; i < vertexCount - 1; i++)
        {
            vertices[i + 1] = transform.InverseTransformPoint(rays[i].point);

            if (i == vertexCount - 2)
            {
                continue;
            }
            triangles[3 * i]     = 0;
            triangles[3 * i + 1] = i + 1;
            triangles[3 * i + 2] = i + 2;
        }

        viewMesh.vertices  = vertices;
        viewMesh.triangles = triangles;
    }
コード例 #3
0
        public ActionResult AddRole(AddNewRoleModel newCast)
        {
            cast temp = new cast();

            temp.person_id      = newCast.personId;
            temp.movie_id       = dbMovie.getMovieByTitle(newCast.movieTitle).id;
            temp.role           = (int)Enum.Parse(typeof(movieRoles), newCast.role.ToLower().Trim());
            temp.character_name = newCast.characterName;

            dbPerson.addRole(temp);

            return(View());
        }
コード例 #4
0
 public bool addRole(cast temp)
 {
     try
     {
         db.casts.Add(temp);
         db.SaveChanges();
         return(true);
     }
     catch
     {
         db.casts.Remove(temp);
         return(false);
     }
 }
コード例 #5
0
        // GET: Casts/Edit/5
        public ActionResult Edit(byte?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            cast cast = db.cast.Find(id);

            if (cast == null)
            {
                return(HttpNotFound());
            }
            return(View(cast));
        }
コード例 #6
0
        public ActionResult Edit([Bind(Include = "id,first_name,last_name,dob,height,age,total_movies,about,profile")] cast cast, HttpPostedFileBase profile)
        {
            if (ModelState.IsValid)
            {
                if (profile != null)
                {
                    string pic  = System.IO.Path.GetFileName(profile.FileName);
                    string path = System.IO.Path.Combine(
                        Server.MapPath("~/media/castImage"), pic);

                    cast.profile = profile.FileName;
                    profile.SaveAs(path);
                }
                db.Entry(cast).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(cast));
        }
コード例 #7
0
    void findEdge(cast lastRay, cast newRay)
    {
        for (int i = 0; i < edgeFinderRep; i++)
        {
            cast middle = DrawRay((lastRay.angle + newRay.angle) / 2);

            if (middle.collider == lastRay.collider)
            {
                lastRay = middle;
            }
            if (middle.collider == newRay.collider)
            {
                newRay = middle;
            }
        }

        rays.Add(lastRay);
        rays.Add(newRay);
    }
コード例 #8
0
        public bool AddCastToMovie(int personId, int role, int movieId)
        {
            cast temp = new cast();

            temp.person_id = personId;
            temp.role      = role;
            temp.movie_id  = movieId;

            try
            {
                db.casts.Add(temp);
                db.SaveChanges();

                return(true);
            }
            catch
            {
                db.casts.Remove(temp);

                return(false);
            }
        }
コード例 #9
0
        public bool addRole(int personId, int movieId, int role, string characterName)
        {
            cast temp = new cast();

            temp.person_id      = personId;
            temp.role           = role;
            temp.movie_id       = movieId;
            temp.character_name = characterName;

            try
            {
                db.casts.Add(temp);
                db.SaveChanges();

                return(true);
            }
            catch
            {
                db.casts.Remove(temp);

                return(false);
            }
        }
コード例 #10
0
        private void getDataOne()
        {
            try
            {
                JObject data;
                movie   tempMovie;
                person  tempPerson;

                url  = "http://mymovieapi.com/?id=";
                url += textBox1.Text + urlParams;

                tempMovie  = new movie();
                tempPerson = new person();

                WebRequest      request  = WebRequest.Create(url);
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                Stream       dataStream = response.GetResponseStream();
                StreamReader reader     = new StreamReader(dataStream);

                data = JObject.Parse(reader.ReadToEnd());

                int year  = (int)data["release_date"][0]["year"];
                int day   = (int)data["release_date"][0]["day"];
                int month = (int)data["release_date"][0]["month"];

                DateTime date = new DateTime(year, month, day);

                tempMovie.title        = ((string)data["title"]).ToLower();
                tempMovie.release_date = date;
                tempMovie.description  = (string)data["plot"];

                bool c = dbMovie.addMovie(tempMovie);

                textBox2.Text = c.ToString();

                if (c == true)
                {
                    cast tempCast = new cast();
                    tempCast.movie_id = tempMovie.id;

                    char[] separator = { ' ' };

                    tempMovie.id = (dbMovie.getMovieByTitle(tempMovie.title)).id;

                    foreach (string a in data["actors"])
                    {
                        tempPerson.name = a.ToLower();

                        dbPerson.addNewPerson(tempPerson);
                    }

                    foreach (string d in data["directors"])
                    {
                        tempPerson.name = d.ToLower();

                        dbPerson.addNewPerson(tempPerson);
                    }

                    foreach (string w in data["writers"])
                    {
                        tempPerson.name = w.ToLower();

                        dbPerson.addNewPerson(tempPerson);
                    }

                    foreach (string a2 in data["actors"])
                    {
                        tempCast.person_id = (dbPerson.getPersonByName(a2)).id;
                        tempCast.role      = 2;
                        dbPerson.addRole(tempCast);
                    }

                    foreach (string d2 in data["directors"])
                    {
                        tempCast.person_id = (dbPerson.getPersonByName(d2)).id;
                        tempCast.role      = 1;
                        dbPerson.addRole(tempCast);
                    }

                    foreach (string w2 in data["writers"])
                    {
                        tempCast.person_id = (dbPerson.getPersonByName(w2)).id;
                        tempCast.role      = 3;
                        dbPerson.addRole(tempCast);
                    }

                    dataStream.Close();
                    reader.Close();
                    response.Close();

                    textBox1.Clear();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #11
0
        private void getDataTwo()
        {
            try
            {
                JObject data;
                movie   tempMovie;
                person  tempPerson;

                url  = "http://www.omdbapi.com/?i=";
                url += textBox1.Text;

                tempMovie  = new movie();
                tempPerson = new person();

                WebRequest      request  = WebRequest.Create(url);
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                Stream       dataStream = response.GetResponseStream();
                StreamReader reader     = new StreamReader(dataStream);

                data = JObject.Parse(reader.ReadToEnd());

                string[] dateTemp = Convert.ToString(data["Released"]).Split(' ');

                int tempMonth = (int)Enum.Parse(typeof(months), dateTemp[1]);

                DateTime date = new DateTime(Convert.ToInt32(dateTemp[2]), tempMonth, Convert.ToInt32(dateTemp[0]));

                tempMovie.title        = ((string)data["Title"]).ToLower();
                tempMovie.release_date = date;
                tempMovie.description  = (string)data["Plot"];

                bool c = dbMovie.addMovie(tempMovie);

                textBox2.Text = c.ToString();

                if (c == true)
                {
                    cast tempCast = new cast();
                    tempCast.movie_id = tempMovie.id;

                    char[] separator = { ' ' };

                    tempMovie.id = (dbMovie.getMovieByTitle(tempMovie.title)).id;

                    string[] Actors    = Convert.ToString(data["Actors"]).Split(',');
                    string[] Writers   = Convert.ToString(data["Writer"]).Split(',');
                    string[] Directors = Convert.ToString(data["Director"]).Split(',');

                    for (int i = 0; i < Actors.Length; i++)
                    {
                        Actors[i] = Actors[i].Trim();
                    }

                    for (int i = 0; i < Writers.Length; i++)
                    {
                        Writers[i] = Writers[i].Trim();
                    }

                    for (int i = 0; i < Directors.Length; i++)
                    {
                        Directors[i] = Directors[i].Trim();
                    }

                    foreach (string a in Actors)
                    {
                        tempPerson.name = a.ToLower();

                        dbPerson.addNewPerson(tempPerson);
                    }

                    foreach (string d in Directors)
                    {
                        tempPerson.name = d.ToLower();

                        dbPerson.addNewPerson(tempPerson);
                    }

                    foreach (string w in Writers)
                    {
                        string[] tempName = w.ToLower()
                                            .Split('(');

                        tempPerson.name = tempName[0];
                        dbPerson.addNewPerson(tempPerson);
                    }

                    foreach (string a2 in Actors)
                    {
                        tempCast.person_id = (dbPerson.getPersonByName(a2)).id;
                        tempCast.role      = 2;
                        dbPerson.addRole(tempCast);
                    }

                    foreach (string d2 in Directors)
                    {
                        tempCast.person_id = (dbPerson.getPersonByName(d2)).id;
                        tempCast.role      = 1;
                        dbPerson.addRole(tempCast);
                    }

                    foreach (string w2 in Writers)
                    {
                        string[] tempName = w2.ToLower()
                                            .Split('(');
                        tempCast.person_id = (dbPerson.getPersonByName(tempName[0])).id;
                        tempCast.role      = 3;
                        dbPerson.addRole(tempCast);
                    }

                    dataStream.Close();
                    reader.Close();
                    response.Close();

                    textBox1.Clear();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #12
0
        public string createTask3(ct3 what)
        {
            //setting up object to get castid (from user input).
            //from below queries the actorno and movie no
            cast bob = new cast();

            bob.castId = what.castID;
            SqlConnection conn = new SqlConnection(connectionString);
            //get actor no----------------------
            string ActorString =
                $"SELECT ACTORNO FROM ACTOR WHERE FULLNAME = '{what.actorName}' ";

            SqlCommand cmd = new SqlCommand(ActorString, conn);

            conn.Open();
            try
            {
                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        bob.actorNo = (int)reader[0];
                    }
                }
                conn.Close();
            }
            catch (System.Exception se)

            {
                return($"I cannot add the actor {what.actorName}: {se.Message}");
            }
            //got actor no----------------------
            //get movie no----------------------
            string MovieString =
                $"SELECT MOVIENO FROM MOVIE WHERE TITLE = '{what.movieTitle}'";

            cmd = new SqlCommand(MovieString, conn);
            conn.Open();
            try
            {
                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        bob.movieNo = (int)reader[0];
                    }
                }
                conn.Close();
            }
            catch (System.Exception se)

            {
                return($"I cannot add the movie {what.movieTitle}: " + se.Message);
            }
            //got movie no----------------------
            //insert into cast----------------------
            string theInserter = $"INSERT INTO CASTING (CASTID, ACTORNO, MOVIENO) VALUES ({bob.castId},{bob.actorNo}, {bob.movieNo})";

            cmd = new SqlCommand(theInserter, conn);
            conn.Open();
            try
            {
                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                    }
                }
                conn.Close();
            }
            catch (System.Exception se)

            {
                return($"I cannot add the {what.actorName} to the cast: " + se.Message);
            }
            return($"Success! I have add {what.actorName} to the cast of {what.movieTitle}: \n {cmd.CommandText}");
        }
コード例 #13
0
ファイル: Form1.cs プロジェクト: kebabkiller/MoviesProject
        private void getDataOne()
        {
            try
            {
                JObject data;
                movie tempMovie;
                person tempPerson;

                url = "http://mymovieapi.com/?id=";
                url += textBox1.Text + urlParams;

                tempMovie = new movie();
                tempPerson = new person();

                WebRequest request = WebRequest.Create(url);
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                Stream dataStream = response.GetResponseStream();
                StreamReader reader = new StreamReader(dataStream);

                data = JObject.Parse(reader.ReadToEnd());

                int year = (int)data["release_date"][0]["year"];
                int day = (int)data["release_date"][0]["day"];
                int month = (int)data["release_date"][0]["month"];

                DateTime date = new DateTime(year, month, day);

                tempMovie.title = ((string)data["title"]).ToLower();
                tempMovie.release_date = date;
                tempMovie.description = (string)data["plot"];

                bool c = dbMovie.addMovie(tempMovie);

                textBox2.Text = c.ToString();

                if (c == true)
                {
                    cast tempCast = new cast();
                    tempCast.movie_id = tempMovie.id;

                    char[] separator = { ' ' };

                    tempMovie.id = (dbMovie.getMovieByTitle(tempMovie.title)).id;

                    foreach (string a in data["actors"])
                    {
                        tempPerson.name = a.ToLower();

                        dbPerson.addNewPerson(tempPerson);

                    }

                    foreach (string d in data["directors"])
                    {
                        tempPerson.name = d.ToLower();

                        dbPerson.addNewPerson(tempPerson);
                    }

                    foreach (string w in data["writers"])
                    {
                        tempPerson.name = w.ToLower();

                        dbPerson.addNewPerson(tempPerson);
                    }

                    foreach (string a2 in data["actors"])
                    {

                        tempCast.person_id = (dbPerson.getPersonByName(a2)).id;
                        tempCast.role = 2;
                        dbPerson.addRole(tempCast);
                    }

                    foreach (string d2 in data["directors"])
                    {

                        tempCast.person_id = (dbPerson.getPersonByName(d2)).id;
                        tempCast.role = 1;
                        dbPerson.addRole(tempCast);
                    }

                    foreach (string w2 in data["writers"])
                    {

                        tempCast.person_id = (dbPerson.getPersonByName(w2)).id;
                        tempCast.role = 3;
                        dbPerson.addRole(tempCast);
                    }

                    dataStream.Close();
                    reader.Close();
                    response.Close();

                    textBox1.Clear();
                }
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #14
0
ファイル: Form1.cs プロジェクト: kebabkiller/MoviesProject
        private void getDataTwo()
        {
            try
            {
                JObject data;
                movie tempMovie;
                person tempPerson;

                url = "http://www.omdbapi.com/?i=";
                url += textBox1.Text;

                tempMovie = new movie();
                tempPerson = new person();

                WebRequest request = WebRequest.Create(url);
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                Stream dataStream = response.GetResponseStream();
                StreamReader reader = new StreamReader(dataStream);

                data = JObject.Parse(reader.ReadToEnd());

                string[] dateTemp = Convert.ToString(data["Released"]).Split(' ');

                int tempMonth = (int)Enum.Parse(typeof(months), dateTemp[1]);

                DateTime date = new DateTime(Convert.ToInt32(dateTemp[2]), tempMonth, Convert.ToInt32(dateTemp[0]));

                tempMovie.title = ((string)data["Title"]).ToLower();
                tempMovie.release_date = date;
                tempMovie.description = (string)data["Plot"];

                bool c = dbMovie.addMovie(tempMovie);

                textBox2.Text = c.ToString();

                if (c == true)
                {
                    cast tempCast = new cast();
                    tempCast.movie_id = tempMovie.id;

                    char[] separator = { ' ' };

                    tempMovie.id = (dbMovie.getMovieByTitle(tempMovie.title)).id;

                    string[] Actors = Convert.ToString(data["Actors"]).Split(',');
                    string[] Writers = Convert.ToString(data["Writer"]).Split(',');
                    string[] Directors = Convert.ToString(data["Director"]).Split(',');

                    for (int i = 0; i < Actors.Length; i++)
                    {
                        Actors[i] = Actors[i].Trim();
                    }

                    for (int i = 0; i < Writers.Length; i++)
                    {
                        Writers[i] = Writers[i].Trim();
                    }

                    for (int i = 0; i < Directors.Length; i++)
                    {
                        Directors[i] = Directors[i].Trim();
                    }

                    foreach (string a in Actors)
                    {
                        tempPerson.name = a.ToLower();

                        dbPerson.addNewPerson(tempPerson);
                    }

                    foreach (string d in Directors)
                    {
                        tempPerson.name = d.ToLower();

                        dbPerson.addNewPerson(tempPerson);

                    }

                    foreach (string w in Writers)
                    {
                        string[] tempName = w.ToLower()
                                             .Split('(');

                        tempPerson.name = tempName[0];
                        dbPerson.addNewPerson(tempPerson);
                    }

                    foreach (string a2 in Actors)
                    {

                        tempCast.person_id = (dbPerson.getPersonByName(a2)).id;
                        tempCast.role = 2;
                        dbPerson.addRole(tempCast);
                    }

                    foreach (string d2 in Directors)
                    {

                        tempCast.person_id = (dbPerson.getPersonByName(d2)).id;
                        tempCast.role = 1;
                        dbPerson.addRole(tempCast);
                    }

                    foreach (string w2 in Writers)
                    {
                        string[] tempName = w2.ToLower()
                                             .Split('(');
                        tempCast.person_id = (dbPerson.getPersonByName(tempName[0])).id;
                        tempCast.role = 3;
                        dbPerson.addRole(tempCast);
                    }

                    dataStream.Close();
                    reader.Close();
                    response.Close();

                    textBox1.Clear();
                }
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }