public Job(int jobId, Dnt jobTable, Dnt classTable, Dnt skilltable, XmlDocument uiString) : this() { //Check to make sure nothing is null if (jobTable == null) { throw new ArgumentNullException("JobTable"); } if (jobTable.Rows == null) { throw new ArgumentNullException("JobTable.Rows"); } if (classTable == null) { throw new ArgumentNullException("ClassTable"); } //Initilization List <DataRow> Jobs = new List <DataRow>(); //Get Information pertaining to the Job. var JobTableRows = jobTable.Rows.Cast <DataRow>(); for (int i = jobId; i != 0; i = Convert.ToInt32(Jobs.Last()[ParentColumnId])) { Jobs.Add(JobTableRows.First(p => p[RowIdColumnId].Equals(jobId))); } }
public List <User> EditDnt(Dnt dnt) { List <User> users = new List <User>(); using (SqlConnection con = new SqlConnection(connectionString)) { SqlCommand cmd = new SqlCommand("Update_Dnt", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Id", dnt.Id); cmd.Parameters.AddWithValue("@Url", dnt.Url); cmd.Parameters.AddWithValue("@Title", dnt.Title); cmd.Parameters.AddWithValue("@Description", dnt.Description); cmd.Parameters.AddWithValue("@Type", dnt.Type); con.Open(); //cmd.ExecuteNonQuery(); SqlDataReader rdr = cmd.ExecuteReader(); //while (rdr.Read()) //{ // User user = new User(); // user.Id = Convert.ToInt32(rdr["Id"].ToString()); // user.FirstName = rdr["FirstName"].ToString(); // user.LastName = rdr["LastName"].ToString(); // user.Email = rdr["Email"].ToString(); // user.RegNo = rdr["RegNo"].ToString(); // user.UserType = Convert.ToInt32(rdr["UserType"].ToString()); // user.Type = rdr["Type"].ToString(); // users.Add(user); //} con.Close(); } return(users); }
public List <Dnt> GetDnts() { List <Dnt> dnts = new List <Dnt>(); using (SqlConnection con = new SqlConnection(connectionString)) { SqlCommand cmd = new SqlCommand("Get_Dnts", con); cmd.CommandType = CommandType.StoredProcedure; con.Open(); //cmd.ExecuteNonQuery(); SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { Dnt dnt = new Dnt(); dnt.Id = Convert.ToInt32(rdr["Id"].ToString()); dnt.Title = rdr["Title"].ToString(); dnt.Url = rdr["Url"].ToString(); dnt.Description = rdr["Description"].ToString(); dnt.Type = Convert.ToInt32(rdr["Type"].ToString()); dnt.TypeDesc = rdr["TypeDesc"].ToString(); dnts.Add(dnt); } con.Close(); } return(dnts); }
public ResponseResult <Cookie> editDntType([FromBody] Dnt dnt) { ResponseResult <Cookie> result = new ResponseResult <Cookie>(); try { UserService userService = new UserService(); userService.EditDnt(dnt); result.IsSuccess = true; } catch (Exception e) { result.IsSuccess = false; result.Message = e.Message; } return(result); }
public bool AddDnt(Dnt dnt) { bool cookie = true; using (SqlConnection con = new SqlConnection(connectionString)) { SqlCommand cmd = new SqlCommand("Insert_Dnt", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Url", dnt.Url); cmd.Parameters.AddWithValue("@Title", dnt.Title); cmd.Parameters.AddWithValue("@Description", dnt.Description); cmd.Parameters.AddWithValue("@Type", dnt.Type); con.Open(); cmd.ExecuteNonQuery(); con.Close(); } return(cookie); }