public void AssignPhotographertoPicture(int PictureID, int PhotographerID)
        {
            PhotographerModel model = new PhotographerModel(0, "", "", "", "");

            foreach (PhotographerModel photographer in PhotographerList)
            {
                if (photographer.ID == PhotographerID)
                {
                    model = photographer;
                }
            }

            foreach (PictureModel pic in PictureList)
            {
                if (pic.ID == PictureID)
                {
                    pic.Photographer = model;
                }
            }
        }
Exemple #2
0
        public PhotographerModel getPhotographer(int ID)
        {
            var con = new MySqlConnection(connstr);

            con.Open();
            var stm = "SELECT * FROM `photographer` WHERE ID = @ID;";
            var cmd = new MySqlCommand(stm, con);

            cmd.Parameters.AddWithValue("@ID", ID);
            cmd.Prepare();

            using MySqlDataReader rdr = cmd.ExecuteReader();
            PhotographerModel photographer = new PhotographerModel();

            while (rdr.Read())
            {
                photographer.FirstName = rdr.GetString("FirstName");
                photographer.LastName  = rdr.GetString("LastName");
                photographer.Birthday  = DateTime.Parse(rdr["Birthday"].ToString());
                photographer.Notes     = rdr.GetString("Notes");
            }
            return(photographer);
        }
Exemple #3
0
        /// <summary>
        /// Run a query to get a Photographer by Id
        /// </summary>
        /// <param name="PhotographerID"> int </param>
        public PhotographerModel GetPhotographerByID(int PhotographerID)
        {
            var Photographer = new PhotographerModel();

            using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["PhotoConsentDB"].ToString()))
            {
                cn.Open();
                var           sql        = string.Format("SELECT * FROM Photographers Where PhotographerID = {0}", PhotographerID);
                SqlCommand    sqlCommand = new SqlCommand(sql, cn);
                SqlDataReader reader     = sqlCommand.ExecuteReader();
                while (reader.Read())
                {
                    Photographer.FormID         = (int)reader["FormID"];
                    Photographer.Name           = (string)reader["Name"];
                    Photographer.PhotographerID = (int)reader["PhotographerID"];

                    Photographer.ContactNumber = reader["ContactNumber"] == DBNull.Value ? "" : (string)reader["ContactNumber"];
                    Photographer.Email         = reader["Email"] == DBNull.Value ? "" : (string)reader["Email"];
                }
                cn.Close();
            }
            return(Photographer);
        }
Exemple #4
0
        public List <PhotographerModel> getPhotographers()
        {
            var con = new MySqlConnection(connstr);

            con.Open();
            var stm = "SELECT * FROM photographer;";
            var cmd = new MySqlCommand(stm, con);

            using MySqlDataReader rdr = cmd.ExecuteReader();
            List <PhotographerModel> photographers = new List <PhotographerModel>();

            while (rdr.Read())
            {
                PhotographerModel photographer = new PhotographerModel();
                photographer.ID        = rdr.GetInt32("ID");
                photographer.FirstName = rdr.GetString("FirstName");
                photographer.LastName  = rdr.GetString("LastName");
                photographer.Birthday  = DateTime.Parse(rdr["Birthday"].ToString());
                photographer.Notes     = rdr.GetString("Notes");

                photographers.Add(photographer);
            }
            return(photographers);
        }
 public void Delete(PhotographerModel photographer)
 {
     _photographerBL.DeletePhotographer(photographer);
 }
Exemple #6
0
 public void updatePhotographer(PhotographerModel photographer)
 {
     _dal.updatePhotographer(photographer);
 }
Exemple #7
0
 public void savePhotographer(PhotographerModel photographer)
 {
     _dal.savePhotographer(photographer);
 }
Exemple #8
0
 public void DeletePhotographer(PhotographerModel model)
 {
     _db.Execute("EXEC DeletePhotographer @PhotographerID", new { model.PhotographerID });
 }
Exemple #9
0
 public void UpdatePhotographer(PhotographerModel model)
 {
     _db.Execute("EXEC UpdatePhotographer @Name, @Email, @ContactNumber, @PhotographerID", new { model.Name, model.Email, model.ContactNumber, model.PhotographerID });
 }
Exemple #10
0
 /// <summary>
 /// Run SP to input a Photographer into the database
 /// </summary>
 /// <param name="model">PhotographerModel - </param>
 public void InsertPhotographer(PhotographerModel model)
 {
     _db.Execute("EXEC InsertPhotographer @FormID, @Name, @Email, @ContactNumber", new { model.FormID, model.Name, model.Email, model.ContactNumber });
 }
 public EditPhotographer(EditPhotographerVM editPhotographerVM, PhotographerModel selected)
 {
     DataContext = editPhotographerVM;
     _selected   = selected;
     InitializeComponent();
 }
Exemple #12
0
 public void isVMofPhotographerWithId(int Id)
 {
     phm = bl.getPhotographer(Id);
 }
Exemple #13
0
 public void isVMofPhotographerOfPicture(int pictureId)
 {
     phm = bl.getPhotographerOfPicture(pictureId);
 }
Exemple #14
0
 /// <summary>
 /// Saves a photographer to the database
 /// </summary>
 /// <param name="photographerModel"></param>
 public void SavePhotographer(PhotographerModel photographerModel)
 {
     ((DataAccessLayer)DataAccessLayer).SavePhotographer(photographerModel);
 }
Exemple #15
0
 /// <summary>
 /// Updates a photographer
 /// </summary>
 /// <param name="photographerModel"></param>
 public void UpdatePhotographer(PhotographerModel photographerModel)
 {
     ((DataAccessLayer)DataAccessLayer).UpdatePhotographer(photographerModel);
 }
Exemple #16
0
 public void SavePhotographer(int id, PhotographerModel photographer)
 {
     throw new NotImplementedException();
 }