Пример #1
0
        /// <summary>
        /// DropDown
        /// Calls [usp_dropdown_GlobalCountryList]
        /// </summary>
        public override List <GlobalCountryListDetails> DropDown(System.Boolean?includeSelected, System.Int32?clientNo)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_dropdown_GlobalCountryList", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@IncludeSelected", SqlDbType.Bit).Value = includeSelected;
                cmd.Parameters.Add("@ClientNo", SqlDbType.Int).Value        = clientNo;
                cn.Open();
                DbDataReader reader = ExecuteReader(cmd);
                List <GlobalCountryListDetails> lst = new List <GlobalCountryListDetails>();
                while (reader.Read())
                {
                    GlobalCountryListDetails obj = new GlobalCountryListDetails();
                    obj.GlobalCountryId   = GetReaderValue_Int32(reader, "GlobalCountryId", 0);
                    obj.GlobalCountryName = GetReaderValue_String(reader, "GlobalCountryName", "");
                    lst.Add(obj);
                    obj = null;
                }
                return(lst);
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get GlobalCountryLists", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
Пример #2
0
        private static GlobalCountryList PopulateFromDBDetailsObject(GlobalCountryListDetails obj)
        {
            GlobalCountryList objNew = new GlobalCountryList();

            objNew.GlobalCountryId   = obj.GlobalCountryId;
            objNew.GlobalCountryName = obj.GlobalCountryName;
            objNew.EECMember         = obj.EECMember;
            objNew.TelephonePrefix   = obj.TelephonePrefix;
            objNew.Include           = obj.Include;
            objNew.UpdatedBy         = obj.UpdatedBy;
            objNew.DLUP = obj.DLUP;
            return(objNew);
        }
Пример #3
0
        /// <summary>
        /// Get
        /// Calls [usp_select_GlobalCountryList]
        /// </summary>
        public override GlobalCountryListDetails Get(System.Int32?countryNo)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_select_GlobalCountryList", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@CountryNo", SqlDbType.Int).Value = countryNo;
                cn.Open();
                DbDataReader reader = ExecuteReader(cmd, CommandBehavior.SingleRow);
                if (reader.Read())
                {
                    //return GetGlobalCountryListFromReader(reader);
                    GlobalCountryListDetails obj = new GlobalCountryListDetails();
                    obj.GlobalCountryId   = GetReaderValue_Int32(reader, "GlobalCountryId", 0);
                    obj.GlobalCountryName = GetReaderValue_String(reader, "GlobalCountryName", "");
                    obj.EECMember         = GetReaderValue_Boolean(reader, "EECMember", false);
                    obj.TelephonePrefix   = GetReaderValue_String(reader, "TelephonePrefix", "");
                    obj.Include           = GetReaderValue_Boolean(reader, "Include", 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 GlobalCountryList", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
Пример #4
0
        /// <summary>
        /// GetList
        /// Calls [usp_selectAll_GlobalCountryList]
        /// </summary>
        public override List <GlobalCountryListDetails> GetList()
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_selectAll_GlobalCountryList", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cn.Open();
                DbDataReader reader = ExecuteReader(cmd);
                List <GlobalCountryListDetails> lst = new List <GlobalCountryListDetails>();
                while (reader.Read())
                {
                    GlobalCountryListDetails obj = new GlobalCountryListDetails();
                    obj.GlobalCountryId   = GetReaderValue_Int32(reader, "GlobalCountryId", 0);
                    obj.GlobalCountryName = GetReaderValue_String(reader, "GlobalCountryName", "");
                    obj.EECMember         = GetReaderValue_Boolean(reader, "EECMember", false);
                    obj.TelephonePrefix   = GetReaderValue_String(reader, "TelephonePrefix", "");
                    obj.Include           = GetReaderValue_Boolean(reader, "Include", 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 GlobalCountryLists", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }