public async Task UpdateEntityAsync(EnTemp type, Guid entityGuid, ServerStatus st, DateTime deliveryDate, string connectionString) { try { using (var cn = new SqlConnection(connectionString)) { var cmd = new SqlCommand("sp_Temp_UpdateEntities", cn) { CommandType = CommandType.StoredProcedure }; cmd.Parameters.AddWithValue("@type", (short)type); cmd.Parameters.AddWithValue("@entityGuid", entityGuid); cmd.Parameters.AddWithValue("@st", (short)st); cmd.Parameters.AddWithValue("@deliveryDate", deliveryDate); await cn.OpenAsync(); await cmd.ExecuteNonQueryAsync(); cn.Close(); } } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }
public static bool SaveLog(Guid cusGuid, Guid objectGuid, EnTemp tmp) { try { var db = new ModelContext(); var log = new SyncedData() { Guid = Guid.NewGuid(), Modified = DateTime.Now, Status = true, CustomerGuid = cusGuid, Type = tmp, ObjectGuid = objectGuid }; db.SyncedData.Add(log); db.SaveChanges(); return(true); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); return(false); } }
public static async Task UpdateEntityAsync(EnTemp type, Guid entityGuid, ServerStatus st, DateTime deliveryDate) => await UnitOfWork.Temp.UpdateEntityAsync(type, entityGuid, st, deliveryDate, Cache.ConnectionString);