/// <summary> Save or Update Lookup Details </summary> /// <param name="lookupDetail">LookupDetails Object</param> /// <returns>LookupDetails Object</returns> public LookupDetails SaveLookupDetails(LookupDetails lookupDetail) { var dataset = new DataSet(); LookupDetails lookupDetails = new LookupDetails(); Logging.LogDebugMessage("Method: SaveLookupDetails, MethodType: Post, Layer: LookupsDAL, Parameters: lookupDetail = " + JsonConvert.SerializeObject(lookupDetail)); try { using (var command = new SqlCommand()) { command.Connection = new SqlConnection(this.ConnectionString); command.CommandText = "USP_SaveLookupDetails"; command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter() { ParameterName = "@LookupDetailsId", Value = lookupDetail.LookupDetailsId }); command.Parameters.Add(new SqlParameter() { ParameterName = "@LookupId", Value = lookupDetail.LookupId }); command.Parameters.Add(new SqlParameter() { ParameterName = "@LookupDetailsDescription", Value = lookupDetail.LookupDetailsDescription }); command.Parameters.Add(new SqlParameter() { ParameterName = "@LookupDetailsValue", Value = lookupDetail.LookupDetailsValue }); command.Parameters.Add(new SqlParameter() { ParameterName = "@LookupDetailsLongDescription", Value = lookupDetail.LookupDetailsLongDescription }); command.Parameters.Add(new SqlParameter() { ParameterName = "@LookupDetailsSequenceOrder", Value = lookupDetail.LookupDetailsSequenceOrder }); command.Parameters.Add(new SqlParameter() { ParameterName = "@LookupDetailsCrossWalkValue", Value = lookupDetail.LookupDetailsCrossWalkValue }); command.Parameters.Add(new SqlParameter() { ParameterName = "@LookupDetailsCategory", Value = lookupDetail.LookupDetailsCategory }); command.Parameters.Add(new SqlParameter() { ParameterName = "@LookupDetailsType", Value = lookupDetail.LookupDetailsType }); command.Parameters.Add(new SqlParameter() { ParameterName = "@LookupDetailsSubSequenceOrder", Value = lookupDetail.LookupDetailsSubSequenceOrder }); command.Parameters.Add(new SqlParameter() { ParameterName = "@LookupDetailsSubCategory", Value = lookupDetail.LookupDetailsSubCategory }); command.Parameters.Add(new SqlParameter() { ParameterName = "@LookupDetailsSubType", Value = lookupDetail.LookupDetailsSubType }); command.Parameters.Add(new SqlParameter() { ParameterName = "@LookupDetailsShortDescription", Value = lookupDetail.LookupDetailsShortDescription }); command.Parameters.Add(new SqlParameter() { ParameterName = "@LookupDetailsDisplayDescription", Value = lookupDetail.LookupDetailsDisplayDescription }); command.Parameters.Add(new SqlParameter() { ParameterName = "@IsUsedInDisplay", Value = lookupDetail.IsUsedInDisplay }); command.Parameters.Add(new SqlParameter() { ParameterName = "@LookupDetailsEffectiveFrom", Value = lookupDetail.LookupDetailsEffectiveFrom }); command.Parameters.Add(new SqlParameter() { ParameterName = "@LookupDetailsEffectiveTo", Value = lookupDetail.LookupDetailsEffectiveTo }); command.Parameters.Add(new SqlParameter() { ParameterName = "@CreatedByUserID", Value = lookupDetail.CreateUserId }); command.Parameters.Add(new SqlParameter() { ParameterName = "@RowStatus", Value = lookupDetail.RowStatus }); using (SqlDataAdapter adapter = new SqlDataAdapter(command)) { adapter.Fill(dataset); if (dataset != null) { lookupDetails = EntityCollectionHelper.ConvertTo <LookupDetails>(dataset.Tables[0]).FirstOrDefault(); } } } } catch (SqlException sqlEx) { Logging.LogErrorMessage("Method: SaveLookupDetails, Layer: LookupsDAL, Stack Trace: " + sqlEx.ToString()); throw; } catch (Exception ex) { Logging.LogErrorMessage("Method: SaveLookupDetails, Layer: LookupsDAL, Stack Trace: " + ex.ToString()); throw; } return(lookupDetails); }