Example #1
0
        public static DelProject_EL DelProjectInput()
        {
            Console.WriteLine("Enter ProjectId to delete record:");
            DelProject_EL dpe = new DelProject_EL
            {
                ProjectId = Console.ReadLine()
            };

            return(dpe);
        }
 public static void DeleteProject(DelProject_EL e)
 {
     //write code to delete project in ProjectDetails
     try
     {
         using (SqlConnection con = new SqlConnection(@"Data Source=DESKTOP-8HC3KF0;Initial Catalog=ALMS;Integrated Security=True;"))
         {
             SqlCommand cmd = new SqlCommand
             {
                 CommandText = "spDeleteProject",
                 Connection  = con,
                 CommandType = CommandType.StoredProcedure
             };
             cmd.Parameters.AddWithValue("@ProjectId", e.ProjectId);
             con.Open();
             cmd.ExecuteNonQuery();
         }
     }
     catch (SqlException ex)
     {
         Console.WriteLine(ex.Message);
     }
 }