Ejemplo n.º 1
0
        /// <summary>
        /// GetList
        /// Calls [usp_selectAll_Sequencer]
        /// </summary>
        public override List <SequencerDetails> GetList()
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_selectAll_Sequencer", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cn.Open();
                DbDataReader            reader = ExecuteReader(cmd);
                List <SequencerDetails> lst    = new List <SequencerDetails>();
                while (reader.Read())
                {
                    SequencerDetails obj = new SequencerDetails();
                    obj.SystemDocumentNo = GetReaderValue_Int32(reader, "SystemDocumentNo", 0);
                    obj.ClientNo         = GetReaderValue_Int32(reader, "ClientNo", 0);
                    obj.NextNumber       = GetReaderValue_Int32(reader, "NextNumber", 0);
                    obj.UpdatedBy        = GetReaderValue_NullableInt32(reader, "UpdatedBy", null);
                    obj.DLUP             = GetReaderValue_DateTime(reader, "DLUP", DateTime.MinValue);
                    obj.Name             = GetReaderValue_String(reader, "Name", "");
                    lst.Add(obj);
                    obj = null;
                }
                return(lst);
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get Sequencers", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// GetListForClient
        /// Calls [usp_selectAll_Sequencer_for_Client]
        /// </summary>
        public override List <SequencerDetails> GetListForClient(System.Int32?clientId)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_selectAll_Sequencer_for_Client", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@ClientId", SqlDbType.Int).Value = clientId;
                cn.Open();
                DbDataReader            reader = ExecuteReader(cmd);
                List <SequencerDetails> lst    = new List <SequencerDetails>();
                while (reader.Read())
                {
                    SequencerDetails obj = new SequencerDetails();
                    obj.SystemDocumentNo = GetReaderValue_Int32(reader, "SystemDocumentNo", 0);
                    obj.NextNumber       = GetReaderValue_Int32(reader, "NextNumber", 0);
                    obj.Name             = GetReaderValue_String(reader, "Name", "");
                    lst.Add(obj);
                    obj = null;
                }
                return(lst);
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get Sequencers", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
Ejemplo n.º 3
0
        private static Sequencer PopulateFromDBDetailsObject(SequencerDetails obj)
        {
            Sequencer objNew = new Sequencer();

            objNew.SystemDocumentNo = obj.SystemDocumentNo;
            objNew.ClientNo         = obj.ClientNo;
            objNew.NextNumber       = obj.NextNumber;
            objNew.UpdatedBy        = obj.UpdatedBy;
            objNew.DLUP             = obj.DLUP;
            objNew.Name             = obj.Name;
            return(objNew);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Get
        /// Calls [usp_select_Sequencer]
        /// </summary>
        public override SequencerDetails Get(System.Int32?systemDocumentNo, System.Int32?clientId)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_select_Sequencer", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@SystemDocumentNo", SqlDbType.Int).Value = systemDocumentNo;
                cmd.Parameters.Add("@ClientId", SqlDbType.Int).Value         = clientId;
                cn.Open();
                DbDataReader reader = ExecuteReader(cmd, CommandBehavior.SingleRow);
                if (reader.Read())
                {
                    //return GetSequencerFromReader(reader);
                    SequencerDetails obj = new SequencerDetails();
                    obj.SystemDocumentNo = GetReaderValue_Int32(reader, "SystemDocumentNo", 0);
                    obj.ClientNo         = GetReaderValue_Int32(reader, "ClientNo", 0);
                    obj.NextNumber       = GetReaderValue_Int32(reader, "NextNumber", 0);
                    obj.UpdatedBy        = GetReaderValue_NullableInt32(reader, "UpdatedBy", null);
                    obj.DLUP             = GetReaderValue_DateTime(reader, "DLUP", DateTime.MinValue);
                    obj.Name             = GetReaderValue_String(reader, "Name", "");
                    return(obj);
                }
                else
                {
                    return(null);
                }
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get Sequencer", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }