/// <summary>
        /// GetForClientAndDocument
        /// Calls [usp_select_SystemDocumentFooter_for_Client_and_Document]
        /// </summary>
        public override SystemDocumentFooterDetails GetForClientAndDocument(System.Int32?clientNo, System.Int32?systemDocumentNo)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_select_SystemDocumentFooter_for_Client_and_Document", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@ClientNo", SqlDbType.Int).Value         = clientNo;
                cmd.Parameters.Add("@SystemDocumentNo", SqlDbType.Int).Value = systemDocumentNo;
                cn.Open();
                DbDataReader reader = ExecuteReader(cmd, CommandBehavior.SingleRow);
                if (reader.Read())
                {
                    //return GetSystemDocumentFooterFromReader(reader);
                    SystemDocumentFooterDetails obj = new SystemDocumentFooterDetails();
                    obj.FooterText = GetReaderValue_String(reader, "FooterText", "");
                    return(obj);
                }
                else
                {
                    return(null);
                }
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get SystemDocumentFooter", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
Exemple #2
0
        private static SystemDocumentFooter PopulateFromDBDetailsObject(SystemDocumentFooterDetails obj)
        {
            SystemDocumentFooter objNew = new SystemDocumentFooter();

            objNew.SystemDocumentFooterId = obj.SystemDocumentFooterId;
            objNew.ClientNo           = obj.ClientNo;
            objNew.SystemDocumentNo   = obj.SystemDocumentNo;
            objNew.FooterText         = obj.FooterText;
            objNew.UpdatedBy          = obj.UpdatedBy;
            objNew.DLUP               = obj.DLUP;
            objNew.SystemDocumentName = obj.SystemDocumentName;
            return(objNew);
        }
        /// <summary>
        /// GetListForClient
        /// Calls [usp_selectAll_SystemDocumentFooter_for_Client]
        /// </summary>
        public override List <SystemDocumentFooterDetails> GetListForClient(System.Int32?clientNo)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_selectAll_SystemDocumentFooter_for_Client", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@ClientNo", SqlDbType.Int).Value = clientNo;
                cn.Open();
                DbDataReader reader = ExecuteReader(cmd);
                List <SystemDocumentFooterDetails> lst = new List <SystemDocumentFooterDetails>();
                while (reader.Read())
                {
                    SystemDocumentFooterDetails obj = new SystemDocumentFooterDetails();
                    obj.SystemDocumentFooterId = GetReaderValue_Int32(reader, "SystemDocumentFooterId", 0);
                    obj.ClientNo           = GetReaderValue_Int32(reader, "ClientNo", 0);
                    obj.SystemDocumentNo   = GetReaderValue_Int32(reader, "SystemDocumentNo", 0);
                    obj.FooterText         = GetReaderValue_String(reader, "FooterText", "");
                    obj.UpdatedBy          = GetReaderValue_NullableInt32(reader, "UpdatedBy", null);
                    obj.DLUP               = GetReaderValue_NullableDateTime(reader, "DLUP", null);
                    obj.SystemDocumentName = GetReaderValue_String(reader, "SystemDocumentName", "");
                    lst.Add(obj);
                    obj = null;
                }
                return(lst);
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get SystemDocumentFooters", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }