Created
July 24, 2018 10:55
-
-
Save SergiyOsadchyy/71f16f3f2d777590bd854e371fd9efc1 to your computer and use it in GitHub Desktop.
test_delete
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Collections.Generic; | |
| using Domain; | |
| using System; | |
| using System.Data.SqlClient; | |
| namespace Persistence | |
| { | |
| public class SqlBusinessTree: IRepository | |
| { | |
| SqlConnection conn; | |
| SqlCommand comm; | |
| SqlDataReader dreader; | |
| /* ToDo: define connection string */ | |
| string connstring = "our connection string"; | |
| public UnbindedData GetData(long id) | |
| { | |
| return null; | |
| } | |
| public void UpdateLevel(Level item, long? firstLevel = null) | |
| { | |
| throw new System.NotImplementedException(); | |
| } | |
| public void UpdateProperty(Property item, long? firstLevel = null) | |
| { | |
| throw new System.NotImplementedException(); | |
| } | |
| public void Delete(long id) | |
| { | |
| conn = new SqlConnection(connstring); | |
| conn.Open(); | |
| comm = new SqlCommand("delete from Levels where Levels.LevelID = " + id + " ", conn); | |
| try | |
| { | |
| comm.ExecuteNonQuery(); | |
| Console.Writeline("Deleted..."); | |
| } | |
| catch (Exception x) | |
| { | |
| Console.Writeline(" Not Deleted" + x.Message ); | |
| } | |
| finally | |
| { | |
| conn.Close(); | |
| } | |
| /* ToDo: придумать что делать с висящими ветками */ | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment