예제 #1
0
        private Dictionary <string, object> prepareArtistParameters(clsArtist prArtist)
        {
            Dictionary <string, object> par = new Dictionary <string, object>(3);

            par.Add("Name", prArtist.Name);
            par.Add("Speciality", prArtist.Speciality);
            par.Add("Phone", prArtist.Phone);
            return(par);
        }
예제 #2
0
 public void SetDetails(clsArtist prArtist)
 {
     _Artist         = prArtist;
     txtName.Enabled = string.IsNullOrEmpty(_Artist.Name);
     UpdateForm();
     UpdateDisplay();
     frmMain.Instance.GalleryNameChanged += new frmMain.Notify(updateTitle);
     // updateTitle(_Artist.ArtistList.GalleryName);
     Show();
 }
예제 #3
0
 public string PostArtist(clsArtist prArtist)
 {
     try
     {
         int lcRecCount = clsDbConnection.Execute(
             "INSERT INTO Artist (Speciality, Phone, Name) VALUES (@Speciality, @Phone, @Name)", prepareArtistParameters(prArtist));
         if (lcRecCount == 1)
         {
             return("One artist added");
         }
         else
         {
             return("Unexpected artist insert count: " + lcRecCount);
         }
     }
     catch (Exception ex)
     {
         return(ex.GetBaseException().Message);
     }
 }
예제 #4
0
 public string PutArtist(clsArtist prArtist)
 { // update
     try
     {
         int lcRecCount = clsDbConnection.Execute(
             "UPDATE Artist SET Speciality = @Speciality, Phone = @Phone WHERE Name = @Name",
             prepareArtistParameters(prArtist));
         if (lcRecCount == 1)
         {
             return("One artist updated");
         }
         else
         {
             return("Unexpected artist update count: " + lcRecCount);
         }
     }
     catch (Exception ex)
     {
         return(ex.GetBaseException().Message);
     }
 }
예제 #5
0
 internal async static Task <string> UpdateArtistAsync(clsArtist prArtist)
 {
     return(await InsertOrUpdateAsync(prArtist, "http://localhost:60064/api/gallery/PutArtist", "PUT"));
 }