示例#1
0
        /// <summary>
        /// Get
        /// Calls [usp_select_StockLogReason]
        /// </summary>
        public override StockLogReasonDetails Get(System.Int32?stockLogReasonId)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_select_StockLogReason", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@StockLogReasonId", SqlDbType.Int).Value = stockLogReasonId;
                cn.Open();
                DbDataReader reader = ExecuteReader(cmd, CommandBehavior.SingleRow);
                if (reader.Read())
                {
                    //return GetStockLogReasonFromReader(reader);
                    StockLogReasonDetails obj = new StockLogReasonDetails();
                    obj.StockLogReasonId = GetReaderValue_Int32(reader, "StockLogReasonId", 0);
                    obj.Name             = GetReaderValue_String(reader, "Name", "");
                    obj.ClientNo         = GetReaderValue_Int32(reader, "ClientNo", 0);
                    return(obj);
                }
                else
                {
                    return(null);
                }
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get StockLogReason", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
示例#2
0
        /// <summary>
        /// DropDown
        /// Calls [usp_dropdown_StockLogReason]
        /// </summary>
        public override List <StockLogReasonDetails> DropDown(System.Int32?clientNo)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_dropdown_StockLogReason", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@ClientNo", SqlDbType.Int).Value = clientNo;
                cn.Open();
                DbDataReader reader = ExecuteReader(cmd);
                List <StockLogReasonDetails> lst = new List <StockLogReasonDetails>();
                while (reader.Read())
                {
                    StockLogReasonDetails obj = new StockLogReasonDetails();
                    obj.StockLogReasonId = GetReaderValue_Int32(reader, "StockLogReasonId", 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 StockLogReasons", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
示例#3
0
        private static StockLogReason PopulateFromDBDetailsObject(StockLogReasonDetails obj)
        {
            StockLogReason objNew = new StockLogReason();

            objNew.StockLogReasonId = obj.StockLogReasonId;
            objNew.Name             = obj.Name;
            objNew.ClientNo         = obj.ClientNo;
            return(objNew);
        }