private int GetRetryCount(ResendFax resendFax) { int count = 0; try { using (IDbConnection db = new SqlConnection(ConfigurationValues.WaldenFaxConnection)) { const string query = "select callwait from FaxesSendServer" + " where sendid = @sendid"; count = db.Query<int>(query, new { @sendid = resendFax.SendID }).Single(); return count + 1; } } catch (Exception er) { Utility.LogErrors(ConfigurationValues.ErrorLogPath, er.ToString()); return count; } }
public void ResendFailedFax(ResendFax resendFax) { List<ResendFax> resendFaxList = new List<Models.ResendFax>(); using (IDbConnection db = new SqlConnection(ConfigurationValues.WaldenFaxConnection)) { try { const string query = "update FaxesSendServer" + " set faxsent = 'N'" + " , callwait = @callwait" + " where sendid = @sendid"; int rowsAffectd = db.Execute(query, new { @sendid = resendFax.SendID, @callwait = GetRetryCount(resendFax) }); } catch (Exception er) { Utility.LogErrors(ConfigurationValues.ErrorLogPath, er.ToString()); } } }