public static void UpdatePendingLeaveRequest(UpdatePendingLeaveRequest_EL e) { using (SqlConnection con = new SqlConnection(@"Data Source=DESKTOP-8HC3KF0;Initial Catalog=ALMS;Integrated Security=True;")) { SqlCommand cmd = new SqlCommand { CommandText = "spUpdatePendingLeaveRequest", Connection = con, CommandType = CommandType.StoredProcedure }; //passing values to sql parameter cmd.Parameters.AddWithValue("@EmpId", e.EmpId); cmd.Parameters.AddWithValue("@ReqStatus", e.ReqStatus); try { con.Open(); cmd.ExecuteNonQuery(); } catch (SqlException ex) { Console.WriteLine(ex.Message); } } }
public static UpdatePendingLeaveRequest_EL UpdatePendingLeaveRequestInput() { Console.WriteLine("Update the pending request?"); UpdatePendingLeaveRequest_EL uplr = new UpdatePendingLeaveRequest_EL(); Console.WriteLine("Enter Id:"); uplr.EmpId = int.Parse(Console.ReadLine()); Console.WriteLine("Enter Updated Status: Accepted/Rejected"); uplr.ReqStatus = Console.ReadLine(); return(uplr); }