예제 #1
0
        /// <summary>
        /// DropDown
        /// Calls [usp_dropdown_Reason]
        /// </summary>
        public override List <ReasonDetails> DropDown()
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_dropdown_Reason", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cn.Open();
                DbDataReader         reader = ExecuteReader(cmd);
                List <ReasonDetails> lst    = new List <ReasonDetails>();
                while (reader.Read())
                {
                    ReasonDetails obj = new ReasonDetails();
                    obj.ReasonId  = GetReaderValue_Int32(reader, "ReasonId", 0);
                    obj.Name      = GetReaderValue_String(reader, "Name", "");
                    obj.Sold      = GetReaderValue_Boolean(reader, "Sold", false);
                    obj.NotQuoted = GetReaderValue_Boolean(reader, "NotQuoted", false);
                    lst.Add(obj);
                    obj = null;
                }
                return(lst);
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get Reasons", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
예제 #2
0
파일: Reason.cs 프로젝트: vinay1988/Ang6API
        private static Reason PopulateFromDBDetailsObject(ReasonDetails obj)
        {
            Reason objNew = new Reason();

            objNew.ReasonId  = obj.ReasonId;
            objNew.Name      = obj.Name;
            objNew.Locked    = obj.Locked;
            objNew.Sold      = obj.Sold;
            objNew.NotQuoted = obj.NotQuoted;
            return(objNew);
        }
예제 #3
0
        /// <summary>
        /// DropDown
        /// Calls [usp_dropdown_StatusReason]
        /// </summary>
        public override List <ReasonDetails> DropDown(System.String strSection)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try
            {
                cn  = new SqlConnection(this.ConnectionString);
                cmd = new SqlCommand("usp_dropdown_StatusReason", cn);
                cmd.Parameters.Add("@Section", SqlDbType.NVarChar).Value = strSection;
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cn.Open();
                DbDataReader         reader = ExecuteReader(cmd);
                List <ReasonDetails> lst    = new List <ReasonDetails>();
                while (reader.Read())
                {
                    ReasonDetails obj = new ReasonDetails();
                    obj.ReasonId = GetReaderValue_Int32(reader, "StatusReasonId", 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 Reasons", sqlex);
            }
            finally
            {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
예제 #4
0
        /// <summary>
        /// Get
        /// Calls [usp_select_Reason]
        /// </summary>
        public override ReasonDetails Get(System.Int32?reasonId)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_select_Reason", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@ReasonId", SqlDbType.Int).Value = reasonId;
                cn.Open();
                DbDataReader reader = ExecuteReader(cmd, CommandBehavior.SingleRow);
                if (reader.Read())
                {
                    //return GetReasonFromReader(reader);
                    ReasonDetails obj = new ReasonDetails();
                    obj.ReasonId  = GetReaderValue_Int32(reader, "ReasonId", 0);
                    obj.Name      = GetReaderValue_String(reader, "Name", "");
                    obj.Locked    = GetReaderValue_Boolean(reader, "Locked", false);
                    obj.Sold      = GetReaderValue_Boolean(reader, "Sold", false);
                    obj.NotQuoted = GetReaderValue_Boolean(reader, "NotQuoted", false);
                    return(obj);
                }
                else
                {
                    return(null);
                }
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get Reason", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }