Пример #1
0
 /// <summary>
 ///  Method for adding email log.
 /// </summary>
 /// <param name="objEmailLog"></param>
 /// <returns></returns>
 public int AddEmailLog(EmailLog objEmailLog)
 {
     return objCommonDAL.AddEmailLog(objEmailLog);
 }
Пример #2
0
        /// <summary>
        /// Method for adding email details in to email log
        /// </summary>
        /// <param name="objEmailLog"></param>
        /// <returns></returns>
        public int AddEmailLog(EmailLog objEmailLog)
        {
            int result = 0;
            try
            {
                SqlCommand objSqlCommand = new SqlCommand();

                SqlParameter[] objLstParams = new SqlParameter[6];

                SqlParameter objSubject = new SqlParameter("@Subject", SqlDbType.VarChar);
                objSubject.Value = objEmailLog.Subject;
                objLstParams[0] = objSubject;

                SqlParameter objBody = new SqlParameter("@Body", SqlDbType.VarChar);
                objBody.Value = Convert.ToString(objEmailLog.Body);
                objLstParams[1] = objBody;

                SqlParameter objTo = new SqlParameter("@To", SqlDbType.VarChar);
                objTo.Value = objEmailLog.To;
                objLstParams[2] = objTo;

                SqlParameter objFrom = new SqlParameter("@From", SqlDbType.VarChar);
                objFrom.Value = objEmailLog.From;
                objLstParams[3] = objFrom;

                SqlParameter objCreatedBy = new SqlParameter("@CreatedBy", SqlDbType.Int);
                objCreatedBy.Value = objEmailLog.CreatedBy;
                objLstParams[4] = objCreatedBy;

                SqlParameter objCreatedOn = new SqlParameter("@CreatedOn", SqlDbType.DateTime);
                objCreatedOn.Value = objEmailLog.CreatedOn;
                objLstParams[5] = objCreatedOn;

                result = Convert.ToInt32(SqlHelper.ExecuteScalar(SqlHelper.ConnectionString, CommandType.StoredProcedure, SP_AddEmailLog, objLstParams));
                objSqlCommand.Parameters.Clear();
            }
            catch (Exception ex)
            {
                log.Error("AddEmailLog \n Message: " + ex.Message + "\n Source: " + ex.Source + "\n StackTrace: " + ex.StackTrace);
                ExceptionLog.WriteLog(COMMONDATA + " @ AddEmailLog ", ex.Message + " \n " + ex.StackTrace);
            }
            return result;
        }