public bool UpdateStatus(DispatchBO detail) { try { string sql = "dbo.fn_update_status_dispatch"; conn = new NpgsqlConnection(connString); conn.Open(); using (var cmd = new NpgsqlCommand(sql, conn)) { cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("_orderdetailkey", NpgsqlTypes.NpgsqlDbType.Uuid, detail.OrderDetailKey); cmd.Parameters.AddWithValue("_status", NpgsqlTypes.NpgsqlDbType.Smallint, detail.status); cmd.ExecuteNonQuery(); return(true); } } catch (Exception msg) { throw msg; } finally { conn.Close(); } }
public HttpResponseMessage UpdateStatus([FromBody] DispatchBO routesBO) { var routesdata = routes.UpdateStatus(routesBO); return(Request.CreateResponse(HttpStatusCode.OK, routesdata, Configuration.Formatters.JsonFormatter)); }
public List <DispatchBO> GetDispatchItems(Guid orderdetailkey) { try { string sql = "dbo.fn_get_dispatchitemslist"; List <DispatchBO> DispatchItems = new List <DispatchBO>(); conn = new NpgsqlConnection(connString); conn.Open(); cmd = new NpgsqlCommand(sql, conn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("_orderdetailkey", NpgsqlTypes.NpgsqlDbType.Uuid, orderdetailkey); var reader = cmd.ExecuteReader(); do { while (reader.Read()) { var data = new DispatchBO(); data.OrderDetailKey = Utils.CustomParse <Guid>(reader["orderdetailkey"]); data.containerid = Utils.CustomParse <string>(reader["containerid"]); data.containerno = Utils.CustomParse <string>(reader["containerno"]); data.Routekey = Utils.CustomParse <Guid>(reader["routekey"]); data.driverkey = Utils.CustomParse <Guid>(reader["driverkey"]); data.driverid = Utils.CustomParse <string>(reader["driverid"]); data.drivernotes = Utils.CustomParse <string>(reader["drivernotes"]); data.legno = Utils.CustomParse <string>(reader["legno"]); data.legtype = Utils.CustomParse <short>(reader["legtype"]); data.legtypeDesc = Utils.CustomParse <string>(reader["legtypeDesc"]); if (reader["actualarrival"] != DBNull.Value) { data.actualarrival = Utils.CustomParse <DateTime>(reader["actualarrival"]); } if (reader["actualdeparture"] != DBNull.Value) { data.actualdeparture = Utils.CustomParse <DateTime>(reader["actualdeparture"]); } if (reader["portwaitingtimefrom"] != DBNull.Value) { data.portwaitingtimefrom = Utils.CustomParse <DateTime>(reader["portwaitingtimefrom"]); } if (reader["portwaitingtimeto"] != DBNull.Value) { data.portwaitingtimeto = Utils.CustomParse <DateTime>(reader["portwaitingtimeto"]); } if (reader["customerwaitingtimefrom"] != DBNull.Value) { data.customerwaitingtimefrom = Utils.CustomParse <DateTime>(reader["customerwaitingtimefrom"]); } if (reader["customerwaitingtimeto"] != DBNull.Value) { data.customerwaitingtimeto = Utils.CustomParse <DateTime>(reader["customerwaitingtimeto"]); } data.appointmentno = Utils.CustomParse <string>(reader["appointmentno"]); DispatchItems.Add(data); } }while (reader.NextResult()); reader.Close(); return(DispatchItems); } catch (Exception msg) { throw msg; } finally { conn.Close(); } }