private OperationResult CreateFaxRecord(string faxName, string faxNumber, string recipientName, string faxPath) { OperationResult operationResult = new OperationResult(); try { SendFax sendAFax = new AutomatedFaxBL.Models.SendFax(); sendAFax.AccountID = "1001"; sendAFax.UserID = ConfigurationValues.FaxAutomationUserName; sendAFax.FaxName = faxName; sendAFax.FaxPath = faxPath; sendAFax.FaxNumber = faxNumber; sendAFax.RecipientName = recipientName; sendAFax.Notes = string.Empty; sendAFax.PageCount = Utility.GetPDFPageCount(faxPath); sendAFax.FaxSent = "Y"; sendAFax.InUse = "N"; sendAFax.ToTif = "Y"; sendAFax.CallWait = 0; sendAFax.TimesCalled = 0; sendAFax.Status = "New Fax Entry"; sendAFax.ShowFax = "Y"; sendAFax.CreateTime = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(); sendAFax.CompletionTime = string.Empty; sendAFax.DateStamp = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(); operationResult = faxRepository.SendFax(sendAFax); return operationResult; } catch(Exception er) { Logging.LogErrors(ConfigurationValues.ErrorLogPath, er.ToString()); operationResult.Success = false; operationResult.ErrorMessage = er.ToString(); return operationResult; } }
public OperationResult SendFax(SendFax sendFax) { OperationResult operationResult = new Models.OperationResult(); using (IDbConnection db = new SqlConnection(ConfigurationValues.WaldenFaxConnection)) { try { const string query = "INSERT INTO [FaxesSendServer](" + "[AccountID]" + ",[UserID]" + ",[FaxName]" + ",[FaxPath]" + ",[FaxNumber]" + ",[RecipientName]" + ",[Notes]" + ",[PageCount]" + ",[FaxSent]" + ",[InUse]" + ",[ToTif]" + ",[CallWait]" + ",[TimesCalled]" + ",[Status]" + ",[ShowFax]" + ",[CreateTime]" + ",[CompletionTime]" + ",[DateStamp])" + " VALUES(" + "@AccountID" + ",@UserID" + ",@FaxName" + ",@FaxPath" + ",@FaxNumber" + ",@RecipientName" + ",@Notes" + ",@PageCount" + ",@FaxSent" + ",@InUse" + ",@ToTif" + ",@CallWait" + ",@TimesCalled" + ",@Status" + ",@ShowFax" + ",@CreateTime" + ",@CompletionTime" + ",@DateStamp)"; int rowsAffectd = db.Execute(query, new { @AccountID = sendFax.AccountID, @UserID = sendFax.UserID, @FaxName = sendFax.FaxName, @FaxPath = sendFax.FaxPath, @FaxNumber = sendFax.FaxNumber, @RecipientName = sendFax.RecipientName, @Notes = sendFax.Notes, @PageCount = sendFax.PageCount, @FaxSent = sendFax.FaxSent, @InUse = sendFax.InUse, @ToTif = sendFax.ToTif, @CallWait = sendFax.CallWait, @TimesCalled = sendFax.TimesCalled, @Status = sendFax.Status, @ShowFax = sendFax.ShowFax, @CreateTime = sendFax.CreateTime, @CompletionTime = sendFax.CompletionTime, @DateStamp = sendFax.DateStamp }); sendFaxId = GetSendFaxID(); operationResult.Success = true; operationResult.AddMessage(sendFaxId.ToString()); return operationResult; } catch (Exception er) { Utility.LogErrors(ConfigurationValues.ErrorLogPath, er.ToString()); operationResult.Success = false; operationResult.AddMessage(er.ToString()); return operationResult; } } }
private OperationResult CreateFaxRecord(string faxName, string faxNumber, string recipientName, string faxPath) { SendFax sendAFax = new AutomatedFaxBL.Models.SendFax(); sendAFax.AccountID = "1001"; sendAFax.UserID = ConfigurationValues.FaxAutomationUserName; sendAFax.FaxName = faxName; sendAFax.FaxPath = faxPath; sendAFax.FaxNumber = faxNumber; sendAFax.RecipientName = recipientName; sendAFax.Notes = string.Empty; sendAFax.PageCount = Utility.GetPageCount(faxPath); sendAFax.FaxSent = "Y"; sendAFax.InUse = "N"; sendAFax.ToTif = "Y"; sendAFax.CallWait = 0; sendAFax.TimesCalled = 0; sendAFax.Status = "New Fax Entry"; sendAFax.ShowFax = "Y"; sendAFax.CreateTime = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(); sendAFax.CompletionTime = string.Empty; sendAFax.DateStamp = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(); OperationResult operationResult = faxRepository.SendFax(sendAFax); return operationResult; }