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

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_selectAll_CountingMethod", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cn.Open();
                DbDataReader reader = ExecuteReader(cmd);
                List <CountingMethodDetails> lst = new List <CountingMethodDetails>();
                while (reader.Read())
                {
                    CountingMethodDetails obj = new CountingMethodDetails();
                    obj.CountingMethodId          = GetReaderValue_Int32(reader, "CountingMethodId", 0);
                    obj.CountingMethodDescription = GetReaderValue_String(reader, "CountingMethodDescription", "");
                    obj.Inactive  = GetReaderValue_Boolean(reader, "Inactive", false);
                    obj.UpdatedBy = GetReaderValue_NullableInt32(reader, "UpdatedBy", null);
                    obj.DLUP      = GetReaderValue_DateTime(reader, "DLUP", DateTime.MinValue);
                    lst.Add(obj);
                    obj = null;
                }
                return(lst);
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get CountingMethods", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// DropDown
        /// Calls [usp_dropdown_CountingMethod]
        /// </summary>
        public override List <CountingMethodDetails> DropDown()
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_dropdown_CountingMethod", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cn.Open();
                DbDataReader reader = ExecuteReader(cmd);
                List <CountingMethodDetails> lst = new List <CountingMethodDetails>();
                while (reader.Read())
                {
                    CountingMethodDetails obj = new CountingMethodDetails();
                    obj.CountingMethodId          = GetReaderValue_Int32(reader, "CountingMethodId", 0);
                    obj.CountingMethodDescription = GetReaderValue_String(reader, "CountingMethodDescription", "");
                    lst.Add(obj);
                    obj = null;
                }
                return(lst);
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get CountingMethods", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
Ejemplo n.º 3
0
        private static CountingMethod PopulateFromDBDetailsObject(CountingMethodDetails obj)
        {
            CountingMethod objNew = new CountingMethod();

            objNew.CountingMethodId          = obj.CountingMethodId;
            objNew.CountingMethodDescription = obj.CountingMethodDescription;
            objNew.Inactive  = obj.Inactive;
            objNew.UpdatedBy = obj.UpdatedBy;
            objNew.DLUP      = obj.DLUP;
            return(objNew);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Get
        /// Calls [usp_select_CountingMethod]
        /// </summary>
        public override CountingMethodDetails Get(System.Int32?countingMethodId)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_select_CountingMethod", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@CountingMethodId", SqlDbType.Int).Value = countingMethodId;
                cn.Open();
                DbDataReader reader = ExecuteReader(cmd, CommandBehavior.SingleRow);
                if (reader.Read())
                {
                    //return GetCountingMethodFromReader(reader);
                    CountingMethodDetails obj = new CountingMethodDetails();
                    obj.CountingMethodId          = GetReaderValue_Int32(reader, "CountingMethodId", 0);
                    obj.CountingMethodDescription = GetReaderValue_String(reader, "CountingMethodDescription", "");
                    obj.Inactive  = GetReaderValue_Boolean(reader, "Inactive", false);
                    obj.UpdatedBy = GetReaderValue_NullableInt32(reader, "UpdatedBy", null);
                    obj.DLUP      = GetReaderValue_DateTime(reader, "DLUP", DateTime.MinValue);
                    return(obj);
                }
                else
                {
                    return(null);
                }
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get CountingMethod", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }